pure SUBROUTINE ADDELECSYM(IEL, G1, NBASISMAX, ISYM)
integer, intent(in) :: iEl, nBasisMax(5, *)
TYPE(BASISFN), intent(in) :: G1(*)
TYPE(BASISFN), intent(inout) :: ISYM
integer :: ielec, i, ssym
ielec = iel
ssym = 0
IF (NBASISMAX(1, 3) < 4) THEN
! Momentum space
if (t_k_space_hubbard) then
isym%k = lat%add_k_vec(isym%k, G1(ielec)%k)
else
ISYM%k = ISYM%k + G1(IELEC)%k
end if
! Symmetry space
else if (NBASISMAX(3, 3) == 0 .AND. NBASISMAX(1, 3) >= 4) THEN
! We have no symmetries, so do nothing. (we're in real space)
! except Ms
else if (NBASISMAX(3, 3) == 1) THEN
! deal with momentum
if (t_k_space_hubbard) then
isym%k = lat%add_k_vec(isym%k, G1(ielec)%k)
else
ISYM%k = ISYM%k + G1(IELEC)%k
end if
end if
ISYM%MS = ISYM%MS + G1(IELEC)%MS
ISYM%Ml = ISYM%Ml + G1(IELEC)%Ml
! SSYM keeps track of the total S change on adding this electron
! (it is +/-CSF_NSBASIS)
I = ISYM%MS + 0
ISYM%Ms = I + SSYM
END SUBROUTINE ADDELECSYM