update_real_time_iteration Subroutine

public subroutine update_real_time_iteration(t_comm)

Arguments

Type IntentOptional Attributes Name
logical :: t_comm

Contents


Source Code

    subroutine update_real_time_iteration(t_comm)
        ! routine to update certain global variables each loop iteration in
        ! the real-time fciqmc
        ! from the 2 distince spawn/death/cloning info stored in the
        ! two iter_data vars, i have to combine the general updated
        ! statistics for the actual time step
        implicit none
        logical :: t_comm
        character(*), parameter :: this_routine = "update_real_time_iteration"
        integer :: run

        ! how to combine those 2?
        ! in iter_data_fciqmc the info on the born, died, aborted, removed and
        ! annihilated particles of the first spawn and y(n) + k1/2 step is stored

        ! in the second_spawn_iter_data, the number of born particles in the
        ! spawing step is stored first..
        ! note: in the create_particle routine the global variable
        ! acceptances gets updated, and i essentially update that
        ! quantity twice when calling it in the first and second spawn
        ! loop -> i think i have to store 2 of those variables and
        ! update and reset both of them seperately to keep track of the
        ! statistics correctly
        ! and the NoBorn, NoDied and similar variables also get used in the
        ! statistics about the simulation.. maybe i need to adjust them too
        ! so take the 2 RK loops into account
        ! do i want to use the new_shift_wrapper here? ..
        ! no i think i just want to combine the important infos from both the
        ! iter_datas so to get the correct and valid info for the full
        ! time-step ... hm..

        ! do a correct combination of the essential parts of the new_shift_wrapper
        ! in the end i could just use the calc_new_shift_wrapper..

        ! still have to do more combination of necessary data..

        ! combine log_real_time into this routine too!
        ! get the norm of the state

        if (tReadTrajectory) call get_current_alpha_from_cache

        call calculate_new_shift_wrapper(second_spawn_iter_data, totParts, &
                                         tPairedReplicas, t_comm_req=t_comm)
        if (tCoupleCycleOutput) call iteration_output_wrapper(iter_data_fciqmc, TotParts, &
                                                              tPairedReplicas, t_comm_req=.false.)

        if (tStabilizerShift) then
            if (iProcIndex == Root) then
                ! check if the walker number started to decay uncontrolled
                call update_peak_walker_number()
                do run = 1, inum_runs
                    if ((AllTotParts(min_part_type(run)) + AllTotParts(max_part_type(run))) &
                        < stabilizerThresh * TotPartsPeak(run) .and. tSinglePartPhase(run)) then
                        ! if it is, enable dynamic shift to enforce a sufficiently high walker number
                        tSinglePartPhase(run) = .false.
                        write(stdout, *) "Walker number dropped below threshold, enabling dynamic shift"
                    end if
                end do
            end if
            ! and do not forget to communicate the decision
            call MPIBcast(tSinglePartPhase)
        end if

        call rotate_time()
    end subroutine update_real_time_iteration