elemental FUNCTION SymConj(s2)
type(symmetry), intent(in) :: s2
TYPE(Symmetry) s, SymConj
INTEGER i, AbelConj(3)
if (TAbelian) then
IF (TwoCycleSymGens) THEN
!For molecular systems, we only have symmetry generators which are two cycles, and so the inverse of
!a symmetry is simply itself.
SymConj%s = s2%s
RETURN
ELSE
! K-point symmetry has k_-i=k_i. We store k-vectors from 0
! to N rather than -N/2 to N. Hence k_-i=mod(-k_i+N,N) for
! each component of the vector.
! This also works for abelian groups made out of symmetry
! generators which are 2-cycles
call DecomposeAbelianSym(s2%s, AbelConj)
do i = 1, 3
AbelConj(i) = modulo(-AbelConj(i) + NProp(i), NProp(i))
end do
SymConj%s = ComposeAbelianSym(AbelConj)
end if
else
SymConj%s = 0
s = s2
i = 1
DO WHILE (s%s /= 0)
!LSHIFT(,)
! 1_8 is 1 in integer(int64): we need to have consistent
! kinds for bit-wise operations.
IF (BTEST(s%s, 0)) SymConj%s = IOR(SymConj%s, ISHFT(1_int64, int(SymConjTab(I) - 1, int64)))
!RSHIFT(,1)
s%s = ISHFT(s%s, -1)
i = i + 1
end do
end if
END FUNCTION SYMCONJ