From f483a90d8a5a60a843e71585248c2c2fad4f67e2 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Fri, 1 Nov 2024 15:04:30 -0600 Subject: [PATCH] Simplifying RHEO compute comm calls --- src/RHEO/compute_rheo_grad.cpp | 6 ++---- src/RHEO/compute_rheo_interface.cpp | 6 ++---- src/RHEO/compute_rheo_kernel.cpp | 5 +---- src/RHEO/compute_rheo_kernel.h | 2 +- src/RHEO/compute_rheo_surface.cpp | 12 ++++-------- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/RHEO/compute_rheo_grad.cpp b/src/RHEO/compute_rheo_grad.cpp index 63c77e3f3b..589f85e195 100644 --- a/src/RHEO/compute_rheo_grad.cpp +++ b/src/RHEO/compute_rheo_grad.cpp @@ -290,8 +290,7 @@ void ComputeRHEOGrad::compute_peratom() void ComputeRHEOGrad::forward_gradients() { comm_stage = COMMGRAD; - comm_forward = ncomm_grad; - comm->forward_comm(this); + comm->forward_comm(this, ncomm_grad); } /* ---------------------------------------------------------------------- */ @@ -299,8 +298,7 @@ void ComputeRHEOGrad::forward_gradients() void ComputeRHEOGrad::forward_fields() { comm_stage = COMMFIELD; - comm_forward = ncomm_field; - comm->forward_comm(this); + comm->forward_comm(this, ncomm_field); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_interface.cpp b/src/RHEO/compute_rheo_interface.cpp index eec5659051..abfe6c2b0e 100644 --- a/src/RHEO/compute_rheo_interface.cpp +++ b/src/RHEO/compute_rheo_interface.cpp @@ -218,8 +218,7 @@ void ComputeRHEOInterface::compute_peratom() } comm_stage = 1; - comm_forward = 2; - comm->forward_comm(this); + comm->forward_comm(this, 2); } /* ---------------------------------------------------------------------- */ @@ -369,9 +368,8 @@ void ComputeRHEOInterface::store_forces() } // Forward comm forces - comm_forward = 3; comm_stage = 0; - comm->forward_comm(this); + comm->forward_comm(this, 3); } /* ---------------------------------------------------------------------- diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index d037894bd1..3a6629bfef 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -90,7 +90,6 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : comm_forward = ncor * Mdim; } - comm_forward_save = comm_forward; corrections_calculated = 0; lapack_error_flag = 0; } @@ -778,7 +777,6 @@ void ComputeRHEOKernel::compute_peratom() // communicate calculated quantities comm_stage = 1; - comm_forward = comm_forward_save; comm->forward_comm(this); } @@ -826,8 +824,7 @@ void ComputeRHEOKernel::compute_coordination() // communicate calculated quantities comm_stage = 0; - comm_forward = 1; - comm->forward_comm(this); + comm->forward_comm(this, 1); } /* ---------------------------------------------------------------------- */ diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 2f458d14c9..037e9e3683 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -52,7 +52,7 @@ class ComputeRHEOKernel : public Compute { class FixRHEO *fix_rheo; private: - int comm_stage, comm_forward_save; + int comm_stage; int interface_flag; int lapack_error_flag; std::unordered_set lapack_error_tags; diff --git a/src/RHEO/compute_rheo_surface.cpp b/src/RHEO/compute_rheo_surface.cpp index db78f0a4ff..74193f28f5 100644 --- a/src/RHEO/compute_rheo_surface.cpp +++ b/src/RHEO/compute_rheo_surface.cpp @@ -199,10 +199,8 @@ void ComputeRHEOSurface::compute_peratom() // reverse gradC and divr, forward divr comm_stage = 0; - comm_reverse = dim * dim + 1; - comm_forward = 1; - if (newton) comm->reverse_comm(this); - comm->forward_comm(this); + if (newton) comm->reverse_comm(this, dim * dim + 1); + comm->forward_comm(this, 1); // calculate nsurface for local atoms // Note, this isn't forwarded to ghosts @@ -299,10 +297,8 @@ void ComputeRHEOSurface::compute_peratom() // forward/reverse status and rsurface comm_stage = 1; - comm_reverse = 2; - comm_forward = 2; - if (newton) comm->reverse_comm(this); - comm->forward_comm(this); + if (newton) comm->reverse_comm(this, 2); + comm->forward_comm(this, 2); } /* ---------------------------------------------------------------------- */