Skip to content

Commit

Permalink
add mattersim (#37)
Browse files Browse the repository at this point in the history
* add mattersim

* add `mattersim`

* run `mattersim`

* update with `mattersim` command
  • Loading branch information
PythonFZ authored Dec 6, 2024
1 parent 2397d01 commit b2639ef
Show file tree
Hide file tree
Showing 107 changed files with 1,627 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/source/recipes/energy_and_forces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This recipe is used to test the performance of different models in predicting th

.. code-block:: console
(.venv) $ mlipx recipes metrics --models mace_mp,sevennet,orb_v2,chgnet --datapath ../data/DODH_adsorption_dft.xyz --repro
(.venv) $ mlipx recipes metrics --models mace_mp,sevennet,orb_v2,chgnet,mattersim --datapath ../data/DODH_adsorption_dft.xyz --repro
.. mermaid::
:align: center
Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/energy_volume.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Compute the energy-volume curve for a given material using multiple models.

.. code-block:: console
(.venv) $ mlipx recipes ev --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-1143 --repro
(.venv) $ mlipx recipes ev --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-1143 --repro
(.venv) $ mlipx compare --glob "*EnergyVolumeCurve"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/homonuclear_diatomics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Homonuclear diatomics give a per-element information on the performance of the :

.. code-block:: console
(.venv) $ mlipx recipes homonuclear-diatomics --models mace_mp,sevennet,orb_v2 --smiles="[Li+].[Cl-]" --repro
(.venv) $ mlipx recipes homonuclear-diatomics --models mace_mp,sevennet,orb_v2,mattersim --smiles="[Li+].[Cl-]" --repro
You can edit the elements in the :term:`main.py` file to include the elements you want to test.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/invariances.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Check the rotational, translational and permutational invariance of an :term:`ml

.. code-block:: console
(.venv) $ mlipx recipes invariances --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-1143 --repro
(.venv) $ mlipx recipes invariances --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-1143 --repro
(.venv) $ mlipx compare --glob "*TranslationalInvariance"
(.venv) $ mlipx compare --glob "*RotationalInvariance"
(.venv) $ mlipx compare --glob "*PermutationInvariance"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/md.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This recipe is used to test the performance of different models in molecular dyn

.. code-block:: console
(.venv) $ mlipx recipes md --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-1143 --repro
(.venv) $ mlipx recipes md --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-1143 --repro
(.venv) $ mlipx compare --glob "*MolecularDynamics"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/neb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can run the following command to instantiate a test directory:

.. code-block:: console
(.venv) $ mlipx recipes neb --models mace_mp,sevennet,orb_v2,chgnet --datapath ../data/neb_end_p.xyz --repro
(.venv) $ mlipx recipes neb --models mace_mp,sevennet,orb_v2,chgnet,mattersim --datapath ../data/neb_end_p.xyz --repro
(.venv) $ zntrack list # show available Nodes
(.venv) $ mlipx compare --glob "*NEBs"
Expand Down
3 changes: 2 additions & 1 deletion docs/source/recipes/phase_diagram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can run the following command to instantiate a test directory:

.. code-block:: console
(.venv) $ mlipx recipes phase-diagram --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-30084 --repro
(.venv) $ mlipx recipes phase-diagram --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-30084 --repro
(.venv) $ mlipx compare --glob "*PhaseDiagram"
Expand All @@ -20,6 +20,7 @@ You can run the following command to instantiate a test directory:
plots["orb_v2_0-phase-diagram"].show()
plots["sevennet_0-phase-diagram"].show()
plots["chgnet_0-phase-diagram"].show()
plots["mattersim_0-phase-diagram"].show()

This test uses the following Nodes together with your provided model in the :term:`models.py` file:
Expand Down
3 changes: 2 additions & 1 deletion docs/source/recipes/pourbaix_diagram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pourbaix Diagram

.. code-block:: console
(.venv) $ mlipx recipes pourbaix-diagram --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-1143 --repro
(.venv) $ mlipx recipes pourbaix-diagram --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-1143 --repro
(.venv) $ mlipx compare --glob "*PourbaixDiagram"
Expand All @@ -23,6 +23,7 @@ Pourbaix Diagram
plots["orb_v2_0-pourbaix-diagram"].show()
plots["sevennet_0-pourbaix-diagram"].show()
plots["chgnet_0-pourbaix-diagram"].show()
plots["mattersim_0-pourbaix-diagram"].show()
This test uses the following Nodes together with your provided model in the :term:`models.py` file:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/relax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This recipe is used to test the performance of different models in performing st

.. code-block:: console
(.venv) $ mlipx recipes relax --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-1143 --repro
(.venv) $ mlipx recipes relax --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-1143 --repro
(.venv) $ mlipx compare --glob "*StructureOptimization"
.. note::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/recipes/vibrational_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can run the following command to instantiate a test directory:

.. code-block:: console
(.venv) $ mlipx recipes vibrational-analysis --models mace_mp,sevennet,orb_v2 --smiles=CO,CCO,CCCO,CCCCO
(.venv) $ mlipx recipes vibrational-analysis --models mace_mp,sevennet,orb_v2,mattersim --smiles=CO,CCO,CCCO,CCCCO
The vibrational analysis method needs additional information to run.
Please edit the ``main.py`` file and set the ``system`` parameter on the ``VibrationalAnalysis`` node.
Expand Down
2 changes: 1 addition & 1 deletion examples/diatomics/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
mlipx recipes homonuclear-diatomics --models mace_mp,sevennet,orb_v2 --smiles="[Li+].[Cl-]" --repro
mlipx recipes homonuclear-diatomics --models mace_mp,sevennet,orb_v2,mattersim --smiles="[Li+].[Cl-]" --repro
mlipx compare --glob "*HomonuclearDiatomics"
```
34 changes: 34 additions & 0 deletions examples/diatomics/dvc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,37 @@ stages:
hash: md5
md5: f05ba44025dbc070e740fedc0c6d2be2
size: 64
mattersim_HomonuclearDiatomics:
cmd: zntrack run mlipx.nodes.diatomics.HomonuclearDiatomics --name mattersim_HomonuclearDiatomics
deps:
- path: nodes/initialize/Smiles2Conformers/frames.xyz
hash: md5
md5: e5492061936ed82d534cc2d7c62937ea
size: 153
params:
params.yaml:
mattersim_HomonuclearDiatomics:
elements: []
eq_distance: covalent-radiuis
max_distance: 2.0
min_distance: 0.5
model:
_cls: mlipx.nodes.generic_ase.GenericASECalculator
class_name: MatterSimCalculator
device: auto
kwargs:
module: mattersim.forcefield
n_points: 100
outs:
- path: nodes/mattersim/HomonuclearDiatomics/frames.json
hash: md5
md5: f27250c6ea623b2a9a38b92717cd97af
size: 421800
- path: nodes/mattersim/HomonuclearDiatomics/node-meta.json
hash: md5
md5: bc45e1ec53bd983d26b89c74fc127b40
size: 64
- path: nodes/mattersim/HomonuclearDiatomics/results.csv
hash: md5
md5: b70e500ccf4307772b390389fb6e5a1d
size: 5843
12 changes: 12 additions & 0 deletions examples/diatomics/dvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ stages:
- nodes/mace_mp/HomonuclearDiatomics/results.csv
params:
- mace_mp_HomonuclearDiatomics
mattersim_HomonuclearDiatomics:
cmd: zntrack run mlipx.nodes.diatomics.HomonuclearDiatomics --name mattersim_HomonuclearDiatomics
deps:
- nodes/initialize/Smiles2Conformers/frames.xyz
metrics:
- nodes/mattersim/HomonuclearDiatomics/node-meta.json:
cache: false
outs:
- nodes/mattersim/HomonuclearDiatomics/frames.json
- nodes/mattersim/HomonuclearDiatomics/results.csv
params:
- mattersim_HomonuclearDiatomics
orb_v2_HomonuclearDiatomics:
cmd: zntrack run mlipx.nodes.diatomics.HomonuclearDiatomics --name orb_v2_HomonuclearDiatomics
deps:
Expand Down
2 changes: 1 addition & 1 deletion examples/diatomics/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
with project.group(model_name):
neb = mlipx.HomonuclearDiatomics(
elements=[],
data=sum(frames, []),
data=sum(frames, []), # Use all elements from all frames
model=model,
n_points=100,
min_distance=0.5,
Expand Down
8 changes: 8 additions & 0 deletions examples/diatomics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def get_calculator(self, **kwargs):
MODELS["orb_v2"] = OrbCalc(name="orb_v2", device="auto")


# https://github.com/CederGroupHub/chgnet
MODELS["mattersim"] = mlipx.GenericASECalculator(
module="mattersim.forcefield",
class_name="MatterSimCalculator",
device="auto",
)


# OPTIONAL
# ========
# If you have custom property names you can use the UpdatedFramesCalc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/frames.json
/results.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"uuid": "c5addb02-3509-4d8c-a32a-b2908b12a680", "run_count": 1}
12 changes: 12 additions & 0 deletions examples/diatomics/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ mace_mp_HomonuclearDiatomics:
model: medium
module: mace.calculators
n_points: 100
mattersim_HomonuclearDiatomics:
elements: []
eq_distance: covalent-radiuis
max_distance: 2.0
min_distance: 0.5
model:
_cls: mlipx.nodes.generic_ase.GenericASECalculator
class_name: MatterSimCalculator
device: auto
kwargs: null
module: mattersim.forcefield
n_points: 100
orb_v2_HomonuclearDiatomics:
elements: []
eq_distance: covalent-radiuis
Expand Down
30 changes: 30 additions & 0 deletions examples/diatomics/zntrack.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,35 @@
"item": null
}
}
},
"mattersim_HomonuclearDiatomics": {
"nwd": {
"_type": "pathlib.Path",
"value": "nodes/mattersim/HomonuclearDiatomics"
},
"model": {
"_type": "@dataclasses.dataclass",
"value": {
"module": "mlipx.nodes.generic_ase",
"cls": "GenericASECalculator"
}
},
"data": {
"_type": "znflow.Connection",
"value": {
"instance": {
"_type": "zntrack.Node",
"value": {
"module": "mlipx.nodes.smiles",
"name": "initialize_Smiles2Conformers",
"cls": "Smiles2Conformers",
"remote": null,
"rev": null
}
},
"attribute": "frames",
"item": null
}
}
}
}
2 changes: 1 addition & 1 deletion examples/energy-volume/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
mlipx recipes ev --models mace_mp,sevennet,orb_v2,chgnet --material-ids=mp-1143 --repro
mlipx recipes ev --models mace_mp,sevennet,orb_v2,chgnet,mattersim --material-ids=mp-1143 --repro
mlipx compare --glob "*EnergyVolumeCurve"
```
33 changes: 33 additions & 0 deletions examples/energy-volume/dvc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,36 @@ stages:
hash: md5
md5: fa8b44ba9924d82a0487acc3e2f55a68
size: 3509
mattersim_0_EnergyVolumeCurve:
cmd: zntrack run mlipx.nodes.energy_volume.EnergyVolumeCurve --name mattersim_0_EnergyVolumeCurve
deps:
- path: nodes/initialize/MPRester/frames.xyz
hash: md5
md5: b2aa0fb43e0b26ef88bedc082a0a2325
size: 866
params:
params.yaml:
mattersim_0_EnergyVolumeCurve:
data_id: -1
model:
_cls: mlipx.nodes.generic_ase.GenericASECalculator
class_name: MatterSimCalculator
device: auto
kwargs:
module: mattersim.forcefield
n_points: 50
start: 0.8
stop: 2.0
outs:
- path: nodes/mattersim/0/EnergyVolumeCurve/frames.xyz
hash: md5
md5: 0ad32e40ec27684ee853591e273982f2
size: 86946
- path: nodes/mattersim/0/EnergyVolumeCurve/node-meta.json
hash: md5
md5: 92019096017c6c38d3633632cb0942fc
size: 64
- path: nodes/mattersim/0/EnergyVolumeCurve/results.csv
hash: md5
md5: 1756b0048cae0710eaac8db037e20f6f
size: 3057
17 changes: 17 additions & 0 deletions examples/energy-volume/dvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ plots:
nodes/chgnet/0/EnergyVolumeCurve/results.csv: scale
y:
nodes/chgnet/0/EnergyVolumeCurve/results.csv: energy
- mattersim_0_EnergyVolumeCurve_results:
x:
nodes/mattersim/0/EnergyVolumeCurve/results.csv: scale
y:
nodes/mattersim/0/EnergyVolumeCurve/results.csv: energy
stages:
chgnet_0_EnergyVolumeCurve:
cmd: zntrack run mlipx.nodes.energy_volume.EnergyVolumeCurve --name chgnet_0_EnergyVolumeCurve
Expand Down Expand Up @@ -53,6 +58,18 @@ stages:
- nodes/mace_mp/0/EnergyVolumeCurve/results.csv
params:
- mace_mp_0_EnergyVolumeCurve
mattersim_0_EnergyVolumeCurve:
cmd: zntrack run mlipx.nodes.energy_volume.EnergyVolumeCurve --name mattersim_0_EnergyVolumeCurve
deps:
- nodes/initialize/MPRester/frames.xyz
metrics:
- nodes/mattersim/0/EnergyVolumeCurve/node-meta.json:
cache: false
outs:
- nodes/mattersim/0/EnergyVolumeCurve/frames.xyz
- nodes/mattersim/0/EnergyVolumeCurve/results.csv
params:
- mattersim_0_EnergyVolumeCurve
orb_v2_0_EnergyVolumeCurve:
cmd: zntrack run mlipx.nodes.energy_volume.EnergyVolumeCurve --name orb_v2_0_EnergyVolumeCurve
deps:
Expand Down
8 changes: 8 additions & 0 deletions examples/energy-volume/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ def get_calculator(self, **kwargs):
)


# https://github.com/CederGroupHub/chgnet
MODELS["mattersim"] = mlipx.GenericASECalculator(
module="mattersim.forcefield",
class_name="MatterSimCalculator",
device="auto",
)


# OPTIONAL
# ========
# If you have custom property names you can use the UpdatedFramesCalc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/frames.xyz
/results.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"uuid": "b95d21a6-afe7-453b-aa44-12f636199ded", "run_count": 1}
11 changes: 11 additions & 0 deletions examples/energy-volume/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ mace_mp_0_EnergyVolumeCurve:
n_points: 50
start: 0.8
stop: 2.0
mattersim_0_EnergyVolumeCurve:
data_id: -1
model:
_cls: mlipx.nodes.generic_ase.GenericASECalculator
class_name: MatterSimCalculator
device: auto
kwargs: null
module: mattersim.forcefield
n_points: 50
start: 0.8
stop: 2.0
orb_v2_0_EnergyVolumeCurve:
data_id: -1
model:
Expand Down
Loading

0 comments on commit b2639ef

Please sign in to comment.