Spaces:
Running
Running
Yuan (Cyrus) Chiang
commited on
Commit
•
b9692e2
1
Parent(s):
8e6b8f4
Add MatterSim (#25)
Browse files* add mattersim diatomic pecs
* change e3nn to 0.5.0 in test
* update model info
* clean notebook
- mlip_arena/models/externals/chgnet.py +1 -1
- mlip_arena/models/externals/mattersim.py +24 -0
- mlip_arena/models/registry.yaml +23 -1
- mlip_arena/tasks/diatomics/alignn/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/chgnet/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/equiformer/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/escn/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/fairchem/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/mace-mp/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/mace-off/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/matgl/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/mattersim/homonuclear-diatomics.json +3 -0
- mlip_arena/tasks/diatomics/orb/homonuclear-diatomics.json +2 -2
- mlip_arena/tasks/diatomics/run.ipynb +0 -0
- mlip_arena/tasks/diatomics/sevennet/homonuclear-diatomics.json +2 -2
- pyproject.toml +2 -1
- serve/ranks/homonuclear-diatomics.py +12 -12
- serve/tasks/homonuclear-diatomics.py +1 -1
- tests/test_external_calculators.py +21 -2
mlip_arena/models/externals/chgnet.py
CHANGED
@@ -18,7 +18,7 @@ class CHGNet(CHGNetCalculator):
|
|
18 |
on_isolated_atoms: Literal["ignore", "warn", "error"] = "warn",
|
19 |
**kwargs,
|
20 |
) -> None:
|
21 |
-
use_device = device or
|
22 |
super().__init__(
|
23 |
model=checkpoint,
|
24 |
use_device=use_device,
|
|
|
18 |
on_isolated_atoms: Literal["ignore", "warn", "error"] = "warn",
|
19 |
**kwargs,
|
20 |
) -> None:
|
21 |
+
use_device = str(device or get_freer_device())
|
22 |
super().__init__(
|
23 |
model=checkpoint,
|
24 |
use_device=use_device,
|
mlip_arena/models/externals/mattersim.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
from pathlib import Path
|
4 |
+
|
5 |
+
import yaml
|
6 |
+
from mattersim.forcefield import MatterSimCalculator
|
7 |
+
|
8 |
+
from mlip_arena.models.utils import get_freer_device
|
9 |
+
|
10 |
+
with open(Path(__file__).parents[1] / "registry.yaml", encoding="utf-8") as f:
|
11 |
+
REGISTRY = yaml.safe_load(f)
|
12 |
+
|
13 |
+
class MatterSim(MatterSimCalculator):
|
14 |
+
def __init__(
|
15 |
+
self,
|
16 |
+
checkpoint=REGISTRY["MatterSim"]["checkpoint"],
|
17 |
+
device=None,
|
18 |
+
**kwargs,
|
19 |
+
):
|
20 |
+
super().__init__(
|
21 |
+
load_path=checkpoint,
|
22 |
+
device=str(device or get_freer_device()),
|
23 |
+
**kwargs
|
24 |
+
)
|
mlip_arena/models/registry.yaml
CHANGED
@@ -67,6 +67,28 @@ M3GNet:
|
|
67 |
npt: true
|
68 |
license: BSD-3-Clause
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
ORB:
|
71 |
module: externals
|
72 |
class: ORB
|
@@ -133,7 +155,7 @@ eqV2(OMat):
|
|
133 |
- homonuclear-diatomics
|
134 |
prediction: EFS
|
135 |
nvt: true
|
136 |
-
npt:
|
137 |
date: 2024-10-18
|
138 |
github: https://github.com/FAIR-Chem/fairchem
|
139 |
doi: https://arxiv.org/abs/2410.12771
|
|
|
67 |
npt: true
|
68 |
license: BSD-3-Clause
|
69 |
|
70 |
+
MatterSim:
|
71 |
+
module: externals
|
72 |
+
class: MatterSim
|
73 |
+
family: mattersim
|
74 |
+
package: mattersim==1.0.0rc9
|
75 |
+
checkpoint: MatterSim-v1.0.0-5M.pth
|
76 |
+
username:
|
77 |
+
last-update: 2024-10-29T00:00:00
|
78 |
+
datetime: 2024-10-29T00:00:00 # TODO: Fake datetime
|
79 |
+
datasets:
|
80 |
+
- MPTrj
|
81 |
+
- Alexandria
|
82 |
+
gpu-tasks:
|
83 |
+
- homonuclear-diatomics
|
84 |
+
github: https://github.com/microsoft/mattersim
|
85 |
+
doi: https://arxiv.org/abs/2405.04967
|
86 |
+
date: 2024-12-05
|
87 |
+
prediction: EFS
|
88 |
+
nvt: true
|
89 |
+
npt: true
|
90 |
+
license: MIT
|
91 |
+
|
92 |
ORB:
|
93 |
module: externals
|
94 |
class: ORB
|
|
|
155 |
- homonuclear-diatomics
|
156 |
prediction: EFS
|
157 |
nvt: true
|
158 |
+
npt: false # https://github.com/FAIR-Chem/fairchem/issues/888, https://github.com/atomind-ai/mlip-arena/issues/17
|
159 |
date: 2024-10-18
|
160 |
github: https://github.com/FAIR-Chem/fairchem
|
161 |
doi: https://arxiv.org/abs/2410.12771
|
mlip_arena/tasks/diatomics/alignn/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:325979c740279016c3652f570b742d0ed28065156e553ae6c878a775951c344b
|
3 |
+
size 2383784
|
mlip_arena/tasks/diatomics/chgnet/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5f3595e1ae02dbc7c30a8ff39227b2a2e46ea940be17e482200f8b3d518cda01
|
3 |
+
size 2003404
|
mlip_arena/tasks/diatomics/equiformer/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d278cac9a2d7ce073735dcf6e2df6637510efcb8d89289706b54e8b540c942ec
|
3 |
+
size 3764511
|
mlip_arena/tasks/diatomics/escn/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2bfb8f0a5424259c9e9686e3e8778adb36e9b08937296e2a127d6007a1adf3bf
|
3 |
+
size 1960063
|
mlip_arena/tasks/diatomics/fairchem/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06fe63898d03644e491ef12e275884c110cf993b8182403408d65fdd23e51816
|
3 |
+
size 2136895
|
mlip_arena/tasks/diatomics/mace-mp/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1f6f4a2d4f36071625db988dde933674cdf5478951cf227e6eacc0d818c13a1f
|
3 |
+
size 1915573
|
mlip_arena/tasks/diatomics/mace-off/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:010d9215f9c1765fd2d807c0ef57a95b14832b6bda841e25948c6ee342232579
|
3 |
+
size 173998
|
mlip_arena/tasks/diatomics/matgl/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:32a7001f8635327e166f7747942ab8fdf4bfb20e68fc632b24005d2017daf5f4
|
3 |
+
size 1858414
|
mlip_arena/tasks/diatomics/mattersim/homonuclear-diatomics.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0181c4173a7ec6cd0ddb469817bc6ff1befec5b9a4a122b5876622ad5006fd49
|
3 |
+
size 1929036
|
mlip_arena/tasks/diatomics/orb/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6799123dc798c713ccd100cec528a71b3e3ec4633de8f92c37c0c2d61b5c7801
|
3 |
+
size 5197473
|
mlip_arena/tasks/diatomics/run.ipynb
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
mlip_arena/tasks/diatomics/sevennet/homonuclear-diatomics.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1cb205f2c271f1799a03ff33ff23e9a1acd9a2d8162d232ba7d3aa59f0a1b30e
|
3 |
+
size 1859865
|
pyproject.toml
CHANGED
@@ -52,7 +52,7 @@ app = [
|
|
52 |
test = [
|
53 |
"torch==2.2.0",
|
54 |
"nvidia-ml-py==12.560.30",
|
55 |
-
"e3nn==0.5.
|
56 |
"matgl==1.1.2",
|
57 |
"dgl==2.4.0",
|
58 |
"chgnet==0.3.8",
|
@@ -61,6 +61,7 @@ test = [
|
|
61 |
"orb-models==0.4.0",
|
62 |
"pynanoflann@git+https://github.com/dwastberg/pynanoflann#egg=af434039ae14bedcbb838a7808924d6689274168",
|
63 |
"alignn==2024.5.27",
|
|
|
64 |
"pytest",
|
65 |
"prefect>=3.0.4,<3.1.0",
|
66 |
]
|
|
|
52 |
test = [
|
53 |
"torch==2.2.0",
|
54 |
"nvidia-ml-py==12.560.30",
|
55 |
+
"e3nn==0.5.0",
|
56 |
"matgl==1.1.2",
|
57 |
"dgl==2.4.0",
|
58 |
"chgnet==0.3.8",
|
|
|
61 |
"orb-models==0.4.0",
|
62 |
"pynanoflann@git+https://github.com/dwastberg/pynanoflann#egg=af434039ae14bedcbb838a7808924d6689274168",
|
63 |
"alignn==2024.5.27",
|
64 |
+
"mattersim==1.0.0rc9",
|
65 |
"pytest",
|
66 |
"prefect>=3.0.4,<3.1.0",
|
67 |
]
|
serve/ranks/homonuclear-diatomics.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
from pathlib import Path
|
2 |
-
from ase.data import chemical_symbols
|
3 |
|
4 |
import numpy as np
|
5 |
import pandas as pd
|
@@ -66,11 +65,12 @@ table.sort_values(
|
|
66 |
)
|
67 |
table["Rank"] += np.argsort(table["Spearman's coeff. (F: descending)"].to_numpy())
|
68 |
|
69 |
-
|
70 |
-
table
|
|
|
71 |
|
72 |
-
table.sort_values("PBE force MAE [eV/Å]", ascending=True, inplace=True)
|
73 |
-
table["Rank"] += np.argsort(table["PBE force MAE [eV/Å]"].to_numpy())
|
74 |
|
75 |
table.sort_values("Tortuosity", ascending=True, inplace=True)
|
76 |
table["Rank"] += np.argsort(table["Tortuosity"].to_numpy())
|
@@ -119,13 +119,13 @@ s = (
|
|
119 |
],
|
120 |
# vmin=-1, vmax=-0.5
|
121 |
)
|
122 |
-
.background_gradient(
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
)
|
129 |
.background_gradient(
|
130 |
cmap="RdPu",
|
131 |
subset=["Tortuosity", "Energy jump [eV]", "Force flips"],
|
|
|
1 |
from pathlib import Path
|
|
|
2 |
|
3 |
import numpy as np
|
4 |
import pandas as pd
|
|
|
65 |
)
|
66 |
table["Rank"] += np.argsort(table["Spearman's coeff. (F: descending)"].to_numpy())
|
67 |
|
68 |
+
# NOTE: it's not fair to models trained on different level of theory
|
69 |
+
# table.sort_values("PBE energy MAE [eV]", ascending=True, inplace=True)
|
70 |
+
# table["Rank"] += np.argsort(table["PBE energy MAE [eV]"].to_numpy())
|
71 |
|
72 |
+
# table.sort_values("PBE force MAE [eV/Å]", ascending=True, inplace=True)
|
73 |
+
# table["Rank"] += np.argsort(table["PBE force MAE [eV/Å]"].to_numpy())
|
74 |
|
75 |
table.sort_values("Tortuosity", ascending=True, inplace=True)
|
76 |
table["Rank"] += np.argsort(table["Tortuosity"].to_numpy())
|
|
|
119 |
],
|
120 |
# vmin=-1, vmax=-0.5
|
121 |
)
|
122 |
+
# .background_gradient(
|
123 |
+
# cmap="Greys",
|
124 |
+
# subset=[
|
125 |
+
# "PBE energy MAE [eV]",
|
126 |
+
# "PBE force MAE [eV/Å]",
|
127 |
+
# ],
|
128 |
+
# )
|
129 |
.background_gradient(
|
130 |
cmap="RdPu",
|
131 |
subset=["Tortuosity", "Energy jump [eV]", "Force flips"],
|
serve/tasks/homonuclear-diatomics.py
CHANGED
@@ -30,7 +30,7 @@ valid_models = [
|
|
30 |
mlip_methods = container.multiselect(
|
31 |
"MLIPs",
|
32 |
valid_models,
|
33 |
-
["MACE-MP(M)", "CHGNet", "M3GNet", "
|
34 |
)
|
35 |
dft_methods = container.multiselect("DFT Methods", ["PBE"], ["PBE"])
|
36 |
|
|
|
30 |
mlip_methods = container.multiselect(
|
31 |
"MLIPs",
|
32 |
valid_models,
|
33 |
+
["MACE-MP(M)", "CHGNet", "M3GNet", "MatterSim", "SevenNet", "ORBv2", "eqV2(OMat)"],
|
34 |
)
|
35 |
dft_methods = container.multiselect("DFT Methods", ["PBE"], ["PBE"])
|
36 |
|
tests/test_external_calculators.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import pytest
|
2 |
from ase import Atoms
|
|
|
|
|
3 |
|
4 |
from mlip_arena.models import MLIPEnum
|
5 |
|
@@ -31,5 +33,22 @@ def test_calculate(model: MLIPEnum):
|
|
31 |
|
32 |
atoms.calc = calc
|
33 |
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import pytest
|
2 |
from ase import Atoms
|
3 |
+
from ase.calculators.calculator import PropertyNotImplementedError
|
4 |
+
import numpy as np
|
5 |
|
6 |
from mlip_arena.models import MLIPEnum
|
7 |
|
|
|
33 |
|
34 |
atoms.calc = calc
|
35 |
|
36 |
+
energy = atoms.get_potential_energy()
|
37 |
+
|
38 |
+
assert isinstance(energy, (float, np.float64, np.float32))
|
39 |
+
|
40 |
+
forces = atoms.get_forces()
|
41 |
+
assert isinstance(forces, (np.ndarray, list))
|
42 |
+
assert len(forces) == len(atoms)
|
43 |
+
|
44 |
+
try:
|
45 |
+
stress = atoms.get_stress()
|
46 |
+
except PropertyNotImplementedError:
|
47 |
+
stress = None
|
48 |
+
|
49 |
+
if stress is None:
|
50 |
+
pytest.xfail("Stress calculation is not supported by the model")
|
51 |
+
else:
|
52 |
+
assert isinstance(stress, (np.ndarray, list))
|
53 |
+
|
54 |
+
|