diff --git a/pylammpsmpi/mpi/lmpmpi.py b/pylammpsmpi/mpi/lmpmpi.py index 5c1b2b6f..6aec39e0 100644 --- a/pylammpsmpi/mpi/lmpmpi.py +++ b/pylammpsmpi/mpi/lmpmpi.py @@ -463,7 +463,11 @@ def _run_lammps_mpi(argument_lst): context = zmq.Context() socket = context.socket(zmq.PAIR) port_selected = argument_lst[argument_lst.index("--zmqport") + 1] - socket.connect("tcp://localhost:" + port_selected) + if "--host" in argument_lst: + host = argument_lst[argument_lst.index("--host") + 1] + else: + host = "localhost" + socket.connect("tcp://" + host + ":" + port_selected) else: context, socket = None, None # Lammps executable diff --git a/pylammpsmpi/utils/lammps.py b/pylammpsmpi/utils/lammps.py index be1d4fe0..4b94f502 100644 --- a/pylammpsmpi/utils/lammps.py +++ b/pylammpsmpi/utils/lammps.py @@ -3,6 +3,7 @@ # Distributed under the terms of "New BSD License", see the LICENSE file. import os +import socket from pympipool import SocketInterface @@ -39,6 +40,11 @@ def _initialize_socket( "--zmqport", str(port_selected), ] + if enable_flux_backend: + cmds += [ + "--host", + socket.gethostname(), + ] if cmdargs is not None: cmds.extend(cmdargs) interface.bootup(command_lst=cmds, cwd=cwd)