anchor.diff:        enddo
      enddo
   enddo ! loop over iH (superlattices)
  +close(19)
   ENDSUBROUTINE get_rotation_perms_lists
   
   !***************************************************************************************************
  
positive.code: 
  RP = 0; found = .false.
  nD = size(rd,2) ! # of d-vectors
  !!DEBUGdo iD = 1, nD
  !!DEBUG   write(*,'("rd: ",3(f8.4,1x))') rd(:,iD)
  !!DEBUG   write(*,'(" d: ",3(f8.4,1x))')  d(:,iD)
  !!DEBUGenddo
  
  do iD = 1, nD
     do jD = 1, nD
  
negative.code: logical err
  real(dp), allocatable :: rgp(:,:)
  logical, allocatable :: skip(:)
  integer OpIndxInSuperCellList, RowInDxGTable
  
  open(19,file="debug_get_rotation_perms_lists.out")
  
  ! Number of HNFs (superlattices); Index of the superlattices; Number of d-vectors in d set
  nH = size(HNF,3); n = determinant(HNF(:,:,1)); nD = size(RPList(1)%v,2) 
  