anchor.diff:          real(p), intent(in) :: pgen, qn_weighting, parent_sign
           integer(int_p), intent(in) :: nspawned(:)
           logical, intent(in) ::  cmplx_wfn
  +        integer :: iunit
  +
  +        iunit = logging_info%spawn_unit
   
           if (logging_info%write_logging) then
               if ((logging_info%write_successful_spawn .and. any(abs(nspawned) > 0)) .or. &
                    (logging_info%write_failed_spawn .and. all(nspawned == 0))) then
   
  -                write (logging_info%spawn_unit,'(1X)', advance='no')
  +                write (iunit,'(1X)', advance='no')
   
                   if (cmplx_wfn) then
  -                    call write_qmc_var(logging_info%spawn_unit, real(hmatel%c), sep=',')
  -                    call write_qmc_var(logging_info%spawn_unit, aimag(hmatel%c), sep=',')
  +                    call write_qmc_var(iunit, real(hmatel%c), sep=',')
  +                    call write_qmc_var(iunit, aimag(hmatel%c), sep=',')
                   else
  -                    call write_qmc_var(logging_info%spawn_unit, hmatel%r, sep=',')
  +                    call write_qmc_var(iunit, hmatel%r, sep=',')
                   end if
   
  -                call write_qmc_var(logging_info%spawn_unit, pgen, sep=',')
  -                call write_qmc_var(logging_info%spawn_unit, qn_weighting, sep=',')
  -                call write_qmc_var(logging_info%spawn_unit, parent_sign, sep=',')
  -                call write_qmc_var(logging_info%spawn_unit, nspawned(1), sep=',')
  -
  -                if (cmplx_wfn) call write_qmc_var(logging_info%spawn_unit, nspawned(2), sep=',')
  -
  -                write (logging_info%spawn_unit,'()')
  +                call write_qmc_var(iunit, pgen, sep=',')
  +                call write_qmc_var(iunit, qn_weighting, sep=',')
  +                call write_qmc_var(iunit, parent_sign, sep=',')
  +                call write_qmc_var(iunit, nspawned(1), sep=',')
  +
  +                if (cmplx_wfn) call write_qmc_var(iunit, nspawned(2), sep=',')
  +
  +                write (iunit,'()')
               end if
           end if
   
  
positive.code:         use calc, only: calc_type, fciqmc_calc, ccmc_calc
  
          type(logging_t), intent(in) :: logging_info
  
          write (logging_info%spawn_unit, '(1X,"HANDE QMC Spawning Log File")')
          write (logging_info%spawn_unit,'()')
  
          call environment_report(logging_info%spawn_unit)
  
          select case (calc_type)
          case(fciqmc_calc)
              write (logging_info%spawn_unit, '(1X,"Calculation type: FCIQMC")')
          case(ccmc_calc)
              write (logging_info%spawn_unit, '(1X,"Calculation type: CCMC")')
          end select
  
          write (logging_info%spawn_unit, '(1X,"Verbosity Settings:")')
          write (logging_info%spawn_unit, '(1X,10X,"Write Successful Spawns:",2X,L1)') &
                          logging_info%write_successful_spawn
          write (logging_info%spawn_unit, '(1X,10X,"Write Failed Spawns:",2X,L1)') &
                          logging_info%write_failed_spawn
  
          write (logging_info%spawn_unit,'()')
  
      end subroutine write_logging_spawn_preamble
  
  
negative.code:         integer, intent(in) :: nspawn_events
          integer(int_p), intent(in) :: ndeath_tot
          integer(int_64), intent(in) :: nD0_select, nclusters, nstochastic_clusters, nsingle_excitors
          integer :: iunit
  
          iunit = logging_info%calc_unit
  
          if (logging_info%write_logging .and. logging_info%write_highlevel_values) then
              write (iunit, '(1X)', advance='no')
              call write_qmc_var(iunit, iter, sep=',')
              call write_qmc_var(iunit, nspawn_events, sep=',')
              call write_qmc_var(iunit, ndeath_tot, sep=',')
              call write_qmc_var(iunit, nclusters, sep=',')
              call write_qmc_var(iunit, nD0_select, sep=',')
              call write_qmc_var(iunit, nstochastic_clusters, sep=',')
              call write_qmc_var(iunit, nsingle_excitors, sep=',')
              write (iunit, '()')
          end if
  
      end subroutine write_logging_calc_ccmc
  