get_cumulative_list_Excite_2_t Function

private function get_cumulative_list_Excite_2_t(det_I, incomplete_exc, possible_holes) result(cSum)

@brief Build up a cumulative list of matrix elements.

@details Calculate the matrix elements for the possible excitations from det_I to the possible holes using the incomplete defined excitation.

@param[in] det_I, Reference determinant in “nI-format”. @param[in] incomplete_exc, An excitation where the last target is unknown. @param[in] possible_holes, Possible holes for the last target.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: det_I(:)
type(Excite_2_t), intent(in) :: incomplete_exc
integer, intent(in) :: possible_holes(:)

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


Contents


Source Code

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

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

#ifdef DEBUG_
    block
        use util_mod, only: stop_all
        use constants, only: stderr
        if (.not. (get_last_tgt(exc) == UNKNOWN)) then
            write(stderr, *) ""
            write(stderr, *) "Assertion get_last_tgt(exc) == UNKNOWN"
            write(stderr, *) "failed in /scratch/jenkins/jobs/existing_branch_doc/workspace/build_config/gfortran-doc/src/gasci_uti&
                &l.fpp:224"
            call stop_all (this_routine, "Assert fail: get_last_tgt(exc) == UNKNOWN")
        end if
    end block
#endif
        exc = incomplete_exc

        ! build the cumulative list of matrix elements <src|H|tgt>
        previous = 0.0_dp
        do i = 1, size(possible_holes)
            call set_last_tgt(exc, possible_holes(i))
            cSum(i) = abs(sltcnd_excit(det_I, canonicalize(exc), .false.)) + previous
            previous = cSum(i)
        end do

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