Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Apr 23, 2024
1 parent d6a4531 commit bb41b15
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_ase_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def test_static(self):
)
lmp.interactive_lib_command("pair_style lj/cut 6.0")
lmp.interactive_lib_command("pair_coeff 1 1 1.0 1.0 4.04")
lmp.interactive_lib_command(command="thermo_style custom step temp pe etotal pxx pxy pxz pyy pyz pzz vol")
lmp.interactive_lib_command(command="thermo_modify format float %20.15g")
lmp.interactive_lib_command("run 0")
self.assertTrue(np.all(np.isclose(lmp.interactive_cells_getter(), structure.cell.array)))
self.assertTrue(np.isclose(lmp.interactive_energy_pot_getter(), -0.04342932384411341))
Expand All @@ -41,17 +43,18 @@ def test_static(self):
self.assertTrue(np.all(lmp.interactive_indices_getter() == [1] * len(structure)))
self.assertEqual(lmp.interactive_steps_getter(), 0)
self.assertEqual(lmp.interactive_temperatures_getter(), 0)
self.assertTrue(np.isclose(np.sum(lmp.interactive_pressures_getter()), -0.015661731917941832))
lmp.close()

def test_static_with_statement(self):
structure = bulk("Al").repeat([2, 2, 2])
with LammpsASELibrary(
working_directory=None,
cores=1,
cores=2,
comm=None,
logger=None,
log_file=None,
library=LammpsLibrary(cores=2, mode='local'),
library=None,
diable_log_file=True,
) as lmp:
lmp.interactive_lib_command(command="units lj")
Expand All @@ -68,6 +71,8 @@ def test_static_with_statement(self):
)
lmp.interactive_lib_command("pair_style lj/cut 6.0")
lmp.interactive_lib_command("pair_coeff 1 1 1.0 1.0 4.04")
lmp.interactive_lib_command(command="thermo_style custom step temp pe etotal pxx pxy pxz pyy pyz pzz vol")
lmp.interactive_lib_command(command="thermo_modify format float %20.15g")
lmp.interactive_lib_command("run 0")
self.assertTrue(np.isclose(lmp.interactive_energy_pot_getter(), -0.3083820387630098))
self.assertTrue(np.isclose(lmp.interactive_energy_tot_getter(), -0.3083820387630098))
Expand All @@ -76,3 +81,4 @@ def test_static_with_statement(self):
self.assertTrue(np.all(lmp.interactive_indices_getter() == [1] * len(structure)))
self.assertEqual(lmp.interactive_steps_getter(), 0)
self.assertEqual(lmp.interactive_temperatures_getter(), 0)
self.assertTrue(np.isclose(np.sum(lmp.interactive_pressures_getter()), -0.00937227406237915))

0 comments on commit bb41b15

Please sign in to comment.