diff --git a/pylammpsmpi/lammps_wrapper.py b/pylammpsmpi/lammps_wrapper.py index 57d48d70..cf744634 100644 --- a/pylammpsmpi/lammps_wrapper.py +++ b/pylammpsmpi/lammps_wrapper.py @@ -33,6 +33,7 @@ def __init__(self, cores=1, working_directory=".", client=None, mode="local"): LammpsBase, cores=self.cores, working_directory=self.working_directory, + local=False, actor=True, ) self.lmp = fut.result() diff --git a/pylammpsmpi/utils/lammps.py b/pylammpsmpi/utils/lammps.py index 4b54fe44..2e844e02 100644 --- a/pylammpsmpi/utils/lammps.py +++ b/pylammpsmpi/utils/lammps.py @@ -20,17 +20,29 @@ class LammpsBase: - def __init__(self, cores=8, working_directory="."): + def __init__(self, cores=8, working_directory=".", local=True): self.cores = cores self.working_directory = working_directory self._process = None + self.local = local def start_process(self): executable = os.path.join( os.path.dirname(os.path.abspath(__file__)), "../mpi", "lmpmpi.py" ) + if self.local: + command_array = ["mpiexec", "-n", str(self.cores), "python", executable] + else: + command_array = [ + "mpiexec", + "--oversubscribe", + "-n", + str(self.cores), + "python", + executable, + ] self._process = subprocess.Popen( - ["mpiexec", "--oversubscribe", "-n", str(self.cores), "python", executable], + command_array, stdout=subprocess.PIPE, stderr=None, stdin=subprocess.PIPE,