sltcnd_2_tc Function

private function sltcnd_2_tc(nI, exc, tSign, assert_occupation) result(hel)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
type(Excite_2_t), intent(in) :: exc
logical, intent(in) :: tSign
logical, intent(in), optional :: assert_occupation

Return Value real(kind=dp)


Contents

Source Code


Source Code

    function sltcnd_2_tc(nI, exc, tSign, assert_occupation) result(hel)
        integer, intent(in) :: nI(nel)
        type(Excite_2_t), intent(in) :: exc
        logical, intent(in) :: tSign
        logical, intent(in), optional :: assert_occupation
        HElement_t(dp) :: hel
        debug_function_name("sltcnd_2_tc")
        integer :: i
#ifdef DEBUG_
    block
        use constants, only: stderr
        use util_mod, only: stop_all
        logical :: test_occupation

        if (present(assert_occupation)) then
            test_occupation = assert_occupation
        else
            test_occupation = .true.
        end if

        if (test_occupation) then
            if (.not. occupation_allowed(nI, exc)) then
                write(stderr, *) 'src', exc%val(1, :)
                write(stderr, *) 'tgt', exc%val(2, :)
                write(stderr, *) 'nI', nI
                call stop_all(this_routine, "Not allowed by occupation.")
            end if
        end if
    end block
#endif

        ! get the matrix element up to 2-body terms
        hel = sltcnd_2_kernel(exc)

        ! and the 3-body term
        if(t_use_tchint_lib) then
            hel = hel + external_lMat_matel(nI, exc%val)
        else
            associate(src1 => exc%val(1, 1), tgt1 => exc%val(2, 1), &
                src2 => exc%val(1, 2), tgt2 => exc%val(2, 2))
                do i = 1, nel
                    if (src1 /= nI(i) .and. src2 /= nI(i)) then
                    hel = hel + get_lmat_el( &
                        src1, src2, nI(i), tgt1, tgt2, nI(i))
                    end if
                end do
            end associate
        end if
        ! take fermi sign into account
        if (tSign) hel = -hel

    end function sltcnd_2_tc