Skip to content

Commit

Permalink
Update ALIGNN testing (stfc#282)
Browse files Browse the repository at this point in the history
* Reduce downloads of ALIGNN

* Add pytest skip if BadZipFile
  • Loading branch information
ElliottKasoar authored Aug 16, 2024
1 parent e0de4a6 commit 6eafa4f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
16 changes: 10 additions & 6 deletions tests/test_mlip_calculators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test configuration of MLIP calculators."""

from pathlib import Path
from zipfile import BadZipFile

from chgnet.model.model import CHGNet
from matgl import load_model
Expand Down Expand Up @@ -119,12 +120,15 @@ def test_invalid_device(arch):
)
def test_extra_mlips(arch, device, kwargs):
"""Test extra MLIPs (alignn) can be configured."""
calculator = choose_calculator(
arch=arch,
device=device,
**kwargs,
)
assert calculator.parameters["version"] is not None
try:
calculator = choose_calculator(
arch=arch,
device=device,
**kwargs,
)
assert calculator.parameters["version"] is not None
except BadZipFile:
pytest.skip()


@pytest.mark.extra_mlips
Expand Down
8 changes: 7 additions & 1 deletion tests/test_single_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

MACE_PATH = MODEL_PATH / "mace_mp_small.model"
SEVENNET_PATH = MODEL_PATH / "sevennet_0.pth"
ALIGNN_PATH = MODEL_PATH / "v5.27.2024"

test_data = [
(DATA_PATH / "benzene.xyz", -76.0605725422795, "energy", "energy", {}, None),
Expand Down Expand Up @@ -270,7 +271,12 @@ def test_mlips(arch, device, expected_energy):


test_extra_mlips_data = [
("alignn", "cpu", -11.148092269897461, {}),
(
"alignn",
"cpu",
-11.148092269897461,
{"model_path": ALIGNN_PATH / "best_model.pt"},
),
("sevennet", "cpu", -27.061979293823242, {"model_path": SEVENNET_PATH}),
("sevennet", "cpu", -27.061979293823242, {}),
("sevennet", "cpu", -27.061979293823242, {"model_path": "SevenNet-0_11July2024"}),
Expand Down

0 comments on commit 6eafa4f

Please sign in to comment.