File size: 1,150 Bytes
e59afe6
 
c3e45ae
1effaf5
51638da
52c1bfb
1effaf5
52c1bfb
51638da
1effaf5
 
51638da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1d1ee87
51638da
 
 
 
 
 
 
c3e45ae
 
1effaf5
 
 
 
52c1bfb
51638da
52c1bfb
 
1effaf5
08a88d8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys

import pytest
from ase.build import bulk
from prefect import flow
from prefect.testing.utilities import prefect_test_harness

from mlip_arena.models import MLIPEnum
from mlip_arena.tasks.eos import run as EOS


@flow
def single_eos_flow(calculator_name):
    atoms = bulk("Cu", "fcc", a=3.6)

    return EOS(
        atoms=atoms,
        calculator_name=calculator_name,
        calculator_kwargs={},
        device=None,
        optimizer="BFGSLineSearch",
        optimizer_kwargs=None,
        filter="FrechetCell",
        filter_kwargs=None,
        criterion=dict(
            fmax=0.1,
        ),
        max_abs_strain=0.1,
        npoints=6,
        concurrent=True
    )


@pytest.mark.skipif(
    sys.version_info[:2] != (3, 11),
    reason="avoid prefect race condition on concurrent tasks",
)
@pytest.mark.parametrize("model", [MLIPEnum["MACE-MP(M)"]])
def test_eos(model: MLIPEnum):
    """
    Test EOS prefect workflow with a simple cubic lattice.
    """

    with prefect_test_harness():
        result = single_eos_flow(
            calculator_name=model.name,
        )

        assert isinstance(result["b0"], float)