findLastSwitch Function

public pure function findLastSwitch(ilutI, ilutJ, semi, ende) result(orb)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(in) :: ilutI(0:GugaBits%len_tot)
integer(kind=n_int), intent(in) :: ilutJ(0:GugaBits%len_tot)
integer, intent(in) :: semi
integer, intent(in) :: ende

Return Value integer


Contents

Source Code


Source Code

    pure function findLastSwitch(ilutI, ilutJ, semi, ende) result(orb)
        ! function to find last switch in a mixed fullstop excitation
        integer(n_int), intent(in) :: ilutI(0:GugaBits%len_tot), ilutJ(0:GugaBits%len_tot)
        integer, intent(in) :: ende, semi
        integer :: orb

        integer :: a, b, iOrb


        ! set it to impossible value, so contribution does not get
        ! calculated if no switch happened, (which shouldnt be reached anyway)

        ! in this routine i always want to include the inputted end index
        ! but only the +1 spatial orbital above semi!
        if (semi >= ende) then
            orb = nSpatOrbs + 2
            return
        end if

        ! also implement this with the new fortran 2008 routines!
        ! make the spin_change bit-rep

        orb = nSpatOrbs + 2

        do iOrb = ende, semi + 1, -1
            a = getStepvalue(ilutI, iOrb)
            b = getStepvalue(ilutJ, iOrb)
            if (a /= b) then
                orb = iOrb
                return
            end if
        end do

    end function findLastSwitch