From 004816a4baa59f667c018bc18ad63022de3014a2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Jun 2025 07:03:26 -0400 Subject: [PATCH] update tests for changed argument names --- python/lammps/core.py | 1 - unittest/python/python-numpy.py | 18 +++++++++--------- unittest/python/python-pylammps.py | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/python/lammps/core.py b/python/lammps/core.py index 349ccf2e1e..2e57e3d985 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -90,7 +90,6 @@ class command_wrapper: setattr(__main__, func_name, handler) return func_name return x - return None def __getattr__(self, name): """ diff --git a/unittest/python/python-numpy.py b/unittest/python/python-numpy.py index be9109b9a3..02cf7f55ed 100644 --- a/unittest/python/python-numpy.py +++ b/unittest/python/python-numpy.py @@ -165,7 +165,7 @@ class PythonNumpy(unittest.TestCase): x = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 1.5, 1.0, 1.0 ] types = [1, 2, 1] ids = [1, 2, 3] - self.assertEqual(self.lmp.create_atoms(3, id=ids, type=types, x=x), 3) + self.assertEqual(self.lmp.create_atoms(3, atomid=ids, atype=types, x=x), 3) self.lmp.command("mass * 2.0") self.lmp.command("pair_style zero 1.1") self.lmp.command("pair_coeff * *") @@ -426,7 +426,7 @@ class PythonNumpy(unittest.TestCase): x = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.5 ] types = [1, 1] - self.assertEqual(self.lmp.create_atoms(2, id=None, type=types, x=x), 2) + self.assertEqual(self.lmp.create_atoms(2, atomid=None, atype=types, x=x), 2) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 2) @@ -471,7 +471,7 @@ class PythonNumpy(unittest.TestCase): tags = [1, 2, 3, 4, 5, 6, 7] types = [1, 1, 1, 1, 1, 1, 1] - self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + self.assertEqual(self.lmp.create_atoms(7, atomid=tags, atype=types, x=x), 7) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 7) @@ -510,7 +510,7 @@ class PythonNumpy(unittest.TestCase): tags = [1, 2, 3, 4, 5, 6, 7] types = [1, 1, 1, 1, 1, 1, 1] - self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + self.assertEqual(self.lmp.create_atoms(7, atomid=tags, atype=types, x=x), 7) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 7) @@ -544,7 +544,7 @@ class PythonNumpy(unittest.TestCase): tags = [1, 2, 3, 4, 5, 6, 7] types = [1, 1, 1, 1, 2, 2, 2] - self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + self.assertEqual(self.lmp.create_atoms(7, atomid=tags, atype=types, x=x), 7) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 7) @@ -609,7 +609,7 @@ class PythonNumpy(unittest.TestCase): tags = [1, 2, 3, 4, 5, 6, 7] types = [1, 1, 1, 1, 1, 1, 1] - self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + self.assertEqual(self.lmp.create_atoms(7, atomid=tags, atype=types, x=x), 7) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 7) @@ -647,7 +647,7 @@ class PythonNumpy(unittest.TestCase): tags = [1, 2, 3, 4, 5, 6, 7] types = [1, 1, 1, 1, 1, 1, 1] - self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + self.assertEqual(self.lmp.create_atoms(7, atomid=tags, atype=types, x=x), 7) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 7) @@ -680,7 +680,7 @@ class PythonNumpy(unittest.TestCase): tags = [1, 2, 3, 4, 5, 6, 7] types = [1, 1, 1, 1, 1, 1, 1] - self.assertEqual(self.lmp.create_atoms(7, id=tags, type=types, x=x), 7) + self.assertEqual(self.lmp.create_atoms(7, atomid=tags, atype=types, x=x), 7) nlocal = self.lmp.extract_global("nlocal") self.assertEqual(nlocal, 7) @@ -733,7 +733,7 @@ class PythonNumpy(unittest.TestCase): types = [1, 1] - self.assertEqual(self.lmp.create_atoms(2, id=None, type=types, x=x), 2) + self.assertEqual(self.lmp.create_atoms(2, atomid=None, atype=types, x=x), 2) self.lmp.command("variable a atom x*x+y*y+z*z") a = self.lmp.numpy.extract_variable("a", "all", LMP_VAR_ATOM) self.assertIs(type(a), numpy.ndarray) diff --git a/unittest/python/python-pylammps.py b/unittest/python/python-pylammps.py index 3a7f0dc9cf..d4f7e8b2a3 100644 --- a/unittest/python/python-pylammps.py +++ b/unittest/python/python-pylammps.py @@ -53,7 +53,7 @@ class PythonPyLammps(unittest.TestCase): types = [1, 1] - self.assertEqual(self.pylmp.lmp.create_atoms(2, id=None, type=types, x=x), 2) + self.assertEqual(self.pylmp.lmp.create_atoms(2, atomid=None, atype=types, x=x), 2) self.assertEqual(self.pylmp.system.natoms, 2) self.assertEqual(len(self.pylmp.atoms), 2) numpy.testing.assert_array_equal(self.pylmp.atoms[0].position, tuple(x[0:3]))