anchor.diff:          !    cdet: info on the current determinant (cdet) that we will spawn
           !        from.
   
  -        use basis, only: basis_length
           use determinants, only: det_info
           use dSFMT_interface, only:  genrand_real2
  -        use excitations, only: calc_pgen_hub_real, excit, create_excited_det, find_excitation_permutation1
  -        use fciqmc_data, only: tau, spawned_walker_dets, spawned_walker_population, spawning_head
  +        use excitations, only: calc_pgen_hub_real, excit, find_excitation_permutation1
  +        use fciqmc_data, only: tau
           use hamiltonian, only: slater_condon1_hub_real
   
  -        ! for debug only
  +! for debug only.
   !        use hamiltonian, only: get_hmatel_real
  +!        use fciqmc_data, only: spawned_walker_dets, spawned_walker_population, spawning_head
   
           type(det_info), intent(in) :: cdet
           integer, intent(in) :: parent_sign
   
           real(p) :: pgen, psuccess, pspawn, hmatel
           integer :: i, a, nparticles
  -        integer(i0) :: f_new(basis_length)
           type(excit) :: connection
           integer :: nvirt_avail
   
  
positive.code:                 nparticles = sign(nparticles, parent_sign)
              end if
  
              ! 7. Set info in spawning array.
              call create_excited_det(cdet%f, connection, f_new)
              spawned_walker_dets(:,spawning_head) = f_new
              spawned_walker_population(spawning_head) = nparticles
  
  ! Leave the following in for debug reasons...
  ! Should be removed after more testing.
  !            if (abs(get_hmatel_real(cdet%f, f_new)-hmatel) > 1.e-8) then
  !                write (6,*) 'oops!', get_hmatel_real(cdet%f, f_new), hmatel
  !            end if
  
          end if
  
negative.code: 
      end subroutine choose_ia_hub_real
  
      subroutine create_spawned_particle(cdet, connection, nparticles)
  
          ! Create a spawned walker.
  
          ! In:
          !    cdet: info on the current determinant (cdet) that we will spawn
          !        from.
          !    connection: excitation connecting the current determinant to its
          !        offspring.  Note that the perm field is not used.
          !    nparticles: the (signed) number of particles to create on the
          !        spawned determinant.
  
          use basis, only: basis_length
          use determinants, only: det_info
          use excitations, only: excit, create_excited_det
          use fciqmc_data, only: spawned_walker_dets, spawned_walker_population, spawning_head
  
          type(det_info), intent(in) :: cdet
          type(excit), intent(in) :: connection
          integer, intent(in) :: nparticles
  
          integer(i0) :: f_new(basis_length)
  
          ! 1. Move to the next position in the spawning array.
          spawning_head = spawning_head + 1
  
          ! 2. Set info in spawning array.
          call create_excited_det(cdet%f, connection, f_new)
          spawned_walker_dets(:,spawning_head) = f_new
          spawned_walker_population(spawning_head) = nparticles
  
      end subroutine create_spawned_particle
  
  end module spawning
  