collate_iter_data Subroutine

public subroutine collate_iter_data(iter_data)

Arguments

Type IntentOptional Attributes Name
type(fcimc_iter_data) :: iter_data

Contents

Source Code


Source Code

    subroutine collate_iter_data(iter_data)

        type(fcimc_iter_data) :: iter_data
        logical :: ltmp
        character(len=*), parameter :: this_routine = 'collate_iter_data'

        ! We should update tau searching if it is enabled, or if it has been
        ! enabled, and now tau is outside the range acceptable for tau
        ! searching
        if (t_scale_tau_to_death .and. tau_search_method == possible_tau_search_methods%OFF) then
            call MPIAllLORLogical(scale_tau_to_death_triggered, ltmp)
            scale_tau_to_death_triggered = ltmp
        end if

        ! for now with the new tau-search also update tau in variable shift
        ! mode..
        if (.not. tFillingStochRDMOnFly) then
            if (tau_search_method == possible_tau_search_methods%CONVENTIONAL) then
                call update_tau()
            else if (tau_search_method == possible_tau_search_methods%HISTOGRAMMING) then
                call update_tau_hist()
            else if (scale_tau_to_death_triggered) then
                ASSERT(tau_search_method == possible_tau_search_methods%OFF)
                ASSERT(t_scale_tau_to_death)
                call scale_tau_to_death()
            end if
        end if

        ! quick fix for the double occupancy:
        if (t_calc_double_occ_av) then
            ! sum up the squared norm after shift has set in TODO
            ! and use the mean value if multiple runs are used
            ! still thinking about if i only want to calc it after
            ! equilibration
            sum_norm_psi_squared = sum_norm_psi_squared + &
                                   sum(all_norm_psi_squared) / real(inum_runs, dp)

            ! and also sum up the double occupancy:
            sum_double_occ = sum_double_occ + all_inst_double_occ
        end if

#ifdef DEBUG_
        if (.not. tfirst_cycle) then
            ! realtime case is handled seperately with the check_update_growth function
            ! as each RK step has to be monitored separately

            ! Write this 'ASSERTROOT' out explicitly to avoid line lengths problems
            if ((iProcIndex == root) .and. .not. tSpinProject .and. .not. tTrialShift .and. &
                all(abs(iter_data%update_growth_tot - (AllTotParts - AllTotPartsOld)) > 1.0e-5)) then
                write(stderr, *) "update_growth: ", iter_data%update_growth_tot
                write(stderr, *) "AllTotParts: ", AllTotParts
                write(stderr, *) "AllTotPartsOld: ", AllTotPartsOld
                call stop_all(this_routine, &
                              "Assertation failed: all(iter_data%update_growth_tot.eq.AllTotParts-AllTotPartsOld)")
            end if
        end if
#endif

    end subroutine collate_iter_data