Merge branch 'develop' into always-exceptions
This commit is contained in:
@ -533,6 +533,33 @@ create_atoms 1 single &
|
||||
result = self.lmp.get_thermo(key)
|
||||
self.assertEqual(value, result, key)
|
||||
|
||||
|
||||
def test_last_thermo(self):
|
||||
self.lmp.command("units lj")
|
||||
self.lmp.command("atom_style atomic")
|
||||
self.lmp.command("atom_modify map array")
|
||||
self.lmp.command("boundary f f f")
|
||||
self.lmp.command("region box block 0 2 0 2 0 2")
|
||||
self.lmp.command("create_box 1 box")
|
||||
self.lmp.command("mass * 1")
|
||||
|
||||
x = [
|
||||
0.5, 0.5, 0.5,
|
||||
1.5, 1.5, 1.5
|
||||
]
|
||||
types = [1, 1]
|
||||
self.lmp.create_atoms(2, id=None, type=types, x=x)
|
||||
|
||||
self.assertEqual(self.lmp.last_thermo(), None)
|
||||
self.lmp.command("run 2 post no")
|
||||
ref = { "Step" : 2,
|
||||
"Temp" : 0.0,
|
||||
"E_pair" : 0.0,
|
||||
"E_mol" : 0.0,
|
||||
"TotEng" : 0.0,
|
||||
"Press" : 0.0}
|
||||
self.assertDictEqual(self.lmp.last_thermo(), ref)
|
||||
|
||||
def test_extract_global(self):
|
||||
self.lmp.command("region box block -1 1 -2 2 -3 3")
|
||||
self.lmp.command("create_box 1 box")
|
||||
|
||||
@ -82,14 +82,26 @@ class PythonPyLammps(unittest.TestCase):
|
||||
self.pylmp.variable("fx atom fx")
|
||||
self.pylmp.run(10)
|
||||
|
||||
self.assertEqual(len(self.pylmp.runs), 1)
|
||||
self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0])
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2)
|
||||
# thermo data is only captured during a run if PYTHON package is enabled
|
||||
# without it, it will only capture the final thermo at completion
|
||||
if self.pylmp.lmp.has_package("PYTHON"):
|
||||
self.assertEqual(len(self.pylmp.runs), 1)
|
||||
self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0])
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2)
|
||||
else:
|
||||
self.assertEqual(len(self.pylmp.runs), 1)
|
||||
self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0])
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Step), 1)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 1)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 1)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 1)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 1)
|
||||
self.assertEqual(len(self.pylmp.last_run.thermo.Press), 1)
|
||||
|
||||
def test_info_queries(self):
|
||||
self.pylmp.lattice("fcc", 0.8442),
|
||||
|
||||
Reference in New Issue
Block a user