function sltcnd_1_kernel(nI, ex) result(hel)
integer, intent(in) :: nI(nel)
type(Excite_1_t), intent(in) :: ex
HElement_t(dp) :: hel
integer :: i, id, id_ex(2)
! Obtain spatial rather than spin indices if required
id_ex = gtID(ex%val(:,1))
hel = (0)
if (tReltvy .or. (G1(ex%val(1, 1))%Ms == G1(ex%val(2, 1))%Ms)) then
do i = 1, nel
if (ex%val(1, 1) /= nI(i)) then
id = gtID(nI(i))
hel = hel + get_umat_el(id_ex(1), id, id_ex(2), id)
end if
end do
end if
! Exchange contribution is only considered if tExch set.
! This is only separated from the above loop to keep "if (tExch)" out
! of the tight loop for efficiency.
if (tExch .and. ((G1(ex%val(1, 1))%Ms == G1(ex%val(2, 1))%Ms) .or. tReltvy)) then
do i = 1, nel
if (ex%val(1, 1) /= nI(i)) then
if (tReltvy .or. (G1(ex%val(1, 1))%Ms == G1(nI(i))%Ms)) then
id = gtID(nI(i))
hel = hel - get_umat_el(id_ex(1), id, id, id_ex(2))
end if
end if
end do
end if
! consider the non-diagonal part of the kinetic energy -
! <psi_a|T|psi_a'> where a, a' are the only basis fns that differ in
! nI, nJ
hel = hel + GetTMATEl(ex%val(1, 1), ex%val(2, 1))
end function sltcnd_1_kernel