get_cumulative_list_Excite_2_t Function

private function get_cumulative_list_Excite_2_t(GAS_list, nI, incomplete_exc) result(cSum)


Type IntentOptional Attributes Name
integer, intent(in) :: GAS_list(:)
integer, intent(in) :: nI(nel)
type(Excite_2_t), intent(in) :: incomplete_exc

Return Value real(kind=dp), (size(GAS_list))


Source Code

    function get_cumulative_list_Excite_2_t (GAS_list, nI, incomplete_exc) result(cSum)
        integer, intent(in) :: GAS_list(:), nI(nel)
        type(Excite_2_t), intent(in) :: incomplete_exc
        real(dp) :: cSum(size(GAS_list))
        character(*), parameter :: this_routine = 'get_cumulative_list_Excite_2_t'

        real(dp) :: previous
        type(Excite_2_t) :: exc
        integer :: i, nOrbs

        nOrbs = size(GAS_list)

        exc = incomplete_exc
        ASSERT(get_last_tgt(exc) == UNKNOWN)

        ! build the cumulative list of matrix elements <src|H|tgt>
        previous = 0.0_dp
        do i = 1, nOrbs
            call set_last_tgt(exc, GAS_list(i))
            cSum(i) = get_mat_element(nI, exc) + previous
            previous = cSum(i)
        end do

        ! Normalize
        if (near_zero(cSum(nOrbs))) then
            cSum(:) = 0.0_dp
            cSum(:) = cSum(:) / cSum(nOrbs)
        end if
    end function get_cumulative_list_Excite_2_t