check_electron_location Function

public function check_electron_location(src, ic, part_type) result(loc)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: src(2)
integer, intent(in) :: ic
integer, intent(in) :: part_type

Return Value integer


Contents


Source Code

    function check_electron_location(src, ic, part_type) result(loc)
        ! routine which determines where the electrons of of an determinant
        ! are located with respect to the reference determinant to
        ! then decide where to pick the orbitals from..
        integer, intent(in) :: src(2), ic
        integer, intent(in) :: part_type
        integer :: loc
        character(*), parameter :: this_routine = "check_electron_location"

        integer :: i
        ! the output integer encodes:
        ! 0 ... both electrons are in the virtual space of the reference
        ! 1 ... the electrons are mixed in occupied and virtual manifold
        ! 2 ... electron(s) are/is in the refernce determinant

        if (ic == 1) then
            ! single exctitation
            ! for complex code part_type_to_run does not actually do
            ! what i need it to do..
            ! the run input here goes from 1 to lenof_sign..
            ! in a single non-complex run:
            ! lenof_sign = 1
            ! inum_runs = 1
            ! so there everything is fine i actually have to change the
            ! unit-tests
            if (is_in_ref(src(1), part_type)) then
                ! this means the electron is in the reference determinant
                ! which means we should pick a hole also in the
                ! reference determinant, or otherwise we definetly
                ! increase the excitation level
                loc = 2
            else
                ! only option 0 and 2 for single excitations!
                loc = 0
            end if

        else if (ic == 2) then
            ! for double excitations we have to check both
            loc = 0
            do i = 1, 2
                if (is_in_ref(src(i), part_type)) then
                    loc = loc + 1
                end if
            end do
        end if

        ASSERT(loc >= 0)
        ASSERT(loc <= 2)

    end function check_electron_location