Skip to content

Commit

Permalink
Add test for Rascal backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Dec 11, 2024
1 parent cc7e340 commit e0c18b3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

from emle._backends import *

try:
import rascal

has_rascal = True
except ImportError:
has_rascal = False


@pytest.fixture(scope="module")
def data():
Expand Down Expand Up @@ -122,3 +129,27 @@ def test_deepmd(data):
# Make sure the deviation is calculated.
with open(tmp.name, "r") as f:
deviation = float(f.read())


@pytest.mark.xfail(reason="Model file is currently corrupted.")
@pytest.mark.skipif(not has_rascal, reason="Rascal not installed.")
@pytest.mark.skipif(
socket.gethostname() != "porridge",
reason="Local test requiring a Rascal model file.",
)
def test_rascal(data):
"""
Test the Rascal backend.
"""

# Set up the data.
atomic_numbers, xyz = data

model = "tests/input/rascal/deltaL.sav"

with tempfile.NamedTemporaryFile() as tmp:
# Instantiate the Rascal backend.
backend = Rascal(model)

# Calculate the energy and forces.
energy, forces = backend(atomic_numbers, xyz)

0 comments on commit e0c18b3

Please sign in to comment.