From 17877698830c0f6c38a7cdc8c9133195eefb855f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 06:53:34 +0200 Subject: [PATCH 01/19] Update lammps.py --- pylammpsmpi/utils/lammps.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pylammpsmpi/utils/lammps.py b/pylammpsmpi/utils/lammps.py index d931b9a..332d67f 100644 --- a/pylammpsmpi/utils/lammps.py +++ b/pylammpsmpi/utils/lammps.py @@ -112,7 +112,7 @@ def extract_setting(self, *args): self._send(command="extract_setting", data=list(args)) return self._receive() - def extract_global(self, name, type): + def extract_global(self, name): """ Extract value of global simulation parameters @@ -121,10 +121,6 @@ def extract_global(self, name, type): name : string see notes for a set of possible options - type : {0, 1} - 0 if output value is integer - 1 if output value is float - Notes ----- The possible options for `name` are- @@ -142,7 +138,7 @@ def extract_global(self, name, type): "mvh2r", "angstrom", "femtosecond", "qelectron" """ - self._send(command="extract_global", data=[name, type]) + self._send(command="extract_global", data=[name]) return self._receive() def extract_box(self): From 0d257282d17431f2b709721df90c970151ac303f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 06:54:41 +0200 Subject: [PATCH 02/19] Update environment.yml --- .ci_support/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci_support/environment.yml b/.ci_support/environment.yml index 636aa96..b020dd2 100644 --- a/.ci_support/environment.yml +++ b/.ci_support/environment.yml @@ -4,7 +4,7 @@ dependencies: - coveralls - coverage - codacy-coverage - - lammps >=2020.12.24 + - lammps >=2021.05.27 - mpi4py =3.0.3 - openmpi - numpy From d60cc40ee53de4277cfb70eba2dee7b3b509be6c Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 08:03:37 +0200 Subject: [PATCH 03/19] Update lammps_local.ipynb --- notebooks/lammps_local.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/lammps_local.ipynb b/notebooks/lammps_local.ipynb index b5fbef1..3d424e5 100644 --- a/notebooks/lammps_local.ipynb +++ b/notebooks/lammps_local.ipynb @@ -185,7 +185,7 @@ } ], "source": [ - "lmp.extract_global(\"boxxhi\", 1)" + "lmp.extract_global(\"boxxhi\")" ] }, { From 58bbf75d2bf326dfddaaa1802a4e9b210730fd5d Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 08:04:20 +0200 Subject: [PATCH 04/19] Update lammps_local_cluster.ipynb --- notebooks/lammps_local_cluster.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/lammps_local_cluster.ipynb b/notebooks/lammps_local_cluster.ipynb index 8886a85..a9efb5c 100644 --- a/notebooks/lammps_local_cluster.ipynb +++ b/notebooks/lammps_local_cluster.ipynb @@ -292,7 +292,7 @@ } ], "source": [ - "lmp.extract_global(\"boxxhi\", 1)" + "lmp.extract_global(\"boxxhi\")" ] }, { From edc0be4438e0a971026d70c6b661bdce60852ae6 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 08:05:06 +0200 Subject: [PATCH 05/19] Update lammps_slurm_cluster.ipynb --- notebooks/lammps_slurm_cluster.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/lammps_slurm_cluster.ipynb b/notebooks/lammps_slurm_cluster.ipynb index 5290f7b..049cce1 100644 --- a/notebooks/lammps_slurm_cluster.ipynb +++ b/notebooks/lammps_slurm_cluster.ipynb @@ -297,7 +297,7 @@ } ], "source": [ - "lmp.extract_global(\"boxxhi\", 1)" + "lmp.extract_global(\"boxxhi\")" ] }, { From f3563a44fad86c7432a65794645fae051984910f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 11:07:18 +0200 Subject: [PATCH 06/19] Update environment.yml --- binder/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binder/environment.yml b/binder/environment.yml index 2622f94..4e5f7f9 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -4,7 +4,7 @@ dependencies: - openmpi - mpi4py - numpy -- lammps >=2020.12.24 +- lammps =2021.05.27=*openmpi_2 - pytest - distributed - dask-jobqueue From 737a125790d8f124d3d3416d5c7b56b06947e5f9 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 11:07:33 +0200 Subject: [PATCH 07/19] Update environment.yml --- .ci_support/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci_support/environment.yml b/.ci_support/environment.yml index b020dd2..548ed00 100644 --- a/.ci_support/environment.yml +++ b/.ci_support/environment.yml @@ -4,7 +4,7 @@ dependencies: - coveralls - coverage - codacy-coverage - - lammps >=2021.05.27 + - lammps =2021.05.27=*openmpi_2 - mpi4py =3.0.3 - openmpi - numpy From 5c997852de84d1476cc6e9121d46bdf13c4bcf00 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 11:56:24 +0200 Subject: [PATCH 08/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a26bd98..22f6984 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ lmp.mass(1, 20) ```python -lmp.extract_global("boxxhi", 1) +lmp.extract_global("boxxhi") ``` From 52805343d1df56fc88a6c9988c028e3522545312 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 20:40:35 +0200 Subject: [PATCH 09/19] Update environment.yml --- .ci_support/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci_support/environment.yml b/.ci_support/environment.yml index 548ed00..b020dd2 100644 --- a/.ci_support/environment.yml +++ b/.ci_support/environment.yml @@ -4,7 +4,7 @@ dependencies: - coveralls - coverage - codacy-coverage - - lammps =2021.05.27=*openmpi_2 + - lammps >=2021.05.27 - mpi4py =3.0.3 - openmpi - numpy From b65ce2da40660db87e78b37bdb7af98dd64a84cc Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 4 Jun 2021 20:41:45 +0200 Subject: [PATCH 10/19] Update environment.yml --- binder/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binder/environment.yml b/binder/environment.yml index 4e5f7f9..1880c64 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -4,7 +4,7 @@ dependencies: - openmpi - mpi4py - numpy -- lammps =2021.05.27=*openmpi_2 +- lammps >=2021.05.27 - pytest - distributed - dask-jobqueue From fbe3809c398fbe74ed0757a4bba08fc6b8fa3672 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:26:09 +0200 Subject: [PATCH 11/19] Update lammps_local.ipynb --- notebooks/lammps_local.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/notebooks/lammps_local.ipynb b/notebooks/lammps_local.ipynb index 3d424e5..0affdf3 100644 --- a/notebooks/lammps_local.ipynb +++ b/notebooks/lammps_local.ipynb @@ -542,6 +542,7 @@ "metadata": {}, "outputs": [], "source": [ + "lmp.delete_atoms(\"group\", \"all\")\n", "lmp.reset_box([0.0,0.0,0.0], [8.0,8.0,8.0], 0.0,0.0,0.0)" ] } From e54ba3b27bc0695f4cfdd8fb9266dcbe3cf12a6b Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:26:28 +0200 Subject: [PATCH 12/19] Update lammps_local_cluster.ipynb --- notebooks/lammps_local_cluster.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/notebooks/lammps_local_cluster.ipynb b/notebooks/lammps_local_cluster.ipynb index a9efb5c..a43f41f 100644 --- a/notebooks/lammps_local_cluster.ipynb +++ b/notebooks/lammps_local_cluster.ipynb @@ -649,6 +649,7 @@ "metadata": {}, "outputs": [], "source": [ + "lmp.delete_atoms(\"group\", \"all\")\n", "lmp.reset_box([0.0,0.0,0.0], [8.0,8.0,8.0], 0.0,0.0,0.0)" ] } From 3670c330313cdd31a2dc126ea2072daf3977d619 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:26:46 +0200 Subject: [PATCH 13/19] Update lammps_slurm_cluster.ipynb --- notebooks/lammps_slurm_cluster.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/notebooks/lammps_slurm_cluster.ipynb b/notebooks/lammps_slurm_cluster.ipynb index 049cce1..42542e2 100644 --- a/notebooks/lammps_slurm_cluster.ipynb +++ b/notebooks/lammps_slurm_cluster.ipynb @@ -654,6 +654,7 @@ "metadata": {}, "outputs": [], "source": [ + "lmp.delete_atoms(\"group\", \"all\")\n", "lmp.reset_box([0.0,0.0,0.0], [8.0,8.0,8.0], 0.0,0.0,0.0)" ] }, From 154ad692b93ece829c79cfda521142b42cc5e530 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:31:09 +0200 Subject: [PATCH 14/19] Update test_pylammpsmpi_local.py --- tests/test_pylammpsmpi_local.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index ecfe707..945ace3 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -37,19 +37,6 @@ def test_gather_atoms(self): ids = self.lmp.extract_atom("id") self.assertEqual(len(ids), 256) - def test_extract_box(self): - - box = self.lmp.extract_box() - self.assertEqual(len(box), 7) - - self.assertEqual(box[0][0], 0.0) - self.assertEqual(np.round(box[1][0], 2), 6.72) - - self.lmp.reset_box([0.0, 0.0, 0.0], [8.0, 8.0, 8.0], 0.0, 0.0, 0.0) - box = self.lmp.extract_box() - self.assertEqual(box[0][0], 0.0) - self.assertEqual(np.round(box[1][0], 2), 8.0) - def test_extract_fix(self): x = self.lmp.extract_fix("2", 0, 1, 1) self.assertEqual(np.round(x, 2), -2.61) @@ -77,6 +64,19 @@ def test_scatter_atoms(self): f1 = self.lmp.gather_atoms("f", ids=[1, 2]) self.assertEqual(f1[1][1], val) + def test_extract_box(self): + + box = self.lmp.extract_box() + self.assertEqual(len(box), 7) + + self.assertEqual(box[0][0], 0.0) + self.assertEqual(np.round(box[1][0], 2), 6.72) + + self.delete_atoms("group", "all") + self.lmp.reset_box([0.0, 0.0, 0.0], [8.0, 8.0, 8.0], 0.0, 0.0, 0.0) + box = self.lmp.extract_box() + self.assertEqual(box[0][0], 0.0) + self.assertEqual(np.round(box[1][0], 2), 8.0) if __name__ == "__main__": unittest.main() From c972e8e91cb80fe1066a3f7590cdcb9aa7c22c27 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:32:52 +0200 Subject: [PATCH 15/19] Update test_pylammpsmpi_local.py --- tests/test_pylammpsmpi_local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index 945ace3..75ab108 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -72,7 +72,7 @@ def test_extract_box(self): self.assertEqual(box[0][0], 0.0) self.assertEqual(np.round(box[1][0], 2), 6.72) - self.delete_atoms("group", "all") + self.lmp.delete_atoms("group", "all") self.lmp.reset_box([0.0, 0.0, 0.0], [8.0, 8.0, 8.0], 0.0, 0.0, 0.0) box = self.lmp.extract_box() self.assertEqual(box[0][0], 0.0) From a59cb1dda9fee5ab0a9550dc1d537962ad763ec4 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:32:57 +0200 Subject: [PATCH 16/19] Update test_pylammpsmpi_cluster.py --- tests/test_pylammpsmpi_cluster.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/test_pylammpsmpi_cluster.py b/tests/test_pylammpsmpi_cluster.py index 62196f0..d847030 100644 --- a/tests/test_pylammpsmpi_cluster.py +++ b/tests/test_pylammpsmpi_cluster.py @@ -40,18 +40,6 @@ def test_gather_atoms(self): ids = self.lmp.extract_atom("id") self.assertEqual(len(ids), 256) - def test_extract_box(self): - box = self.lmp.extract_box() - self.assertEqual(len(box), 7) - - self.assertEqual(box[0][0], 0.0) - self.assertEqual(np.round(box[1][0], 2), 6.72) - - self.lmp.reset_box([0.0,0.0,0.0], [8.0,8.0,8.0], 0.0,0.0,0.0) - box = self.lmp.extract_box() - self.assertEqual(box[0][0], 0.0) - self.assertEqual(np.round(box[1][0], 2), 8.0) - def test_extract_fix(self): x = self.lmp.extract_fix("2", 0, 1, 1) self.assertEqual(np.round(x, 2), -2.61) @@ -79,6 +67,19 @@ def test_scatter_atoms(self): f1 = self.lmp.gather_atoms("f", ids=[1,2]) self.assertEqual(f1[1][1], val) + def test_extract_box(self): + box = self.lmp.extract_box() + self.assertEqual(len(box), 7) + + self.assertEqual(box[0][0], 0.0) + self.assertEqual(np.round(box[1][0], 2), 6.72) + + self.lmp.delete_atoms("group", "all") + self.lmp.reset_box([0.0,0.0,0.0], [8.0,8.0,8.0], 0.0,0.0,0.0) + box = self.lmp.extract_box() + self.assertEqual(box[0][0], 0.0) + self.assertEqual(np.round(box[1][0], 2), 8.0) + if __name__ == "__main__": unittest.main() From 20ffa7f16c1e5dc03abf60e9346362aba74ac0a1 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:39:55 +0200 Subject: [PATCH 17/19] Update test_pylammpsmpi_local.py --- tests/test_pylammpsmpi_local.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_pylammpsmpi_local.py b/tests/test_pylammpsmpi_local.py index 75ab108..1fc9891 100644 --- a/tests/test_pylammpsmpi_local.py +++ b/tests/test_pylammpsmpi_local.py @@ -11,9 +11,9 @@ class TestLocalLammpsLibrary(unittest.TestCase): @classmethod def setUpClass(cls): - execution_path = os.path.dirname(os.path.abspath(__file__)) + cls.execution_path = os.path.dirname(os.path.abspath(__file__)) cls.lmp = LammpsLibrary(cores=2, mode='local') - cls.lmp.file(os.path.join(execution_path, "in.simple")) + cls.lmp.file(os.path.join(cls.execution_path, "in.simple")) @classmethod def tearDownClass(cls): @@ -77,6 +77,9 @@ def test_extract_box(self): box = self.lmp.extract_box() self.assertEqual(box[0][0], 0.0) self.assertEqual(np.round(box[1][0], 2), 8.0) + self.lmp.clear() + self.lmp.file(os.path.join(self.execution_path, "in.simple")) + if __name__ == "__main__": unittest.main() From 6365cf28326b3d282b560b79d8fbf71ac4c197cf Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 5 Jun 2021 08:40:28 +0200 Subject: [PATCH 18/19] Update test_pylammpsmpi_cluster.py --- tests/test_pylammpsmpi_cluster.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_pylammpsmpi_cluster.py b/tests/test_pylammpsmpi_cluster.py index d847030..b70b0b2 100644 --- a/tests/test_pylammpsmpi_cluster.py +++ b/tests/test_pylammpsmpi_cluster.py @@ -79,6 +79,8 @@ def test_extract_box(self): box = self.lmp.extract_box() self.assertEqual(box[0][0], 0.0) self.assertEqual(np.round(box[1][0], 2), 8.0) + self.lmp.clear() + self.lmp.file(os.path.join(self.execution_path, "in.simple")) if __name__ == "__main__": From 1a72542301e581f543678161e25334dd3afe2d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Jan=C3=9Fen?= Date: Sat, 5 Jun 2021 10:03:42 +0200 Subject: [PATCH 19/19] last fix --- tests/test_pylammpsmpi_cluster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_pylammpsmpi_cluster.py b/tests/test_pylammpsmpi_cluster.py index b70b0b2..d4a80ed 100644 --- a/tests/test_pylammpsmpi_cluster.py +++ b/tests/test_pylammpsmpi_cluster.py @@ -12,11 +12,11 @@ class TestLocalLammpsLibrary(unittest.TestCase): @classmethod def setUpClass(cls): - execution_path = os.path.dirname(os.path.abspath(__file__)) + cls.execution_path = os.path.dirname(os.path.abspath(__file__)) cluster = LocalCluster(n_workers=1, threads_per_worker=2) client = Client(cluster) cls.lmp = LammpsLibrary(cores=2, mode='dask', client=client) - cls.lmp.file(os.path.join(execution_path, "in.simple")) + cls.lmp.file(os.path.join(cls.execution_path, "in.simple")) @classmethod def tearDownClass(cls):