anchor.diff:        write(13,'(i3," atoms of label type ",i2," found")') ic, i
      enddo
      write(13,'("Finished counting the atoms of each type")')  
  -   
  -   write(12,*) ! Start next line
  +   ! Write the number of spectator atoms on line 6 of the poscar
  +   if (file_exists) write(12,'(100(i4,1x))') nSpecType*n !
  +   !write(12,*) ! Start next line
      write(12,'("D")')
      
      ! This part lists the atomic basis vectors that we found in the triple z1, z2, z3 loops above.
  -   ! For vasp, UNCLE it needs to list the vectors in blocks of that have the same label.
  +   ! For vasp, UNCLE it needs to list the vectors in blocks of atoms that have the same label.
      call cartesian2direct(sLV,aBas,eps)
      do ilab = 0,k-1
         do iAt = 1, n*nD
  
positive.code: else
    strNf=strNi
  endif
  
  !call read_nth_line_from_enumlist()
  open(11,file=fname,status='old',iostat=ioerr)
  
negative.code:          endif
        enddo
     enddo
  
  ! Now, if there are spectators in the parent cell, put them in the superlattice POSCAR
     if(file_exists) then
        do iSpec = 1, nType
           do jAt = 1, nSpecType(iSpec)
              read(14,*) shift
              do iAt = 1, n               
                  write(12,'(3(f12.8,1x),"spectator type:",i2,1x," cell#",i4)')&
                      & aBas(:,iAt) + shift, iSpec, iAt
                 write(13,'("At. #: ",i2," position:",3(f7.3,1x),"<",a1,"&
                      &>")') iAt, aBas(:,iAt), labeling(gIndx(iAt):gIndx(iAt))
              end do
              !rewind(14)
              !read(14,*)
           end do
        end do
        close(14)
     end if
  
     close(12);
     deallocate(spin,x,gIndx,aBas)
  enddo ! structure loop
  if (file_exists) close(14)
  close(11)
  close(13)
  END PROGRAM makeStr
  