subroutine add_in_contribs(nvecs, krylov_array, krylov_ht, tFinished, tAllFinished, fac, est_matrix)
use FciMCData, only: InitialSpawnedSlots, ValidSpawnedList, ll_node
use Parallel_neci, only: MPIAllGather, nProcessors
integer, intent(in) :: nvecs
integer(n_int), intent(in) :: krylov_array(0:, :)
type(ll_node), pointer, intent(in) :: krylov_ht(:)
real(dp), intent(in) :: fac
real(dp), intent(inout) :: est_matrix(:, :)
logical, intent(in) :: tFinished
logical, intent(out) :: tAllFinished
logical :: tFinished_AllProcs(nProcessors)
integer :: nspawns_this_proc, ierr
call distribute_spawns_kp_estimates(nspawns_this_proc)
call calc_contribs_spawn(nvecs, krylov_array, krylov_ht, nspawns_this_proc, fac, est_matrix)
ValidSpawnedList = InitialSpawnedSlots
call MPIAllGather(tFinished, tFinished_AllProcs, ierr)
tAllFinished = all(tFinished_AllProcs)
end subroutine add_in_contribs