From 0ba7fed1faafbbd394399137bf210c7d2edda36c Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 31 Jul 2024 02:48:43 -0400 Subject: [PATCH] fix:fix LAMMPS MPI tests with mpi4py 4.0.0 (#4032) The previous code works with mpi4py<4 but fails with mpi4py 4.0.0. I don't know what breaking change was made. ## Summary by CodeRabbit - **Bug Fixes** - Optimized potential energy calculation in the LAMMPS simulation by restricting evaluation to the master process, reducing unnecessary computations. - **Chores** - Improved control flow for better performance in parallel execution contexts. Signed-off-by: Jinzhe Zeng (cherry picked from commit 1e7223666d58fca7ae131b0415706ccaf69a4f08) --- source/lmp/tests/run_mpi_pair_deepmd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/lmp/tests/run_mpi_pair_deepmd.py b/source/lmp/tests/run_mpi_pair_deepmd.py index b27774ce11..0c4291ab3a 100644 --- a/source/lmp/tests/run_mpi_pair_deepmd.py +++ b/source/lmp/tests/run_mpi_pair_deepmd.py @@ -54,8 +54,8 @@ ) lammps.pair_coeff("* *") lammps.run(0) -pe = lammps.eval("pe") if rank == 0: + pe = lammps.eval("pe") arr = [pe] np.savetxt(output, np.array(arr)) MPI.Finalize()