sltcnd_0_base Function

public pure function sltcnd_0_base(nI, exc) result(hel)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
type(Excite_0_t), intent(in) :: exc

Return Value real(kind=dp)


Contents

Source Code


Source Code

    pure function sltcnd_0_base(nI, exc) result(hel)
        ! Calculate the  by the SlaterCondon Rules when the two
        ! determinants are the same (so we only need to specify one).
        integer, intent(in) :: nI(nel)
        type(Excite_0_t), intent(in) :: exc
        HElement_t(dp) :: hel, hel_sing, hel_doub, hel_tmp
        integer :: id(nel), i, j

#ifdef WARNING_WORKAROUND_
        associate(exc => exc); end associate
#endif

        ! Sum in the one electron integrals (KE --> TMAT)
        hel_sing = sum(GetTMATEl(nI, nI))

        ! Obtain the spatial rather than spin indices if required
        id = gtID(nI)

        ! Sum in the two electron contributions.
        hel_doub = h_cast(0._dp)
        do i = 1, nel - 1
            hel_doub = hel_doub + sum(get_2el(id(i), id(i + 1 :), id(i), id(i + 1 :)))
        end do

        ! Exchange contribution only considered if tExch set.
        ! This is only separated from the above loop to keep "if (tExch)" out
        ! of the tight loop for efficiency.
        hel_tmp = h_cast(0._dp)
        if (tExch) then
            do i = 1, nel - 1
                do j = i + 1, nel
                    ! Exchange contribution is zero if I,J are alpha/beta
                    if ((G1(nI(i))%Ms == G1(nI(j))%Ms) .or. tReltvy) then
                        hel_tmp = hel_tmp - get_umat_el(id(i), id(j), id(j), id(i))
                    end if
                end do
            end do
        end if
        hel = hel_doub + hel_tmp + hel_sing
    end function sltcnd_0_base