anchor.diff:          real(p)          :: choose_double_elt_type
           
           ! P_gen (k|i) and P_gen (j|k)
  -        real(p)          :: P_genki, P_genjk 
  +        real(p)          :: Pgen_ki, Pgen_jk 
           real(p)          :: hmatel_ki, hmatel_jk
           real(p)          :: pspawn
           real(p)          :: connection_ki, connection_jk
  -        real(p)       :: psuccess, pspawn, pgen, hmatel
  +        real(p)          :: psuccess, pspawn, pgen, hmatel
  +        type(det_info)   :: cdet_excit
   
           ! we need pointers to:
  -        !      -function that generates an exited determinant for the given system
  -        !      -function that generates pgen for a given excitation (possibly the same as above
  +        !      -function that generates an exited determinant, pgen and hmatel for the given system
  +        !         (system_gen_excit_ptr)
           !      -random number generator function
  +        !         (rng_ptr)
  +        !      -function that generates a diagonal matrix element
  +        !         (system_sc0_ptr)
           !      -
  -
  -        
  -        
  -        ! 1. Choose the type of double element you're going to spawn 
  -        ! **Do we want a pointer to the random number generating function to determine the type of double element we want to use?**
  +        !      -
  +        ! specific to imperial code:
  +        !      -function that creates an excited determinant (create_excited_det)
  +        !      -types excit, cdet
  +        !      -
  +
  +        
  +        
  +        ! 0. Choose the type of double element you're going to spawn 
           choose_double_elt_type = rng_ptr()
           
           ! **We want to choose the largest probability first, since this will reduce the number of if statement calls, 
           ! **however, the values of P__ etc will ideally be reference-determinant dependent, what is the best way to order this sequence?**
  -        if(choose_double_elt_type <= P__ ) then
  -            
  -
  -
  -            
  -            
  -
  -        else if (choose_double_elt_type <= P__+P_o ) then
  -            
  -            !          _
  -            !         / \
  -            !    .____\./
  -            
  -
  -            ! 1f. Generate first random excitation and probability of spawning there from cdet 
  -            call system_excit_ptr(cdet, P_genki, connection_ki)
  -
  -            ! 2f. Generate the first matrix element.
  -            call system_matrix_elt_ptr(cdet%f, connection, hmatel_ki)
  -
  -            ! 1s. Generate the second random excitation 
  -            !(in this case we stay on the same place)
  -            P_genjk = 1
  -
  -            ! 2s. Generate the second matrix element.
  -            hmatel_jk = !*****stored diagonal matrix element*****
  -            
  -            ! 3. Probability of gening...
  -            pgen = P__ * P_genki * P_genjk
  +
  +
  +
  +elttype:if(choose_double_elt_type <= P__ ) then
  +            
  +            !      __   __ 
  +            !    ./  \./  \.
  +            !    i    k    j
  +            !
  +            !    i __
  +            !    ./  \.
  +            !     \__/ k
  +            !    j   
  +
  +            ! 1.1 Generate first random excitation and probability of spawning there from cdet 
  +            call system_gen_excit_ptr(cdet, Pgen_ki, connection_ki, hmatel_ki)
  +
  +            ! 1.2 Generate the second random excitation 
  +            ! (i)  generate the first excited determinant  
  +            call create_excited_det(cdet, connection_ki, cdet_excit)
  +            ! (ii) excite again
  +            call system_gen_excit_ptr(cdet_excit, Pgen_jk, connection_jk, hmatel_jk)
  +
  +
  +
  +            ! 2. Probability of gening...
  +            pgen = P__ * Pgen_ki * Pgen_jk
               pspawn = tau*abs(hmatel_ki*hmatel_jk)/pgen
               
  -            ! 4. Attempt spawning.
  +            ! 3. Attempt spawning.
               psuccess = rng_ptr()
   
               ! Need to take into account the possibilty of a spawning attempt
  
positive.code: 
              if (nspawn > 0) then
  
                  ! 5. If H_ij is positive, then the spawned walker is of opposite
                  ! sign to the parent, otherwise the spawned walkers if of the same
                  ! sign as the parent.
                  if (hmatel_ki*hmatel_jk > 0.0_p) then
  
negative.code: !TO DO:
  ! tau finder
  ! death step
  ! calculating P__, P_o, Po_
  
  use const
  
  use proc_pointers
  
  use excitations, only: create_excited_det
  
  implicit none
  
  ! 1) self spawning
  !      ___
  !     / _ \
  !    | / \ |
  !     \\.//
  
  ! 2) granddaughter spawning
  !      __   __ 
  !    ./  \./  \.
  !
  ! 3) self spawning
  !      __
  !    ./  \.
  !     \__/
  !
  ! 4) daughter spawning
  !     _
  !    / \
  !    \./____.
  !
  ! 5) daughter spawning
  !          _
  !         / \
  !    .____\./
  