pick_spin_opp_elecs Subroutine

public subroutine pick_spin_opp_elecs(nI, elecs, p_elec)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nI(nel)
integer, intent(out) :: elecs(2)
real(kind=dp), intent(out) :: p_elec

Contents

Source Code


Source Code

    subroutine pick_spin_opp_elecs(nI, elecs, p_elec)
        integer, intent(in) :: nI(nel)
        integer, intent(out) :: elecs(2)
        real(dp), intent(out) :: p_elec
        ! think of a routine to get the possible spin-opposite electron
        ! pairs. i think i could do that way more efficiently, but do it in
        ! the simple loop way for now
        do
            elecs(1) = 1 + int(genrand_real2_dsfmt() * nel)
            do
                elecs(2) = 1 + int(genrand_real2_dsfmt() * nel)

                if (elecs(1) /= elecs(2)) exit

            end do
            if (get_ispn(nI(elecs)) == 2) exit
        end do

        ! output in ordered form
        elecs = [minval(elecs), maxval(elecs)]

        ! actually the probability is twice that or?
        ! or doesnt that matter, since it is the same
        p_elec = 1.0_dp / real(nOccBeta * nOccAlpha, dp)

    end subroutine pick_spin_opp_elecs