subroutine average_determ_vector() use FciMCData, only: Iter, IterRDMStart use FciMCData, only: PreviousCycles use LoggingData, only: RDMEnergyIter real(dp) :: iter_curr, iter_start_av integer :: run ! If this condition is met then RDM energies were added in on the ! previous iteration. We now want to start a new averaging block so ! that the same contributions aren't added in again later. if (mod(Iter + PreviousCycles - IterRDMStart, RDMEnergyIter) == 0) then do run = 1, size(cs_replicas) cs_replicas(run)%full_determ_vecs_av = 0.0_dp end do write(stdout, *) "Reset fdv av at iteration ", iter end if ! The current iteration, converted to a double precision real. iter_curr = real(Iter + PreviousCycles, dp) ! The iteration that this averaging block started on. iter_start_av = real(RDMEnergyIter * ((Iter + PreviousCycles - IterRDMStart) & / RDMEnergyIter) + IterRDMStart, dp) ! Add in the current deterministic vector to the running average. do run = 1, size(cs_replicas) associate(rep => cs_replicas(run)) rep%full_determ_vecs_av = (((iter_curr - iter_start_av) & * rep%full_determ_vecs_av) + rep%full_determ_vecs) / & (iter_curr - iter_start_av + 1.0_dp) end associate end do end subroutine average_determ_vector