anchor.diff:                                                           cdet2, qs%psip_list%pops(ireplica,idet), gen_excit_ptr, &
                                                            weighted_sampling%probs, nspawned, connection)
                                           if (nspawned /= 0_int_p) then
  -                                            call create_spawned_particle_dm_ptr(sys%basis, qs%ref, cdet2%f, cdet1%f, connection, &
  -                                                                                nspawned, spawning_end, ireplica, &
  +                                            call create_spawned_particle_dm_ptr(sys_copy%basis, qs%ref, cdet2%f, cdet1%f, &
  +                                                                                connection, nspawned, spawning_end, ireplica, &
                                                                                   qs%spawn_store%spawn)
   
                                               if (abs(nspawned) >= bloom_stats%nparticles_encoded) &
  
positive.code:                     ! and alter the number of psips on each excitation level
                      ! accordingly.
                      if (dmqmc_in%vary_weights .and. iteration <= dmqmc_in%finish_varying_weights) &
                          call update_sampling_weights(rng, sys%basis, qmc_in, qs%psip_list, weighted_sampling)
  
                  end do
  
                  ! Sum all quantities being considered across all MPI processes.
                  call dmqmc_estimate_comms(dmqmc_in, nspawn_events, sys%max_number_excitations, qmc_in%ncycles, qs%psip_list, qs, &
                                            weighted_sampling%probs_old, dmqmc_estimates)
  
                  call update_shift_dmqmc(qmc_in, qs, qs%psip_list%tot_nparticles, tot_nparticles_old)
  
                  ! Forcibly disable update_tau as need to average over multiple loops over beta
                  ! and hence want to use the same timestep throughout.
                  update_tau = .false.
                  call end_report_loop(sys, qmc_in, iteration, update_tau, qs, tot_nparticles_old, &
                                       nspawn_events, unused_int_1, unused_int_2, soft_exit, &
                                       load_bal_in, .false., bloom_stats=bloom_stats)
  
  
negative.code:                         end do
                      end do
  
                      ! Perform the annihilation step where the spawned walker
                      ! list is merged with the main walker list, and walkers of
                      ! opposite sign on the same sites are annihilated.
                      call direct_annihilation(sys_copy, rng, qmc_in, qs%ref, annihilation_flags, qs%psip_list, &
                                               qs%spawn_store%spawn, nspawn_events)
  
                      call end_mc_cycle(nspawn_events, ndeath, nattempts, qs%spawn_store%rspawn)
  