|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
| 5 | +from pathlib import Path |
| 6 | + |
5 | 7 | from aiida.engine import run_get_node |
6 | 8 | from aiida.orm import load_code |
7 | 9 | from aiida.plugins import CalculationFactory |
8 | 10 |
|
| 11 | +import aiida_mlip |
9 | 12 | from aiida_mlip.data.config import JanusConfigfile |
10 | | -from aiida_mlip.helpers.help_load import load_structure |
| 13 | +from aiida_mlip.helpers.help_load import load_model, load_structure |
| 14 | + |
| 15 | +# __file__ changes depending on where verdi run is called |
| 16 | +DATA_PATH = Path(aiida_mlip.__file__).parent.parent / "tests" / "calculations" |
11 | 17 |
|
12 | 18 | # Add the required inputs for aiida |
13 | 19 | metadata = {"options": {"resources": {"num_machines": 1}}} |
14 | 20 | code = load_code("janus@localhost") |
15 | 21 |
|
16 | 22 | # This structure will overwrite the one in the config file if present |
17 | | -structure = load_structure("../tests/calculations/structures/NaCl.cif") |
| 23 | +structure = load_structure(DATA_PATH / "structures" / "NaCl.cif") |
| 24 | + |
| 25 | +# This model will overwrite the one in the config file if present |
| 26 | +model = load_model( |
| 27 | + model="https://github.com/stfc/janus-core/raw/main/tests/models/mace_mp_small.model", |
| 28 | + architecture="mace_mp", |
| 29 | +) |
18 | 30 |
|
19 | 31 | # All the other paramenters we want them from the config file |
20 | 32 | # We want to pass it as a AiiDA data type for the provenance |
21 | | -config = JanusConfigfile("../tests/calculations/configs/config_janus.yaml") |
| 33 | +config = JanusConfigfile(DATA_PATH / "configs" / "config_janus.yml") |
22 | 34 |
|
23 | 35 | # Define calculation to run |
24 | | -SinglepointCalc = CalculationFactory("mlip.sp") |
| 36 | +SinglePointCalc = CalculationFactory("mlip.sp") |
25 | 37 |
|
26 | 38 | # Run calculation |
27 | 39 | result, node = run_get_node( |
28 | | - SinglepointCalc, |
| 40 | + SinglePointCalc, |
29 | 41 | code=code, |
30 | 42 | struct=structure, |
| 43 | + model=model, |
31 | 44 | metadata=metadata, |
32 | 45 | config=config, |
33 | 46 | ) |
|
0 commit comments