anchor.diff:                          ! Extract the real sign from the encoded sign.
                           real_population(ispace) = real(qs%psip_list%pops(ispace,idet),p)/qs%psip_list%pop_real_factor
                           weighted_population(ispace) = importance_sampling_weight(qs%trial, cdet, real_population(ispace))
  -                        nattempts_current_det(ispace) = decide_nattempts(rng, real_population(ispace))
                       end do
   
                       ! If we use a weighted excitation generator where weights can be pre-calculated, need additional decoder:
  +                    ! Note that we estimate the number of attempts by the sum of populations in all spaces. This is not to
  +                    ! alter Markov chains and call the function decide_nattempts early and pre-calculate.
                       if (qs%excit_gen_data%weight_decoder) then
  -                        call decoder_excit_gen_ptr(sys, cdet, qs%excit_gen_data, nattempts=sum(nattempts_current_det))
  +                        call decoder_excit_gen_ptr(sys, cdet, qs%excit_gen_data, &
  +                            nattempts=int(sum(real_population(1:qs%psip_list%nspaces))))
                       end if
   
                       ! If this is a deterministic state then copy its population
  
positive.code:         real(dp), allocatable :: nparticles_old(:)
  
          integer(int_p) :: ndeath
          integer :: nspawn_events
          integer, allocatable :: nattempts_current_det(:)
          type(excit_t) :: connection
          type(hmatel_t) :: hmatel
          real(p), allocatable :: real_population(:), weighted_population(:)
  
negative.code: 
          call dealloc_det_info_t(cdet, .false.)
          
          call dSFMT_end(rng)
  
      end subroutine do_fciqmc
  