linearShiftFactorFunction Function

public pure function linearShiftFactorFunction(pos, run, pop) result(f)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: pos
integer, intent(in) :: run
real(kind=dp), intent(in) :: pop

Return Value real(kind=dp)


Contents


Source Code

    pure function linearShiftFactorFunction(pos, run, pop) result(f)
        ! Piecewise-linear scale function for the shift
        ! Input: pos - position of given determinant in CurrentDets
        ! Input: run - run for which the factor is needed
        ! Input: pop - population of given determinant
        ! Output: f - scaling factor for the shift
        integer, intent(in) :: pos
        integer, intent(in) :: run
        real(dp), intent(in) :: pop
        real(dp) :: f, slope

        unused_var(pos); unused_var(run)

        if (test_flag(CurrentDets(:, pos), get_initiator_flag_by_run(run))) then
            f = 1.0
        else if (pop < LAS_Sigma) then
            f = 0.0
        else
            if (InitiatorWalkNo .isclose. LAS_Sigma) then
                !In this case the slope is ill-defined.
                !Since initiators are strictly large than InitiatorWalkNo, set shift to zero
                f = 0.0
            else
                !Apply linear modifcation that equals F1 at Sigma and F2 at InitatorWalkNo
                slope = (LAS_F2 - LAS_F1) / (InitiatorWalkNo - LAS_Sigma)
                f = (LAS_F1 + (pop - LAS_Sigma) * slope)
            end if
        end if
    end function linearShiftFactorFunction