diff --git a/pylammpsmpi/wrapper/ase.py b/pylammpsmpi/wrapper/ase.py index 61ee51a..dda0660 100644 --- a/pylammpsmpi/wrapper/ase.py +++ b/pylammpsmpi/wrapper/ase.py @@ -32,6 +32,7 @@ class LammpsASELibrary: def __init__( self, working_directory: Optional[str] = None, + hostname_localhost: Optional[bool] = None, cores: int = 1, comm: Optional[object] = None, logger: Optional[object] = None, @@ -65,6 +66,7 @@ def __init__( self._interactive_library = LammpsBase( cores=self._cores, working_directory=working_directory, + hostname_localhost=hostname_localhost, executor=executor, ) diff --git a/pylammpsmpi/wrapper/concurrent.py b/pylammpsmpi/wrapper/concurrent.py index 782a9a2..f951ed3 100644 --- a/pylammpsmpi/wrapper/concurrent.py +++ b/pylammpsmpi/wrapper/concurrent.py @@ -73,6 +73,7 @@ def __init__( cores: int = 8, oversubscribe: bool = False, working_directory: str = ".", + hostname_localhost: Optional[bool] = None, cmdargs: list = None, executor: Optional[BaseExecutor] = None, ): @@ -102,6 +103,7 @@ def __init__( block_allocation=True, max_workers=1, init_function=init_function, + hostname_localhost=hostname_localhost, resource_dict={ "cores": self.cores, "cwd": self.working_directory, diff --git a/pylammpsmpi/wrapper/extended.py b/pylammpsmpi/wrapper/extended.py index 5f88248..e604169 100644 --- a/pylammpsmpi/wrapper/extended.py +++ b/pylammpsmpi/wrapper/extended.py @@ -257,6 +257,7 @@ def __init__( cores: int = 1, oversubscribe: bool = False, working_directory: str = ".", + hostname_localhost: Optional[bool] = None, client: Any = None, cmdargs: Optional[list[str]] = None, executor: Optional[BaseExecutor] = None, @@ -269,6 +270,7 @@ def __init__( cores=self.cores, oversubscribe=self.oversubscribe, working_directory=self.working_directory, + hostname_localhost=hostname_localhost, cmdargs=cmdargs, executor=executor, ) diff --git a/tests/test_ase_interface.py b/tests/test_ase_interface.py index cbe5be7..f6b1ff5 100644 --- a/tests/test_ase_interface.py +++ b/tests/test_ase_interface.py @@ -24,6 +24,7 @@ class TestLammpsASELibrary(unittest.TestCase): def test_static(self): lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), @@ -83,6 +84,7 @@ def test_static(self): def test_small_displacement(self): lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), @@ -128,6 +130,7 @@ def test_small_displacement(self): def test_velocities(self): lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), @@ -180,6 +183,7 @@ def test_velocities(self): def test_small_displacement_skewed(self): lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), @@ -226,6 +230,7 @@ def test_static_with_statement(self): structure = bulk("Al").repeat([2, 2, 2]) with LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=2, comm=None, logger=None, @@ -508,6 +513,7 @@ def test_individual_calculation(self): for structure in self.structure_lst: lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), @@ -533,6 +539,7 @@ def test_interactive_calculation(self): energy_lst = [] lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), @@ -559,6 +566,7 @@ def test_interactive_calculation_inverse(self): energy_lst = [] lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=None, logger=logging.getLogger("TestStaticLogger"), diff --git a/tests/test_base.py b/tests/test_base.py index 0871b45..dbca473 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -19,6 +19,7 @@ def setUpClass(cls): cores=1, oversubscribe=False, working_directory=".", + hostname_localhost=True, cmdargs=["-cite", cls.citation_file], ) cls.lmp.file(cls.lammps_file) @@ -32,6 +33,7 @@ def test_file_not_found(self): cores=1, oversubscribe=False, working_directory=".", + hostname_localhost=True, cmdargs=["-cite", self.citation_file], ) with self.assertRaises(FileNotFoundError): diff --git a/tests/test_concurrent.py b/tests/test_concurrent.py index a93584c..5c5fe1f 100644 --- a/tests/test_concurrent.py +++ b/tests/test_concurrent.py @@ -16,6 +16,7 @@ def setUpClass(cls): cores=1, oversubscribe=False, working_directory=".", + hostname_localhost=True, cmdargs=["-cite", cls.citation_file], ) cls.lmp.file(cls.lammps_file).result() diff --git a/tests/test_executor.py b/tests/test_executor.py index 5e281c7..43b9f9b 100644 --- a/tests/test_executor.py +++ b/tests/test_executor.py @@ -18,6 +18,7 @@ def calc_lmp(structure): lmp = LammpsASELibrary( working_directory=None, + hostname_localhost=True, cores=1, comm=MPI.COMM_SELF, logger=None, diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index 6ac6c8e..3d1bcdd 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -17,7 +17,9 @@ def setUpClass(cls): cls.execution_path = os.path.dirname(os.path.abspath(__file__)) cls.citation_file = os.path.join(cls.execution_path, "citations.txt") cls.lammps_file = os.path.join(cls.execution_path, "in.simple") - cls.lmp = LammpsLibrary(cores=2, cmdargs=["-cite", cls.citation_file]) + cls.lmp = LammpsLibrary( + cores=2, cmdargs=["-cite", cls.citation_file], hostname_localhost=True + ) cls.lmp.file(cls.lammps_file) @classmethod @@ -116,6 +118,7 @@ def test_version(self): lammps_file = os.path.join(execution_path, "in.simple") with SingleNodeExecutor( block_allocation=True, + hostname_localhost=True, max_workers=1, init_function=init_function, resource_dict={