SUBROUTINE GENALLSymStatePairs(NSTATES, TSTORE, FRZ)
IMPLICIT NONE
LOGICAL TSTORE, FRZ
INTEGER I, J
TYPE(Symmetry) PROD
INTEGER NSTATES, iProd
DO I = 1, NSTATES
DO J = I, NSTATES
! write(stdout,*) I,J,SymClasses(I),SymClasses(J)
IF (FRZ) THEN
PROD = SYMPROD(SymLabels(SymClasses2(I)), SymLabels(SymClasses2(J)))
ELSE
PROD = SYMPROD(SymLabels(SymClasses(I)), SymLabels(SymClasses(J)))
end if
CALL FindSymProd(Prod, SymPairProds, nSymPairProds, iProd)
IF (TSTORE) THEN
! put the pair into the list of pairs.
SymStatePairs(1, SymPairProds(iProd)%nIndex + SymPairProds(iProd)%nPairs) = I
SymStatePairs(2, SymPairProds(iProd)%nIndex + SymPairProds(iProd)%nPairs) = J
end if
IF (iProd == nSymPairProds + 1) THEN
nSymPairProds = nSymPairProds + 1
SymPairProds(iProd)%Sym = Prod
SymPairProds(iProd)%nIndex = 0
SymPairProds(iProd)%nPairs = 0
end if
! incrememnt the counter in the pairlist
SymPairProds(iProd)%nPairs = SymPairProds(iProd)%nPairs + 1
end do
end do
END SUBROUTINE GENALLSymStatePairs