Skip to content

Commit

Permalink
fix test_relax_chgnet
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Oct 23, 2023
1 parent 623dda3 commit 857bb57
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/core/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,12 @@ def test_relax_chgnet(self):
struct_copy = self.cu_structure.copy()
relaxed = self.cu_structure.relax(calculator="chgnet")
assert relaxed != self.cu_structure
assert relaxed.calc.results["energy"] == approx(-5.27792501, abs=1e-5)
assert relaxed.calc.results["free_energy"] == approx(-5.27792501, abs=1e-5)
assert relaxed.volume == approx(45.870906121, abs=1e-4)
assert relaxed.calc.results["energy"] == approx(-6.01778554, abs=1e-5)
assert relaxed.calc.results["free_energy"] == approx(-6.01778554, abs=1e-5)
assert relaxed.volume == approx(39.26840199, abs=1e-4)
assert relaxed.calc.parameters == {}
assert self.cu_structure == struct_copy, "original structure was modified"
assert relaxed.volume > self.cu_structure.volume
assert relaxed.volume < self.cu_structure.volume

# test custom params
custom_relaxed = self.cu_structure.relax(
Expand All @@ -1491,9 +1491,9 @@ def test_relax_chgnet(self):
stress_weight=0.1,
)
assert custom_relaxed != self.cu_structure
assert custom_relaxed.calc.results.get("energy") == approx(-5.2197213172, abs=1e-5)
assert custom_relaxed.volume == approx(40.044794644, abs=1e-4)
assert custom_relaxed.volume < relaxed.volume
assert custom_relaxed.calc.results.get("energy") == approx(-6.0151076, abs=1e-5)
assert custom_relaxed.volume == approx(40.044794644, abs=1e-3)
assert custom_relaxed.volume > relaxed.volume

def test_calculate_chgnet(self):
pytest.importorskip("chgnet")
Expand Down

0 comments on commit 857bb57

Please sign in to comment.