find_elec_in_ni Function

public function find_elec_in_ni(nI, orb) result(elec)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
integer, intent(in) :: orb

Return Value integer


Contents

Source Code


Source Code

    function find_elec_in_ni(nI, orb) result(elec)
        ! routine to find the number of the elctron in spin-orbital orb
        integer, intent(in) :: nI(nel), orb
        integer :: elec
#ifdef DEBUG_
        character(*), parameter :: this_routine = "find_elec_in_ni"
#endif

        ASSERT(orb > 0)
        ASSERT(orb <= nbasis)

        ! can i just reuse
        elec = binary_search_first_ge(nI, orb)

        ! it already make the fail case.. or?
        ! and then make a fail-case:
        if (elec == -1) return

        if (nI(elec) /= orb) then
            ! it is actually not found?
            elec = -1
        end if

    end function find_elec_in_ni