Skip to content

Commit

Permalink
adjust atoms_to_graphs test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonofx committed Aug 6, 2024
1 parent 2a2a3df commit 2f34898
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/core/preprocessing/test_atoms_to_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ase.neighborlist import NeighborList, NewPrimitiveNeighborList

from fairchem.core.preprocessing import AtomsToGraphs

from fairchem.core.modules.evaluator import min_diff

@pytest.fixture(scope="class")
def atoms_to_graphs_internals(request) -> None:
Expand Down Expand Up @@ -110,7 +110,8 @@ def test_convert(self) -> None:
# positions
act_positions = self.atoms.get_positions()
positions = data.pos.numpy()
np.testing.assert_allclose(act_positions, positions)
mindiff = min_diff(act_positions, positions, self.atoms.get_cell(), self.atoms.pbc)
np.testing.assert_allclose(mindiff, 0, atol=1e-6)
# check energy value
act_energy = self.atoms.get_potential_energy(apply_constraint=False)
test_energy = data.energy
Expand Down Expand Up @@ -142,7 +143,8 @@ def test_convert_all(self) -> None:
# positions
act_positions = self.atoms.get_positions()
positions = data_list[0].pos.numpy()
np.testing.assert_allclose(act_positions, positions)
mindiff = min_diff(act_positions, positions, self.atoms.get_cell(), self.atoms.pbc)
np.testing.assert_allclose(mindiff, 0, atol=1e-6)
# check energy value
act_energy = self.atoms.get_potential_energy(apply_constraint=False)
test_energy = data_list[0].energy
Expand Down

0 comments on commit 2f34898

Please sign in to comment.