From d09851e695f99ac5da376a05f6b9dbde70e835df Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Thu, 9 Sep 2021 21:47:08 -0400 Subject: [PATCH] Improve MPI support in PyLammps --- python/lammps/pylammps.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index b0eeb6c401..a6e3578aef 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -508,11 +508,6 @@ class PyLammps(object): :py:attr:`PyLammps.last_run`. """ output = self.__getattr__('run')(*args, **kwargs) - - comm = self.lmp.get_mpi_comm() - if comm: - output = self.lmp.comm.bcast(output, root=0) - self.runs += get_thermo_data(output) return output @@ -784,6 +779,10 @@ class PyLammps(object): self.command(cmd) output = capture.output + comm = self.lmp.get_mpi_comm() + if comm: + output = self.lmp.comm.bcast(output, root=0) + if 'verbose' in kwargs and kwargs['verbose']: print(output)