subroutine backup_initial_state()
character(*), parameter :: this_routine = "backup_initial_state"
! popsfile_dets is certainly large enough to house CurrentDets, so use it if available
if (.not. allocated(popsfile_dets)) allocate(popsfile_dets(0:niftot, TotWalkers))
popsfile_dets(:, 1:TotWalkers) = CurrentDets(:, 1:TotWalkers)
! number of initial walkers
backup_size = int(TotWalkers)
end subroutine backup_initial_state