LOGICAL FUNCTION IsMomAllowedDetAnyParent(nJ, parentSym)
Type(Symmetry) :: SYM1
Type(Symmetry) :: parentSym
Type(BasisFN) :: iSym
INTEGER :: i, nJ(NEl), KPnt(3)
IsMomAllowedDetAnyParent = .false.
SYM1%S = 0
do i = 1, NEl
SYM1 = SYMPROD(SYM1, G1(nJ(i))%Sym)
end do
IF (SYM1%S /= parentSym%S) THEN
write(stdout, *) "nJ: ", nJ(:)
write(stdout, *) "parentSym,SYM1: ", parentSym%S, SYM1%S
! write(stdout,*) "Counter: ",Counter
CALL DecomposeAbelianSym(SYM1%S, KPnt)
write(stdout, "(A,3I5)") "KPnt for nJ: ", KPnt(1), KPnt(2), KPnt(3)
CALL Stop_All("IsMomAllowedDet", "Momentum forbidden excitation created1.")
ELSE
IsMomAllowedDetAnyParent = .true.
end if
CALL GETSYM(nJ, NEl, G1, nBasisMax, iSym)
IF (iSym%Sym%S /= parentSym%S) THEN
write(stdout, *) "nJ: ", nJ(:)
write(stdout, *) "parentSym,SYM1: ", parentSym%S, iSym%Sym%S
! write(stdout,*) "Counter: ",Counter
CALL DecomposeAbelianSym(iSym%Sym%S, KPnt)
write(stdout, "(A,3I5)") "KPnt for nJ: ", KPnt(1), KPnt(2), KPnt(3)
CALL Stop_All("IsMomAllowedDet", "Momentum forbidden excitation created2.")
ELSE
IsMomAllowedDetAnyParent = .true.
end if
END FUNCTION IsMomAllowedDetAnyParent