From 85ffe98f7fdf85c02c556a8deb8ab962f14cca5e Mon Sep 17 00:00:00 2001 From: lbluque Date: Wed, 24 Sep 2025 11:54:41 -0700 Subject: [PATCH 1/3] add omat24 input sets --- src/fairchem/data/omat/README.md | 47 +++++++ src/fairchem/data/omat/__init__.py | 0 .../data/omat/vasp/OMat24StaticSet.yaml | 110 ++++++++++++++++ src/fairchem/data/omat/vasp/PBE54Base.yaml | 91 ++++++++++++++ src/fairchem/data/omat/vasp/__init__.py | 0 src/fairchem/data/omat/vasp/sets.py | 118 ++++++++++++++++++ 6 files changed, 366 insertions(+) create mode 100644 src/fairchem/data/omat/README.md create mode 100644 src/fairchem/data/omat/__init__.py create mode 100644 src/fairchem/data/omat/vasp/OMat24StaticSet.yaml create mode 100644 src/fairchem/data/omat/vasp/PBE54Base.yaml create mode 100644 src/fairchem/data/omat/vasp/__init__.py create mode 100644 src/fairchem/data/omat/vasp/sets.py diff --git a/src/fairchem/data/omat/README.md b/src/fairchem/data/omat/README.md new file mode 100644 index 0000000000..7d2bad6ebf --- /dev/null +++ b/src/fairchem/data/omat/README.md @@ -0,0 +1,47 @@ +# OMat24 Dataset + +The OMat24 dataset is available for download from [this](https://huggingface.co/datasets/facebook/OMAT24) HuggingFace repo. + +Pretrained eqV2 and eSEN models can be downloaded from HuggingFace [here](https://huggingface.co/facebook/OMAT24) and +UMA models [here](https://huggingface.co/facebook/UMA). + +The VASP sets used to generate OMat24 data are implemented as `pymatgen` `VaspInputSets` in the package. You can +generate OMat24 VASP inputs as follows, + +```python +from pymatgen.core import Structure, Lattice +from fairchem.data.omat.vasp.sets import OMat24StaticSet + +lattice = Lattice.cubic(3.615) + +structure = Structure.from_spacegroup( + "Fm-3m", species=["Cu"], coords=[[0, 0, 0]], lattice=lattice +) + +input_set = OMat24StaticSet(structure) +input_set.write_input("path/to/input-dir") +``` + +## Citing + +If you use the OMat24 dataset or pretrained models in your work, consider citing the following, + +```bibtex +@article{barroso_omat24, + title={Open Materials 2024 (OMat24) Inorganic Materials Dataset and Models}, + author={Barroso-Luque, Luis and Muhammed, Shuaibi and Fu, Xiang and Wood, Brandon, Dzamba, Misko, and Gao, Meng and Rizvi, Ammar and Zitnick, C. Lawrence and Ulissi, Zachary W.}, + journal={arXiv preprint arXiv:2410.12771}, + year={2024} +} +@article{schmidt_2023_machine, + title={Machine-Learning-Assisted Determination of the Global Zero-Temperature Phase Diagram of Materials}, + author={Schmidt, Jonathan and Hoffmann, Noah and Wang, Hai-Chen and Borlido, Pedro and Carri{\c{c}}o, Pedro JMA and Cerqueira, Tiago FT and Botti, Silvana and Marques, Miguel AL}, + journal={Advanced Materials}, + volume={35}, + number={22}, + pages={2210788}, + year={2023}, + url={https://onlinelibrary.wiley.com/doi/full/10.1002/adma.202210788}, + publisher={Wiley Online Library} +} +``` diff --git a/src/fairchem/data/omat/__init__.py b/src/fairchem/data/omat/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml b/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml new file mode 100644 index 0000000000..c69f3f3cd1 --- /dev/null +++ b/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml @@ -0,0 +1,110 @@ +# OMat24 VASP input settings +PARENT: PBE54Base +INCAR: + ALGO: NORMAL + EDIFF_PER_ATOM: 5.0e-05 + ENCUT: 520 + IBRION: 2 + ISIF: 3 + ISMEAR: -5 + ISPIN: 2 + LASPH: true + LDAU: true + LDAUJ: + F: + Co: 0 + Cr: 0 + Fe: 0 + Mn: 0 + Mo: 0 + Ni: 0 + V: 0 + W: 0 + O: + Co: 0 + Cr: 0 + Fe: 0 + Mn: 0 + Mo: 0 + Ni: 0 + V: 0 + W: 0 + LDAUL: + F: + Co: 2 + Cr: 2 + Fe: 2 + Mn: 2 + Mo: 2 + Ni: 2 + V: 2 + W: 2 + O: + Co: 2 + Cr: 2 + Fe: 2 + Mn: 2 + Mo: 2 + Ni: 2 + V: 2 + W: 2 + LDAUTYPE: 2 + LDAUU: + F: + Co: 3.32 + Cr: 3.7 + Fe: 5.3 + Mn: 3.9 + Mo: 4.38 + Ni: 6.2 + V: 3.25 + W: 6.2 + O: + Co: 3.32 + Cr: 3.7 + Fe: 5.3 + Mn: 3.9 + Mo: 4.38 + Ni: 6.2 + V: 3.25 + W: 6.2 + MAGMOM: + Ce: 5 + Ce3+: 1 + Co: 0.6 + Co3+: 0.6 + Co4+: 1 + Cr: 5 + Dy3+: 5 + Er3+: 3 + Eu: 10 + Eu2+: 7 + Eu3+: 6 + Fe: 5 + Gd3+: 7 + Ho3+: 4 + La3+: 0.6 + Lu3+: 0.6 + Mn: 5 + Mn3+: 4 + Mn4+: 3 + Mo: 5 + Nd3+: 3 + Ni: 5 + Pm3+: 4 + Pr3+: 2 + Sm3+: 5 + Tb3+: 6 + Tm3+: 2 + V: 5 + W: 5 + Yb3+: 1 + LDAUPRINT: 1 + LORBIT: 11 + LREAL: AUTO + LWAVE: false + NELM: 100 + PREC: Accurate + SIGMA: 0.05 +KPOINTS: + reciprocal_density: 64 diff --git a/src/fairchem/data/omat/vasp/PBE54Base.yaml b/src/fairchem/data/omat/vasp/PBE54Base.yaml new file mode 100644 index 0000000000..504a655337 --- /dev/null +++ b/src/fairchem/data/omat/vasp/PBE54Base.yaml @@ -0,0 +1,91 @@ +POTCAR_FUNCTIONAL: PBE_54 +POTCAR: + Ac: Ac + Ag: Ag + Al: Al + Ar: Ar + As: As + Au: Au + B: B + Ba: Ba_sv + Be: Be_sv + Bi: Bi + Br: Br + C: C + Ca: Ca_sv + Cd: Cd + Ce: Ce + Cl: Cl + Co: Co + Cr: Cr_pv + Cs: Cs_sv + Cu: Cu_pv + Dy: Dy_3 + Er: Er_3 + Eu: Eu + F: F + Fe: Fe_pv + Ga: Ga_d + Gd: Gd + Ge: Ge_d + H: H + He: He + Hf: Hf_pv + Hg: Hg + Ho: Ho_3 + I: I + In: In_d + Ir: Ir + K: K_sv + Kr: Kr + La: La + Li: Li_sv + Lu: Lu_3 + Mg: Mg_pv + Mn: Mn_pv + Mo: Mo_pv + N: N + Na: Na_pv + Nb: Nb_pv + Nd: Nd_3 + Ne: Ne + Ni: Ni_pv + Np: Np + O: O + Os: Os_pv + P: P + Pa: Pa + Pb: Pb_d + Pd: Pd + Pm: Pm_3 + Pr: Pr_3 + Pt: Pt + Pu: Pu + Rb: Rb_sv + Re: Re_pv + Rh: Rh_pv + Ru: Ru_pv + S: S + Sb: Sb + Sc: Sc_sv + Se: Se + Si: Si + Sm: Sm_3 + Sn: Sn_d + Sr: Sr_sv + Ta: Ta_pv + Tb: Tb_3 + Tc: Tc_pv + Te: Te + Th: Th + Ti: Ti_pv + Tl: Tl_d + Tm: Tm_3 + U: U + V: V_pv + W: W_sv # https://github.com/materialsproject/pymatgen/issues/3016 + Xe: Xe + Y: Y_sv + Yb: Yb_3 # https://github.com/materialsproject/pymatgen/blob/d1361099331ba6c5217cbfc5a17c77dcdf4918a9/pymatgen/io/vasp/MPRelaxSet.yaml#L171 + Zn: Zn + Zr: Zr_sv diff --git a/src/fairchem/data/omat/vasp/__init__.py b/src/fairchem/data/omat/vasp/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/fairchem/data/omat/vasp/sets.py b/src/fairchem/data/omat/vasp/sets.py new file mode 100644 index 0000000000..a0dcd11213 --- /dev/null +++ b/src/fairchem/data/omat/vasp/sets.py @@ -0,0 +1,118 @@ +""" +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the root directory of this source tree. +""" + +from __future__ import annotations + +import os +from dataclasses import dataclass +from typing import Any, Literal + +from pymatgen.io.vasp import Kpoints, sets +from pymatgen.io.vasp.sets import VaspInputSet + +sets.MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) + + +@dataclass +class OMat24StaticSet(VaspInputSet): + """Create input files for a OMat24 PBE static calculation. + The default POTCAR versions used are PBE_54 + + Args: + structure (Structure): The Structure to create inputs for. If None, the input + set is initialized without a Structure but one must be set separately before + the inputs are generated. + **kwargs: Keywords supported by VaspInputSet. + """ + + CONFIG = sets._load_yaml_config("OMat24StaticSet") + + +@dataclass +class OMat24RelaxSet(OMat24StaticSet): + """Create input files for a OMat24 PBE relaxation calculation. + + Args: + structure (Structure): The Structure to create inputs for. If None, the input + set is initialized without a Structure but one must be set separately before + the inputs are generated. + **kwargs: Keywords supported by VaspInputSet. + """ + + @property + def incar_updates(self) -> dict[str, str | int]: + updates = { + "IBRION": 2, + "NSW": 99, + "ISIF": 3, + } + return updates + + +@dataclass +class OMat24AIMDSet(VaspInputSet): + """Create input files for a OMat24 PBE static calculation. + The default POTCAR versions used are PBE_54 + + Args: + structure (Structure): The Structure to create inputs for. If None, the input + set is initialized without a Structure but one must be set separately before + the inputs are generated. + **kwargs: Keywords supported by VaspInputSet. + """ + + start_temperature: float = 1000 + end_temperature: float = 1000 + ensemble: Literal["nvt", "npt"] = "nvt" + thermostat: Literal["nose", "langevin"] = "nose" + steps: int = 100 + time_step: float = 2.0 + pressure: float | None = None # pressure in kB + + @property + def incar_updates(self) -> dict[str, Any]: + """Updates to the INCAR config for this calculation type.""" + + updates = { + "TEBEG": self.start_temperature, + "TEEND": self.end_temperature, + "NSW": self.steps, + "POTIM": self.time_step, + "IBRION": 0, + "LREAL": True, + "ISYM": 0, + } + + if self.thermostat == "langevin": + updates |= { + "MDALGO": 3, + "LANGEVIN_GAMMA": [10] * self.structure.n_elems, + } + elif self.thermostat == "nose": + updates |= {"MDALGO": 2, "SMASS": 0} + else: + raise ValueError(f"{self.thermostat} not a valid thermostat.") + + if self.ensemble == "nvt": + updates |= {"ISIF": 0} + elif self.ensemble == "npt": + if self.thermostat != "langevin": + raise ValueError( + "langevin thermostat needs to be used for an npt ensemble." + ) + updates |= {"ISIF": 3} + if self.pressure is not None: + updates |= {"PSTRESS": self.pressure} + else: + raise ValueError(f"{self.ensemble} is not a valid ensemble choice!") + + return updates + + @property + def kpoints_updates(self) -> Kpoints: + """Updates to the kpoints configuration for this calculation type.""" + return Kpoints.gamma_automatic() From 30edb8ee9d2e53598b3d82c4e290e866bc2747ad Mon Sep 17 00:00:00 2001 From: lbluque Date: Wed, 24 Sep 2025 12:02:53 -0700 Subject: [PATCH 2/3] add package files --- .github/release-drafter-data-omat.yml | 37 ++++++++++++++++++ .github/workflows/build.yml | 14 +++++-- .../workflows/release-drafter-data-omat.yml | 28 +++++++++++++ packages/fairchem-data-omat/pyproject.toml | 39 +++++++++++++++++++ packages/fairchem-data-omat/src | 1 + src/fairchem/data/omat/README.md | 2 +- 6 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 .github/release-drafter-data-omat.yml create mode 100644 .github/workflows/release-drafter-data-omat.yml create mode 100644 packages/fairchem-data-omat/pyproject.toml create mode 120000 packages/fairchem-data-omat/src diff --git a/.github/release-drafter-data-omat.yml b/.github/release-drafter-data-omat.yml new file mode 100644 index 0000000000..5d749bb844 --- /dev/null +++ b/.github/release-drafter-data-omat.yml @@ -0,0 +1,37 @@ +include-paths: + - src/fairchem/data/omat + - packages/fairchem-data-omat +tag-prefix: fairchem_data_omat +tag-template: 'fairchem_data_omat-$RESOLVED_VERSION' +name-template: 'fairchem_data_omat-$RESOLVED_VERSION' +exclude-contributors: [github-actions] +categories: + - title: New Features / Enhancements + labels: [enhancement] + - title: Bug Fixes + labels: [bug] + - title: Documentation + labels: [documentation] + - title: Tests + labels: [test] + - title: Deprecations + labels: [deprecation] + - title: Dependencies + labels: [dependencies] + - title: Other Changes + labels: ["*"] +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## What’s Changed + + $CHANGES diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de48025132..c4c857187b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - name: Build run: | # add packages that are supposed to be built to this list - for package in fairchem-core fairchem-data-oc fairchem-demo-ocpapi fairchem-applications-cattsunami fairchem-data-omol fairchem-lammps + for package in fairchem-core fairchem-data-oc fairchem-demo-ocpapi fairchem-applications-cattsunami fairchem-data-omol fairchem-data-omat fairchem-lammps do pushd packages/$package hatch build @@ -59,11 +59,17 @@ jobs: name: dist-applications-cattsunami path: dist-applications-cattsunami/* - - name: Upload data-omol artifact + - name: Upload lammps artifact + uses: actions/upload-artifact@v4 + with: + name: dist-lammps + path: dist-lammps/* + + - name: Upload lammps artifact uses: actions/upload-artifact@v4 with: - name: dist-data-omol - path: dist-data-omol/* + name: dist-omat + path: dist-omat/* - name: Upload lammps artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release-drafter-data-omat.yml b/.github/workflows/release-drafter-data-omat.yml new file mode 100644 index 0000000000..1f84792086 --- /dev/null +++ b/.github/workflows/release-drafter-data-omat.yml @@ -0,0 +1,28 @@ +name: Release Drafter - fairchem-data-omat + +on: + push: + branches: + - main + paths: + - 'src/fairchem/data/omat/**' + - 'packages/fairchem-data-omat/**' + workflow_dispatch: + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + pull-requests: read + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v6 + with: + disable-autolabeler: true + config-name: release-drafter-data-omat.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/fairchem-data-omat/pyproject.toml b/packages/fairchem-data-omat/pyproject.toml new file mode 100644 index 0000000000..60909cf8fb --- /dev/null +++ b/packages/fairchem-data-omat/pyproject.toml @@ -0,0 +1,39 @@ +[build-system] +requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme>=24"] +build-backend = "hatchling.build" + +[project] +name = "fairchem-data-omat" +dynamic = ["version", "readme"] +description = "Code for generating omat24 input configurations and vasp input sets" +license = {text = "MIT License"} +dependencies = [ + "pymatgen>=2023.10.3", # this was pinned to 2023.5.10 +] + +[project.urls] +repository = "https://github.com/facebookresearch/fairchem/tree/main/src/fairchem/data/omat" +documentation = "https://fair-chem.github.io/" + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.version.raw-options] +root = "../../" +git_describe_command = 'git describe --tags --match fairchem_data_omat-*' + +[tool.hatch.build] +directory = "../../dist-data-omat" + +[tool.hatch.build.targets.sdist] +only-include = ["src/fairchem/data/omat"] + +[tool.hatch.build.targets.wheel] +sources = ["src"] +only-include = ["src/fairchem/data/omat"] + +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/markdown" +fragments = [ + { path = "src/fairchem/data/omat/README.md" } +] diff --git a/packages/fairchem-data-omat/src b/packages/fairchem-data-omat/src new file mode 120000 index 0000000000..929cb3dc9b --- /dev/null +++ b/packages/fairchem-data-omat/src @@ -0,0 +1 @@ +../../src \ No newline at end of file diff --git a/src/fairchem/data/omat/README.md b/src/fairchem/data/omat/README.md index 7d2bad6ebf..8938d002b2 100644 --- a/src/fairchem/data/omat/README.md +++ b/src/fairchem/data/omat/README.md @@ -5,7 +5,7 @@ The OMat24 dataset is available for download from [this](https://huggingface.co/ Pretrained eqV2 and eSEN models can be downloaded from HuggingFace [here](https://huggingface.co/facebook/OMAT24) and UMA models [here](https://huggingface.co/facebook/UMA). -The VASP sets used to generate OMat24 data are implemented as `pymatgen` `VaspInputSets` in the package. You can +The VASP sets used to generate OMat24 data are implemented as `pymatgen` `VaspInputSets`. You can generate OMat24 VASP inputs as follows, ```python From 4b2a5bba1b90b86c27e306742a951390ffabf810 Mon Sep 17 00:00:00 2001 From: lbluque Date: Thu, 9 Oct 2025 13:22:35 -0700 Subject: [PATCH 3/3] fix IBRION in static --- src/fairchem/data/omat/vasp/OMat24StaticSet.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml b/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml index c69f3f3cd1..32fe19ad4e 100644 --- a/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml +++ b/src/fairchem/data/omat/vasp/OMat24StaticSet.yaml @@ -4,7 +4,7 @@ INCAR: ALGO: NORMAL EDIFF_PER_ATOM: 5.0e-05 ENCUT: 520 - IBRION: 2 + IBRION: -1 ISIF: 3 ISMEAR: -5 ISPIN: 2