Skip to content

Commit

Permalink
Merge branch 'lmp_units' of github.com:Yi-FanLi/deepmd-kit into lmp_u…
Browse files Browse the repository at this point in the history
…nits
  • Loading branch information
Yi-FanLi committed Sep 17, 2023
2 parents 29bf465 + 388faee commit 8b53f03
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions source/lmp/tests/test_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ def test_pair_deepmd_real(lammps_real):
lammps_real.pair_style(f"deepmd {pb_file.resolve()}")
lammps_real.pair_coeff("* *")
lammps_real.run(0)
assert lammps_real.eval("pe") == pytest.approx(expected_e * constants.ener_metal2real)
assert lammps_real.eval("pe") == pytest.approx(
expected_e * constants.ener_metal2real
)
for ii in range(6):
assert lammps_real.atoms[ii].force == pytest.approx(
expected_f[lammps_real.atoms[ii].id - 1] * constants.force_metal2real
Expand All @@ -515,7 +517,9 @@ def test_pair_deepmd_virial_real(lammps_real):
"1 all custom 1 dump id " + " ".join([f"v_virial{ii}" for ii in range(9)])
)
lammps_real.run(0)
assert lammps_real.eval("pe") == pytest.approx(expected_e * constants.ener_metal2real)
assert lammps_real.eval("pe") == pytest.approx(
expected_e * constants.ener_metal2real
)
for ii in range(6):
assert lammps_real.atoms[ii].force == pytest.approx(
expected_f[lammps_real.atoms[ii].id - 1] * constants.force_metal2real
Expand All @@ -537,7 +541,9 @@ def test_pair_deepmd_model_devi_real(lammps_real):
)
lammps_real.pair_coeff("* *")
lammps_real.run(0)
assert lammps_real.eval("pe") == pytest.approx(expected_e * constants.ener_metal2real)
assert lammps_real.eval("pe") == pytest.approx(
expected_e * constants.ener_metal2real
)
for ii in range(6):
assert lammps_real.atoms[ii].force == pytest.approx(
expected_f[lammps_real.atoms[ii].id - 1] * constants.force_metal2real
Expand Down Expand Up @@ -574,7 +580,9 @@ def test_pair_deepmd_model_devi_virial_real(lammps_real):
"1 all custom 1 dump id " + " ".join([f"v_virial{ii}" for ii in range(9)])
)
lammps_real.run(0)
assert lammps_real.eval("pe") == pytest.approx(expected_e * constants.ener_metal2real)
assert lammps_real.eval("pe") == pytest.approx(
expected_e * constants.ener_metal2real
)
for ii in range(6):
assert lammps_real.atoms[ii].force == pytest.approx(
expected_f[lammps_real.atoms[ii].id - 1] * constants.force_metal2real
Expand Down Expand Up @@ -615,7 +623,9 @@ def test_pair_deepmd_model_devi_atomic_relative_real(lammps_real):
)
lammps_real.pair_coeff("* *")
lammps_real.run(0)
assert lammps_real.eval("pe") == pytest.approx(expected_e * constants.ener_metal2real)
assert lammps_real.eval("pe") == pytest.approx(
expected_e * constants.ener_metal2real
)
for ii in range(6):
assert lammps_real.atoms[ii].force == pytest.approx(
expected_f[lammps_real.atoms[ii].id - 1] * constants.force_metal2real
Expand Down Expand Up @@ -651,7 +661,9 @@ def test_pair_deepmd_model_devi_atomic_relative_v_real(lammps_real):
)
lammps_real.pair_coeff("* *")
lammps_real.run(0)
assert lammps_real.eval("pe") == pytest.approx(expected_e * constants.ener_metal2real)
assert lammps_real.eval("pe") == pytest.approx(
expected_e * constants.ener_metal2real
)
for ii in range(6):
assert lammps_real.atoms[ii].force == pytest.approx(
expected_f[lammps_real.atoms[ii].id - 1] * constants.force_metal2real
Expand Down

0 comments on commit 8b53f03

Please sign in to comment.