function sltcnd_1_kernel_ua(nI, exc) result(hel)
integer, intent(in) :: nI(nel)
type(Excite_1_t) :: exc
HElement_t(dp) :: hel
integer :: i, id, id_ex(2)
! Obtain spatial rather than spin indices if required
id_ex = exc%val(:, 1)
hel = (0)
if (tReltvy .or. (G1(exc%val(1, 1))%Ms == G1(exc%val(2, 1))%Ms)) then
do i = 1, nel
if (exc%val(1, 1) /= nI(i)) then
id = 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(exc%val(1, 1))%Ms == G1(exc%val(2, 1))%Ms) .or. tReltvy)) then
do i = 1, nel
if (exc%val(1, 1) /= nI(i)) then
if (tReltvy .or. (G1(exc%val(1, 1))%Ms == G1(nI(i))%Ms)) then
id = 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(exc%val(1, 1), exc%val(2, 1))
end function sltcnd_1_kernel_ua