function relative_trial_numerator(tt_numerator, tt_denom, replica_pairs) &
result(rel_tot_trial_numerator)
implicit none
HElement_t(dp), intent(in) :: tt_numerator(inum_runs), tt_denom(inum_runs)
logical, intent(in) :: replica_pairs
HElement_t(dp) :: rel_tot_trial_numerator(inum_runs)
integer :: run
if (.not. qmc_trial_wf) then
! Becuase tot_trial_numerator/tot_trial_denom is the energy
! relative to the the trial energy, add on this contribution to
! make it relative to the HF energy.
if (ntrial_excits == 1) then
rel_tot_trial_numerator = tt_numerator + (tt_denom * trial_energies(1))
else
if (replica_pairs) then
do run = 2, inum_runs, 2
rel_tot_trial_numerator(run - 1:run) = tt_numerator(run - 1:run) + &
tt_denom(run - 1:run) * trial_energies(run / 2)
end do
else
rel_tot_trial_numerator = tt_numerator + (tt_denom * trial_energies)
end if
end if
else
rel_tot_trial_numerator = tt_numerator
end if
end function relative_trial_numerator