CreateRandomExcitLevDetUnbias Subroutine

public subroutine CreateRandomExcitLevDetUnbias(iExcitLevTest, FDet, FDetiLut, iLut, ExcitLev, Attempts)

Arguments

Type IntentOptional Attributes Name
integer :: iExcitLevTest
integer :: FDet(NEl)
integer(kind=n_int) :: FDetiLut(0:NIfTot)
integer(kind=n_int) :: iLut(0:NIfTot)
integer :: ExcitLev
integer :: Attempts

Contents


Source Code

    SUBROUTINE CreateRandomExcitLevDetUnbias(iExcitLevTest, FDet, FDetiLut, iLut, ExcitLev, Attempts)
        use SystemData, only: nEl
        use bit_rep_data, only: NIfTot
        use dSFMT_interface
        INTEGER :: iExcitLevTest, FDet(NEl), ExcitLev, Attempts
        INTEGER(n_int) :: FDetiLut(0:NIfTot), iLut(0:NIfTot)
        real(dp) :: pAcc, r

        do while (.true.)

            call CreateRandomExcitLevDet(iExcitLevTest, FDet, FDetiLut, iLut, ExcitLev, Attempts)

            IF (ExcitLev == iExcitLevTest) then
                RETURN   !Prob of accepting = 1
            else
                pAcc = 1.0_dp / (choose_i64(NEl - ExcitLev, iExcitLevTest - ExcitLev))
                r = genrand_real2_dSFMT()
                if (r <= pAcc) exit
            end if

        end do

    END SUBROUTINE CreateRandomExcitLevDetUnbias