anchor.diff:     ! Use the permutations effected by the rotations that fix the superlattice to generate labelings
      ! that are equivalent. The list of equivalent labelings will be used when we look for a match in the
      ! struct_enum file
  -   allocate(ilabeling1(n*nD1),ilabeling2(n*nD1))!,permutedLab(n*nD1)) 26 July, permutedLab not used
  +   allocate(ilabeling1(n*nD1),ilabeling2(n*nD1),tempLab(n*nD1))!,permutedLab(n*nD1)) 26 July, permutedLab not used
      read(labeling,'(500i1)') ilabeling1
      !write(*,'("ilabeling1:",/,30(i1),/)') ilabeling1
  -   !print *,"size",size(ilabeling1)
  -   !print *,"strN",strN
  -   call find_equivalent_labelings(ilabeling1,LattRotList1,pLabel,rotProdLab)
  -   ! do i = 1,size(plabel,1)
  -   !    write(*,'("equiv_labelings <> ",100(i1))') pLabel(i,:)
  -   ! enddo
  -   !print *,"after find_eqv"
  -   nuq = size(pLabel,1)
  -   write(17,'(/,"Number of unique labelings: ",i5)') nuq
  -   do iuq = 1, nuq
  -      write(17,'("uq Labeling # :",i3,5x,"labeling:",1x,200(i1,1x))') iuq,pLabel(iuq,:)
  -   enddo
  -   close(17)
      match = 0
      ! Read in each structure from the second file and see if it matches the current structures from
      ! file 1.
  +
  +!! END read from file1
  +
      f2 = 14; ! Define a unit number for the second file.
      open(f2,file=f2name,status="old")
      lc = 0 ! Count the number of lines
  
positive.code:          allocate(automorphism(n2))
           call find_permutation_of_group(g1,g2,automorphism)
           !3) change ilabeling2 into the equivalent ilabeling1
           write(*,'("before:  ",14i1)') ilabeling2
           do i = 0, n*nD2-1, n
  !            write(*,'("i  ",i2," vs: ",7i2)')i,(automorphism+i)
              ilabeling2(1+i:n+i) = ilabeling2(automorphism+i)
           enddo
           write(*,'("before:  ",14i1)') ilabeling2
           !4) proceed as normal
        endif
           foundLab = .false.
           nL = size(pLabel,1)
           outer: do iL = 1, nL
              ! We need to loop over all permutations (to get the full orbit) because we do not know
              ! which member of the orbit is the representative.
              ! Also, for 50-50 labelings that are self-complementary (more generally, any
  
negative.code: real(dp), allocatable :: dset1(:,:), dset2(:,:), rot(:,:,:), shift(:,:)
  real(dp), pointer :: sLVlist(:,:,:)
  integer, pointer :: HNFout(:,:,:), eq(:), digit(:), HNFin(:,:,:)
  integer, pointer, dimension(:,:) :: label, g1, g2, dlabel, qLabel
  integer :: LatDim1, LatDim2, match, nD1, nD2, Nmin, Nmax, k, ioerr
  integer :: strN, sizeN, n, pgOps, diag(3), a, b, c, d, e, f, i, jl, j
  integer :: iuq, nuq, iP, nP, lc, iStr2, HNFtest(3,3), hdgenfact, labdgen, totdgen
  integer :: strN2, hnfN2, n2, pgOps2, diag2(3), idx, f1, f2, iLP, nLP, equiN
  integer, allocatable :: ilabeling1(:), ilabeling2(:), atomType(:), automorphism(:), integerLab(:)
  integer, allocatable :: tempLab(:)
  real(dp) :: eps
  logical full, HNFmatch, foundLab, err, equiatomic
  character(maxLabLength)   :: labeling ! List, 0..k-1, of the atomic type at each site
  type(RotPermList)         :: dRotList1, dRotList2
  type(RotPermList),pointer :: LattRotList1(:), LattRotList2(:)
  type(opList), pointer     :: fixOp(:)
  integer, pointer          :: crange(:,:), degen_list(:), rotProdLab(:), labPerms(:,:)
  
  SNF = 0
  allocate(HNFin(3,3,1))
  