test_increase_on_loc Function

private function test_increase_on_loc(loc_elec, loc_orb, ic) result(flag)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: loc_elec
integer, intent(in) :: loc_orb
integer, intent(in) :: ic

Return Value logical


Contents

Source Code


Source Code

    function test_increase_on_loc(loc_elec, loc_orb, ic) result(flag)
        ! test if the excitation increases the excit-lvl based on the
        ! restriction and type of excitation
        integer, intent(in) :: loc_elec, loc_orb, ic
        logical :: flag

        if (ic == 1) then
            ! now the global restriction of n_guga_back_spawn_lvl comes into
            ! play
            select case (n_guga_back_spawn_lvl)
            case (-2)
                ! we want to treat double excitation decreasing the
                ! excit-lvl by 2 fully ..
                ! so single excitations from non-initiators (make this
                ! default!) are always subjected to the approximation
                flag = .true.

            case (-1)
                ! if this excitation decreases the excit-lvl by 1 we
                ! treat it fully
                ! for this to happen the electron must be in the
                ! virtual space of the reference and the orbital must be
                ! in the occupied space of the reference
                if (loc_elec == 0 .and. loc_orb == 0) then
                    flag = .false.
                else
                    flag = .true.
                end if
            case (0)
                ! here we want to only restrict excitation increasing the
                ! excitation lvl with the approximation
                ! this happens if the electron is in the occupied space of
                ! the reference and the orbital in the virtual space
                if (loc_elec == 2 .and. loc_orb == 2) then
                    flag = .true.
                else
                    flag = .false.
                end if
            case (1)
                ! in this case we treat all single excitation fully
                flag = .false.

            end select
        else if (ic == 2) then
            ! maybe i need specific restriction for different types of
            ! GUGA excitations.. figure that out!

            select case (n_guga_back_spawn_lvl)
            case (-2)
                ! only doubles reducing ex-lvl by two get treated fully
                if (loc_elec == 0 .and. loc_orb == 0) then
                    flag = .false.
                else
                    ! everything else gets treated fully
                    flag = .true.
                end if

            case (-1)
                ! also doubles which increase the excit-lvl by 1
                ! get treated fully ..
                ! how does this happen?
                ! at least one electron must hope from the reference
                ! virtuals to the occupied reference space..
                if (loc_elec == 0) then
                    ! both electrons are in the virtual, so atleast
                    ! one orbital must be in the reference
                    if (loc_orb < 2) then
                        flag = .false.
                    else
                        flag = .true.
                    end if
                else if (loc_elec == 1) then
                    ! one electron in occupied and one in virtual
                    ! then both holes must be in the occupied to decrease
                    if (loc_orb == 0) then
                        flag = .false.
                    else
                        flag = .true.
                    end if
                else
                    ! if both electrons are in the occupied space
                    ! it is not possible
                    flag = .true.
                end if

            case (0)
                ! here we also treat excitation leaving the excit-lvl
                ! the same fully..
                if (loc_elec == 0) then
                    ! if both electron are in the virtual space we can not
                    ! increase the excit-lvl
                    flag = .false.

                else if (loc_elec == 1) then
                    ! if one of the electrons is in the occupied space
                    ! atleast one orbital must also be in the virtual space
                    if (loc_orb == 2) then
                        flag = .true.
                    else
                        flag = .false.
                    end if

                else if (loc_elec == 2) then
                    ! if both electrons are in occupied space
                    ! both orbital must also be in the occupied space
                    if (loc_orb == 0) then
                        flag = .false.
                    else
                        flag = .true.
                    end if
                end if

            case (1)
                ! here we also want to treat excitation increasing the
                ! excitation lvl by up to 1 fully

                ! if both electrons are in the virtual space
                ! we do not increase the excit-lvl
                flag = .false.

                ! if only one electron is in the occupied space
                ! we at most increase it by 1, which is fine here
                flag = .false.

                ! if both electrons are in the virtual space
                ! we increase by more than 1 only if both orbs are in
                ! the virtual space

                if (loc_elec == 2 .and. loc_orb == 2) then
                    flag = .true.
                else
                    flag = .false.
                end if
            end select
        end if

    end function test_increase_on_loc