subroutine readTimeEvolvedState()
use PopsfileMod, only: FindPopsfileVersion, ReadPopsHeadv4, InitFCIMC_pops, &
open_pops_head
use semi_stoch_gen, only: init_semi_stochastic
use semi_stoch_procs, only: end_semistoch
use real_time_procs, only: reset_core_space
use CalcData, only: ss_space_in
use FciMCData, only: TotImagTime
implicit none
integer :: iunit, popsversion, iPopLenof_Sign, iPopNel, iPopIter, &
PopNIfD, PopNIfSgn, PopNIfFlag, PopNIfTot, &
PopBlockingIter, Popinum_runs, PopRandomHash(2056), &
read_nnodes, PopBalanceBlocks
logical :: formpops, binpops, tPop64Bit, tPopHPHF, tPopLz
integer(int64) :: iPopAllTotWalkers, read_walkers_on_nodes(0:nProcessors - 1)
real(dp) :: PopDiagSft(inum_runs), read_tau, PopSumNoatHF(lenof_sign), &
read_psingles, read_pparallel
HElement_t(dp) :: PopAllSumENum(inum_runs)
integer :: ierr
logical :: tStartedFromCoreGround
character(255) :: rtPOPSFILE_name
character(*), parameter :: this_routine = "readTimeEvolvedState"
real(dp) :: unused_triples
if (tSemiStochastic) then
! if semi-stochastic mode is enabled, it has to be disabled for read-in again
! as load balancing has to be performed
call end_semistoch()
call reset_core_space()
end if
binpops = .false.
rtPOPSFILE_name = 'TIME_EVOLVED_POP'
! get the file containing the time evolved state
call open_pops_head(iunit, formpops, binpops, rtPOPSFILE_name)
popsversion = FindPopsfileVersion(iunit)
if (popsversion /= 4) call stop_all(this_routine, "wrong popsfile version of TIME_EVOLVED_POP")
call ReadPopsHeadv4(iunit, tPop64Bit, tPopHPHF, tPopLz, iPopLenof_Sign, iPopNel, &
iPopAllTotWalkers, PopDiagSft, PopSumNoatHF, PopAllSumENum, iPopIter, &
PopNIfD, PopNIfSgn, Popinum_runs, PopNIfFlag, PopNIfTot, &
read_tau, PopBlockingIter, PopRandomHash, read_psingles, &
read_pparallel, unused_triples, read_nnodes, read_walkers_on_nodes, PopBalanceBlocks)
! at this point, we do not want to perturb the state and have no use for the
! pops_pert variable anymore -> deallocate it
! read in the hacked shift_damping
if (.not. allocated(shift_damping)) allocate(shift_damping(inum_runs), stat=ierr)
shift_damping = PopSumNoatHF(1:inum_runs)
call clear_pops_pert(pops_pert)
! read in the time evolved state and use it as initial state
call InitFCIMC_pops(iPopAllTotWalkers, PopNIfSgn, iPopNel, read_nnodes, &
read_walkers_on_nodes, pops_pert, &
PopBalanceBLocks, PopDiagSft, rtPOPSFILE_name)
call set_initial_times(read_tau, TotImagTime, PopDiagSft(1))
! if we disabled semi-stochastic mode temporarily, reenable it now
if (tSemiStochastic) call init_semi_stochastic(ss_space_in, tStartedFromCoreGround)
end subroutine readTimeEvolvedState