update tests for changed argument names

This commit is contained in:
Axel Kohlmeyer
2025-06-18 07:03:26 -04:00
parent 6934932383
commit 004816a4ba
3 changed files with 10 additions and 11 deletions

View File

@ -90,7 +90,6 @@ class command_wrapper:
setattr(__main__, func_name, handler) setattr(__main__, func_name, handler)
return func_name return func_name
return x return x
return None
def __getattr__(self, name): def __getattr__(self, name):
""" """

View File

@ -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 ] x = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 1.5, 1.0, 1.0 ]
types = [1, 2, 1] types = [1, 2, 1]
ids = [1, 2, 3] 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("mass * 2.0")
self.lmp.command("pair_style zero 1.1") self.lmp.command("pair_style zero 1.1")
self.lmp.command("pair_coeff * *") 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 ] x = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.5 ]
types = [1, 1] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 2) self.assertEqual(nlocal, 2)
@ -471,7 +471,7 @@ class PythonNumpy(unittest.TestCase):
tags = [1, 2, 3, 4, 5, 6, 7] tags = [1, 2, 3, 4, 5, 6, 7]
types = [1, 1, 1, 1, 1, 1, 1] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 7) self.assertEqual(nlocal, 7)
@ -510,7 +510,7 @@ class PythonNumpy(unittest.TestCase):
tags = [1, 2, 3, 4, 5, 6, 7] tags = [1, 2, 3, 4, 5, 6, 7]
types = [1, 1, 1, 1, 1, 1, 1] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 7) self.assertEqual(nlocal, 7)
@ -544,7 +544,7 @@ class PythonNumpy(unittest.TestCase):
tags = [1, 2, 3, 4, 5, 6, 7] tags = [1, 2, 3, 4, 5, 6, 7]
types = [1, 1, 1, 1, 2, 2, 2] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 7) self.assertEqual(nlocal, 7)
@ -609,7 +609,7 @@ class PythonNumpy(unittest.TestCase):
tags = [1, 2, 3, 4, 5, 6, 7] tags = [1, 2, 3, 4, 5, 6, 7]
types = [1, 1, 1, 1, 1, 1, 1] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 7) self.assertEqual(nlocal, 7)
@ -647,7 +647,7 @@ class PythonNumpy(unittest.TestCase):
tags = [1, 2, 3, 4, 5, 6, 7] tags = [1, 2, 3, 4, 5, 6, 7]
types = [1, 1, 1, 1, 1, 1, 1] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 7) self.assertEqual(nlocal, 7)
@ -680,7 +680,7 @@ class PythonNumpy(unittest.TestCase):
tags = [1, 2, 3, 4, 5, 6, 7] tags = [1, 2, 3, 4, 5, 6, 7]
types = [1, 1, 1, 1, 1, 1, 1] 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") nlocal = self.lmp.extract_global("nlocal")
self.assertEqual(nlocal, 7) self.assertEqual(nlocal, 7)
@ -733,7 +733,7 @@ class PythonNumpy(unittest.TestCase):
types = [1, 1] 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") self.lmp.command("variable a atom x*x+y*y+z*z")
a = self.lmp.numpy.extract_variable("a", "all", LMP_VAR_ATOM) a = self.lmp.numpy.extract_variable("a", "all", LMP_VAR_ATOM)
self.assertIs(type(a), numpy.ndarray) self.assertIs(type(a), numpy.ndarray)

View File

@ -53,7 +53,7 @@ class PythonPyLammps(unittest.TestCase):
types = [1, 1] 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(self.pylmp.system.natoms, 2)
self.assertEqual(len(self.pylmp.atoms), 2) self.assertEqual(len(self.pylmp.atoms), 2)
numpy.testing.assert_array_equal(self.pylmp.atoms[0].position, tuple(x[0:3])) numpy.testing.assert_array_equal(self.pylmp.atoms[0].position, tuple(x[0:3]))