iteration_output_wrapper Subroutine

public subroutine iteration_output_wrapper(iter_data, tot_parts_new, replica_pairs, t_comm_req)

Arguments

Type IntentOptional Attributes Name
type(fcimc_iter_data), intent(inout) :: iter_data
real(kind=dp), intent(in), dimension(lenof_sign) :: tot_parts_new
logical, intent(in) :: replica_pairs
logical, intent(in), optional :: t_comm_req

Contents


Source Code

    subroutine iteration_output_wrapper(iter_data, tot_parts_new, &
                                        replica_pairs, t_comm_req)
        type(fcimc_iter_data), intent(inout) :: iter_data
        real(dp), dimension(lenof_sign), intent(in) :: tot_parts_new
        real(dp), dimension(lenof_sign) :: tot_parts_new_all
        logical, intent(in) :: replica_pairs
        logical, intent(in), optional :: t_comm_req
        logical :: t_do_comm

        ! The comm can be switched off
        if (present(t_comm_req)) then
            t_do_comm = t_comm_req
        else
            t_do_comm = .true.
        end if

        if (t_do_comm) &
            call communicate_estimates(iter_data, tot_parts_new, tot_parts_new_all, .true.)
        if (tPrintDataTables) &
            call write_to_stats()

    contains
        subroutine write_to_stats()
            ! Write the current output cycle's stats to the FCIMCStats/fciqmc_stats output file
            ! + stdout

            ! adjust the trial numerator for output (add in the offset)
            if (tTrialWavefunction) then
                tot_trial_numerator = relative_trial_numerator( &
                                      tot_trial_numerator, tot_trial_denom, replica_pairs)
                if (tTruncInitiator) &
                    tot_init_trial_numerator = relative_trial_numerator( &
                                               tot_init_trial_numerator, tot_init_trial_denom, replica_pairs)
            end if
            call output_diagnostics()

            if (tFCIMCStats2) then
                call write_fcimcstats2(iter_data_fciqmc)
            else
                call WriteFCIMCStats()
            end if
            ! reset accumulated output variables
            call rezero_output_stats()
        end subroutine write_to_stats
    end subroutine iteration_output_wrapper