flush_freeze_buffers Subroutine

public subroutine flush_freeze_buffers()

Sum the locally accumulated corrections to the diagonal and one-body terms up and add them to the global terms, then deallocate temporaries. This is called after reading in the 6-index integrals

Arguments

None

Contents

Source Code


Source Code

    subroutine flush_freeze_buffers()
        integer(MPIArg) :: tmat_size
        integer(MPIArg) :: ierr

        if(nFrozen > 0) then

            if(.not. allocated(TMat_local) .or. .not. allocated(TMat_total)) &
                call stop_all("flush_freeze_buffers", &
                              "Buffers for freezing three-body interaction not allocated")

            ! Sum the core energy from each proc on this node
            call MPI_Allreduce(ECore_local, ECore_tot, 1, MPI_DOUBLE_PRECISION, MPI_SUM, &
                               mpi_comm_intra, ierr)
            ECore = ECore + ECore_tot

            tmat_size = size(TMat_local)
            ! Sum the 1-body terms from each proc on this node
            call MPI_Allreduce(TMat_local, TMat_total, tmat_size, MPI_DOUBLE_PRECISION, MPI_SUM, &
                               mpi_comm_intra, ierr)
            TMat2D = TMat2D+TMat_total

            ! Deallocate the temporary for the 1-body integrals
            deallocate(TMat_local)
            deallocate(TMat_total)

            ! The 2-body terms are shared memory, no operation is required at this point
        end if
    end subroutine flush_freeze_buffers