subroutine UpdateRDMCorrectionTerm()
! first, communicate the rdm correction term between the procs
! take the instantaneous correction term and sum it into the accumulated one
implicit none
real(dp) :: AllInstRDMCorrectionFactor
call MPISumAll(InstRDMCorrectionFactor, AllInstRDMCorrectionFactor)
! rezero the instantaneous, proc local correction
InstRDMCorrectionFactor = 0.0_dp
! average the so-far accumulated RDMCorrection factor with the instantaneous one
RDMCorrectionFactor = (RDMCorrectionFactor * ThisRDMIter + AllInstRDMCorrectionFactor) / &
(ThisRDMIter + 1.0_dp)
! increase the iteration number count for averaging
ThisRDMIter = ThisRDMIter + 1.0_dp
end subroutine UpdateRDMCorrectionTerm