Spaces:
Running
Running
test md
Browse files- mlip_arena/tasks/md.py +5 -4
- tests/test_eos.py +0 -5
- tests/test_md.py +25 -0
mlip_arena/tasks/md.py
CHANGED
@@ -196,10 +196,10 @@ def run(
|
|
196 |
device: str | None = None,
|
197 |
ensemble: Literal["nve", "nvt", "npt"] = "nvt",
|
198 |
dynamics: str | MolecularDynamics = "langevin",
|
199 |
-
time_step: float | None = None,
|
200 |
-
total_time: float = 1000,
|
201 |
-
temperature: float | Sequence | np.ndarray | None = 300.0,
|
202 |
-
pressure: float | Sequence | np.ndarray | None = None,
|
203 |
ase_md_kwargs: dict | None = None,
|
204 |
md_velocity_seed: int | None = None,
|
205 |
zero_linear_momentum: bool = True,
|
@@ -363,6 +363,7 @@ def run(
|
|
363 |
md_runner.run(steps=n_steps)
|
364 |
end_time = datetime.now()
|
365 |
|
|
|
366 |
traj.close()
|
367 |
|
368 |
return {
|
|
|
196 |
device: str | None = None,
|
197 |
ensemble: Literal["nve", "nvt", "npt"] = "nvt",
|
198 |
dynamics: str | MolecularDynamics = "langevin",
|
199 |
+
time_step: float | None = None, # fs
|
200 |
+
total_time: float = 1000, # fs
|
201 |
+
temperature: float | Sequence | np.ndarray | None = 300.0, # K
|
202 |
+
pressure: float | Sequence | np.ndarray | None = None, # eV/A^3
|
203 |
ase_md_kwargs: dict | None = None,
|
204 |
md_velocity_seed: int | None = None,
|
205 |
zero_linear_momentum: bool = True,
|
|
|
363 |
md_runner.run(steps=n_steps)
|
364 |
end_time = datetime.now()
|
365 |
|
366 |
+
if traj_file is not None:
|
367 |
traj.close()
|
368 |
|
369 |
return {
|
tests/test_eos.py
CHANGED
@@ -9,11 +9,6 @@ from mlip_arena.tasks.eos.run import fit as EOS
|
|
9 |
|
10 |
atoms = bulk("Cu", "fcc", a=3.6)
|
11 |
|
12 |
-
# @pytest.fixture(autouse=True, scope="session")
|
13 |
-
# def prefect_test_fixture():
|
14 |
-
# with prefect_test_harness():
|
15 |
-
# yield
|
16 |
-
|
17 |
@pytest.mark.skipif(sys.version_info[:2] != (3,11), reason="avoid prefect race condition on concurrent tasks")
|
18 |
@pytest.mark.parametrize("model", [MLIPEnum["MACE-MP(M)"]])
|
19 |
def test_eos(model: MLIPEnum):
|
|
|
9 |
|
10 |
atoms = bulk("Cu", "fcc", a=3.6)
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
@pytest.mark.skipif(sys.version_info[:2] != (3,11), reason="avoid prefect race condition on concurrent tasks")
|
13 |
@pytest.mark.parametrize("model", [MLIPEnum["MACE-MP(M)"]])
|
14 |
def test_eos(model: MLIPEnum):
|
tests/test_md.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import sys
|
3 |
+
|
4 |
+
import pytest
|
5 |
+
from ase.build import bulk
|
6 |
+
|
7 |
+
from mlip_arena.models import MLIPEnum
|
8 |
+
from mlip_arena.tasks.md import run as MD
|
9 |
+
|
10 |
+
atoms = bulk("Cu", "fcc", a=3.6)
|
11 |
+
|
12 |
+
@pytest.mark.skipif(sys.version_info[:2] != (3,11), reason="avoid prefect race condition on concurrent tasks")
|
13 |
+
@pytest.mark.parametrize("model", [MLIPEnum["MACE-MP(M)"]])
|
14 |
+
def test_nve(model: MLIPEnum):
|
15 |
+
|
16 |
+
result = MD.fn(
|
17 |
+
atoms,
|
18 |
+
calculator_name=model.name,
|
19 |
+
calculator_kwargs={},
|
20 |
+
ensemble="nve",
|
21 |
+
dynamics="velocityverlet",
|
22 |
+
total_time=3,
|
23 |
+
)
|
24 |
+
|
25 |
+
assert isinstance(result["atoms"].get_potential_energy(), float)
|