subroutine set_trial_populations(nexcit, ndets_this_proc, trial_vecs)
use CalcData, only: InitialPart, InitWalkers, tStartSinglePart
use Parallel_neci, only: MPISumAll
integer, intent(in) :: nexcit, ndets_this_proc
HElement_t(dp), intent(inout) :: trial_vecs(:, :)
real(dp) :: eigenvec_pop, tot_eigenvec_pop
integer :: i, j
! We need to normalise all of the vectors to have the correct number of
! walkers.
do j = 1, nexcit
eigenvec_pop = 0.0_dp
do i = 1, ndets_this_proc
eigenvec_pop = eigenvec_pop + abs(trial_vecs(j, i))
end do
call MPISumAll(eigenvec_pop, tot_eigenvec_pop)
if (tStartSinglePart) then
trial_vecs(j, :) = trial_vecs(j, :) * InitialPart / tot_eigenvec_pop
else
trial_vecs(j, :) = trial_vecs(j, :) * InitWalkers / tot_eigenvec_pop
end if
end do
end subroutine set_trial_populations