function initiator_criterium(sign, hdiag, run) result(init_flag)
real(dp), intent(in) :: sign(lenof_sign), hdiag
integer, intent(in) :: run
! variance of sign and either a single value or an aggregate
real(dp) :: sigma, tot_sgn
integer :: crun, nOcc
real(dp) :: scaledInitiatorWalkNo
logical :: init_flag
#ifdef CMPLX_
unused_var(run)
#endif
if (tEScaleWalkers) then
scaledInitiatorWalkNo = InitiatorWalkNo * scaleFunction(hdiag)
else
scaledInitiatorWalkNo = InitiatorWalkNo
end if
! option to use the average population instead of the local one
! for purpose of initiator threshold
if (tGlobalInitFlag) then
! we can use a signed or unsigned sum
if (tSignedRepAv) then
tot_sgn = real(abs(sum(sign)), dp) / inum_runs
else
tot_sgn = av_pop(sign)
end if
else
tot_sgn = mag_of_run(sign, run)
end if
! make it an initiator
init_flag = (tot_sgn > scaledInitiatorWalkNo)
! option to use the average population instead of the local one
! for purpose of initiator threshold
if (tGlobalInitFlag) then
! we can use a signed or unsigned sum
if (tSignedRepAv) then
tot_sgn = real(abs(sum(sign)), dp) / inum_runs
else
tot_sgn = av_pop(sign)
end if
else
tot_sgn = mag_of_run(sign, run)
end if
! make it an initiator
init_flag = (tot_sgn > scaledInitiatorWalkNo)
end function initiator_criterium