subroutine check_update_growth(iter_data, message)
use real_time_data, only: TotPartsStorage
implicit none
character(len=*), intent(in) :: message
type(fcimc_iter_data), intent(in) :: iter_data
real(dp) :: growth(lenof_sign), growth_tot(lenof_sign)
real(dp) :: allWalkers(lenof_sign), allWalkersOld(lenof_sign)
real(dp) :: allDied(lenof_sign), allBorn(lenof_sign), allAnnihil(lenof_sign), &
allAbrt(lenof_sign), allRmv(lenof_sign)
growth = iter_data%nborn &
- iter_data%ndied - iter_data%nannihil &
- iter_data%naborted - iter_data%nremoved
call MPISumAll(growth, growth_tot)
call MPISumAll(TotParts, allWalkers)
call MPIsumAll(TotPartsStorage, allWalkersOld)
call MPISumAll(iter_data%nborn, allBorn)
call MPISumAll(iter_data%ndied, allDied)
call MPISumAll(iter_data%nannihil, allAnnihil)
call MPISumAll(iter_data%naborted, allAbrt)
call MPISumAll(iter_data%nremoved, allRmv)
TotPartsStorage = TotParts
if ((iProcIndex == root) .and. .not. tSpinProject .and. &
any(abs(growth_tot - (allWalkers - allWalkersOld)) > 1.0e-4_dp)) then
write(stdout, *) message
write(stdout, *) "update_growth: ", growth_tot
write(stdout, *) "AllTotParts: ", allWalkers
write(stdout, *) "AllTotPartsOld: ", allWalkersOld
write(stdout, *) "nborn", allBorn
write(stdout, *) "ndied", allDied
write(stdout, *) "nannihil", allAnnihil
write(stdout, *) "naborted", allAbrt
write(stdout, *) "nremoved", allRmv
call stop_all("check_update_growth", &
"Assertation failed: all(iter_data_fciqmc%update_growth_tot.eq.AllTotParts_1-AllTotPartsOld_1)")
end if
end subroutine check_update_growth