subroutine getEScale(nJ, i, diagH, offdiagH, scFVal, ScaledOccupiedThresh)
integer, intent(in) :: nJ(nel), i
real(dp), intent(out) :: diagH, scFVal, ScaledOccupiedThresh
HElement_t(dp), intent(out) :: offdiagH
if (tEScaleWalkers) then
! the diagonal element of H is needed anyway ONLY for scaled walkers
! if we dont scale walkers, we might not need it, if the round kills the
! walkers
diagH = get_diagonal_matel(nJ, SpawnedParts(:, i))
offdiagH = get_off_diagonal_matel(nJ, SpawnedParts(:, i))
! evaluate the scaling function
scFVal = scaleFunction(diagH - Hii)
else
scFVal = 1.0_dp
end if
ScaledOccupiedThresh = scFVal * OccupiedThresh
end subroutine getEScale