class_allowed Function

public pure function class_allowed(ras, n_elec_1, n_elec_3) result(allowed)

Arguments

Type IntentOptional Attributes Name
type(ras_parameters), intent(in) :: ras
integer, intent(in) :: n_elec_1
integer, intent(in) :: n_elec_3

Return Value logical


Contents

Source Code


Source Code

    pure function class_allowed(ras, n_elec_1, n_elec_3) result(allowed)

        ! This function assumes that the total number of electrons is equal to tot_nelec, so
        ! that we don't have to check the number of electrons in RAS2. It also assumes
        ! obvious things like the numbers of electrons not being negative.

        type(ras_parameters), intent(in) :: ras
        integer, intent(in) :: n_elec_1, n_elec_3
        integer :: lower_ras3, upper_ras3
        logical :: allowed

        allowed = .false.

        if (n_elec_1 >= ras%lower_ras1 .and. n_elec_1 <= ras%upper_ras1) then
            lower_ras3 = max(0, tot_nelec - n_elec_1 - ras%size_2)
            upper_ras3 = min(tot_nelec - n_elec_1, ras%max_3)
            if (n_elec_3 >= lower_ras3 .and. n_elec_3 <= upper_ras3) then
                allowed = .true.
            end if
        end if

    end function class_allowed