pick_uniform_elecs Subroutine

public subroutine pick_uniform_elecs(elecs, pelec)

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: elecs(2)
real(kind=dp), intent(out) :: pelec

Contents

Source Code


Source Code

    subroutine pick_uniform_elecs(elecs, pelec)
        integer, intent(out) :: elecs(2)
        real(dp), intent(out) :: pelec

        integer :: ind, eleci, elecj

        ind = 1 + int(ElecPairs * genrand_real2_dSFMT())
        elecs(1) = ceiling((1 + sqrt(1 + 8 * real(ind, dp))) / 2)
        elecs(2) = ind - ((elecs(1) - 1) * (elecs(1) - 2)) / 2
        pelec = 1.0_dp / real(ElecPairs, dp)

    end subroutine pick_uniform_elecs