Skip to content

Commit a9010b4

Browse files
emmet 0.86.1 compatibility (#1325)
* temporarily pin emmet core * change band structure test to reflect new emmet model * tweaks for emmet-compat * bug free emmet bump? * precommit * bump minimum emmet core * bump minimum emmet core version * add cached entry property to ase/forcefield docs * pip emmet core * drop 3.10 due to upstream drop * un double gzip some potcar specs * prevent uploading tutorial output * bump matgl in strict + test data updates * cleanup tests * try to pin numpy * try to pin numpy * try debugging why notebook is not working in ci but is locally * that is why * move entry to ase / mlff schema fields instead of property * restore pymatgen objects using default toggle to pymatgen * compat with emmet toggle * new emmet min pin for new ver * update docs * add toggle for forcefield and ase jobs * precommit * micromamba issues? * micromamba issues?
1 parent 73c01ae commit a9010b4

File tree

88 files changed

+468
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+468
-303
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- uses: actions/setup-python@v5
2323
with:
24-
python-version: "3.10"
24+
python-version: "3.11"
2525
cache: pip
2626
cache-dependency-path: pyproject.toml
2727

@@ -51,7 +51,7 @@ jobs:
5151

5252
- uses: actions/setup-python@v5
5353
with:
54-
python-version: "3.10"
54+
python-version: "3.11"
5555

5656
- name: Build
5757
run: |

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- uses: actions/setup-python@v5
2828
with:
29-
python-version: "3.10"
29+
python-version: "3.11"
3030
cache: pip
3131
cache-dependency-path: pyproject.toml
3232

.github/workflows/testing.yml

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
- uses: actions/setup-python@v5
1919
with:
20-
python-version: "3.10"
20+
python-version: "3.11"
2121
cache: pip
2222
cache-dependency-path: pyproject.toml
2323

@@ -39,7 +39,7 @@ jobs:
3939
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
4040
strategy:
4141
matrix:
42-
python-version: ["3.10", "3.11", "3.12"]
42+
python-version: ["3.11", "3.12"]
4343
split: [1, 2, 3]
4444

4545
steps:
@@ -48,10 +48,11 @@ jobs:
4848

4949
- name: Set up micromamba
5050
uses: mamba-org/setup-micromamba@main
51-
52-
- name: Create mamba environment
53-
run: |
54-
micromamba create -n a2 python=${{ matrix.python-version }} --yes
51+
with:
52+
environment-name: a2
53+
cache-environment: false
54+
create-args: >-
55+
python=${{ matrix.python-version }}
5556
5657
- name: Install uv
5758
run: micromamba run -n a2 pip install uv
@@ -91,7 +92,7 @@ jobs:
9192
9293
9394
- uses: codecov/codecov-action@v1
94-
if: matrix.python-version == '3.10' && github.repository == 'materialsproject/atomate2'
95+
if: matrix.python-version == '3.11' && github.repository == 'materialsproject/atomate2'
9596
with:
9697
token: ${{ secrets.CODECOV_TOKEN }}
9798
name: coverage${{ matrix.split }}
@@ -113,18 +114,19 @@ jobs:
113114
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
114115
strategy:
115116
matrix:
116-
python-version: ["3.10","3.11","3.12"]
117+
python-version: ["3.11","3.12"]
117118

118119
steps:
119120
- name: Check out repo
120121
uses: actions/checkout@v4
121122

122123
- name: Set up micromamba
123124
uses: mamba-org/setup-micromamba@main
124-
125-
- name: Create mamba environment
126-
run: |
127-
micromamba create -n a2 python=${{ matrix.python-version }} --yes
125+
with:
126+
environment-name: a2
127+
cache-environment: false
128+
create-args: >-
129+
python=${{ matrix.python-version }}
128130
129131
- name: Install uv
130132
run: micromamba run -n a2 pip install uv
@@ -174,18 +176,19 @@ jobs:
174176
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
175177
strategy:
176178
matrix:
177-
python-version: ["3.10", "3.11", "3.12"]
179+
python-version: ["3.11", "3.12"]
178180

179181
steps:
180182
- name: Check out repo
181183
uses: actions/checkout@v4
182184

183185
- name: Set up micromamba
184186
uses: mamba-org/setup-micromamba@main
185-
186-
- name: Create mamba environment
187-
run: |
188-
micromamba create -n a2 python=${{ matrix.python-version }} --yes
187+
with:
188+
environment-name: a2
189+
cache-environment: false
190+
create-args: >-
191+
python=${{ matrix.python-version }}
189192
190193
- name: Install uv
191194
run: micromamba run -n a2 pip install uv
@@ -220,7 +223,7 @@ jobs:
220223
pytest -n auto --splits 1 --group 1 --cov=atomate2 --cov-report=xml tests/ase
221224
222225
- uses: codecov/codecov-action@v1
223-
if: matrix.python-version == '3.10' && github.repository == 'materialsproject/atomate2'
226+
if: matrix.python-version == '3.11' && github.repository == 'materialsproject/atomate2'
224227
with:
225228
token: ${{ secrets.CODECOV_TOKEN }}
226229
file: ./coverage.xml
@@ -241,18 +244,19 @@ jobs:
241244
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
242245
strategy:
243246
matrix:
244-
python-version: ["3.10", "3.11", "3.12"]
247+
python-version: ["3.11", "3.12"]
245248

246249
steps:
247250
- name: Check out repo
248251
uses: actions/checkout@v4
249252

250253
- name: Set up micromamba
251254
uses: mamba-org/setup-micromamba@main
252-
253-
- name: Create mamba environment
254-
run: |
255-
micromamba create -n a2 python=${{ matrix.python-version }} --yes
255+
with:
256+
environment-name: a2
257+
cache-environment: false
258+
create-args: >-
259+
python=${{ matrix.python-version }}
256260
257261
- name: Install uv
258262
run: micromamba run -n a2 pip install uv
@@ -292,7 +296,7 @@ jobs:
292296
293297
294298
- uses: codecov/codecov-action@v1
295-
if: matrix.python-version == '3.10' && github.repository == 'materialsproject/atomate2'
299+
if: matrix.python-version == '3.11' && github.repository == 'materialsproject/atomate2'
296300
with:
297301
token: ${{ secrets.CODECOV_TOKEN }}
298302
name: coverage
@@ -308,7 +312,7 @@ jobs:
308312

309313
- uses: actions/setup-python@v5
310314
with:
311-
python-version: "3.10"
315+
python-version: "3.11"
312316
cache: pip
313317
cache-dependency-path: pyproject.toml
314318

.github/workflows/update-precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v5
1717
with:
18-
python-version: "3.10"
18+
python-version: "3.11"
1919

2020
- name: Install pre-commit
2121
run: pip install pre-commit

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ docs_build/*
88
docs/tutorials/*
99
docs/tutorials/*/*
1010

11+
# tutorial output files
12+
tutorials/*.json.gz
13+
1114
# C extensions
1215
*.so
1316

docs/user/install.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,34 @@ and then return to this tutorial.
354354
### Materials Project API key
355355

356356
You can get an API key from the [Materials Project] by logging in and going to your
357-
[Dashboard](materials project). Add this also to
358-
your `~/.config/.pmgrc.yaml` so that it looks like the following
357+
[Dashboard](materials project).
359358

360-
```yaml
361-
PMG_VASP_PSP_DIR: <<INSTALL_DIR>>/pps
362-
PMG_MAPI_KEY: <<YOUR_API_KEY>>
359+
Add this to your `.bashrc`, `.zshrc`, etc. as an environment variable:
360+
```console
361+
export MP_API_KEY=your_api_key_here
363362
```
364363

365-
You can generate this file and set these values using the `pymatgen` CLI:
364+
## Emmet-core setup
366365

367-
```bash
368-
pmg config --add PMG_VASP_PSP_DIR /abs/path/to/psp PMG_MAPI_KEY your_api_key
366+
The `emmet-core` package is used to define data schemas for parsing outputs of workflows.
367+
It is also used in building the Materials Project data, therefore its use in `atomate2` is to broadly ensure compatibility with the Materials Project's data structures.
368+
`emmet-core` allows you to use either `pymatgen` or `emmet-core`-defined models for larger data objects, such as charge densities (`CHGCAR`, `AECCAR*`), or trajectories (relaxation, MD, etc.).
369+
The `pymatgen` objects have long been the default in workflows, and are structured to be output as JSON files.
370+
The `emmet-core` objects have been designed with both JSON and Apache parquet as storage formats.
371+
372+
If you will be storing data in the cloud, or would like to use these newer data models which may use less storage, you can either add a line to your `atomate2.yaml` file:
373+
```yaml
374+
VASP_USE_EMMET_MODELS: true
369375
```
376+
or use an environment variable in your `.bashrc`:
377+
```console
378+
export ATOMATE2_VASP_USE_EMMET_MODEL=true
379+
```
380+
Note that there is an equivalent `emmet-core` setting, which can be set by the environment variable `EMMET_USE_EMMET_MODELS`.
381+
382+
For ASE and machine learning forcefield jobs, you can use the `ASE_FORCEFIELD_USE_EMMET_MODELS` flag in `atomate2.yaml` to toggle the same functionality.
383+
384+
The default in `atomate2` is to use `pymatgen` models.
370385

371386
[materials project]: https://materialsproject.org/dashboard
372387

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies = [
2828
"PyYAML",
2929
"click",
3030
"custodian>=2024.4.18",
31-
"emmet-core>=v0.84.10",
31+
"emmet-core>=0.86.1",
3232
"jobflow>=0.1.11",
3333
"monty>=2024.12.10",
3434
"numpy",
@@ -57,11 +57,10 @@ forcefields = [
5757
"chgnet>=0.2.2",
5858
"mace-torch>=0.3.3",
5959
"matgl>=1.2.1",
60-
"torchdata<=0.7.1",
60+
"torchdata<=0.7.1", # TODO: remove when issue fixed
6161
# quippy-ase support for py3.12 tracked in https://github.com/libAtoms/QUIP/issues/645
6262
"quippy-ase>=0.9.14; python_version < '3.12'",
6363
"sevenn>=0.9.3",
64-
"torchdata<=0.7.1", # TODO: remove when issue fixed
6564
]
6665
approxneb = ["pymatgen-analysis-diffusion>=2024.7.15"]
6766
ase = ["ase>=3.26.0"]
@@ -107,14 +106,15 @@ strict-forcefields = [
107106
"calorine==3.1; python_version < '3.12'",
108107
"chgnet==0.3.8",
109108
"mace-torch==0.3.14",
110-
"matgl==1.3.0",
109+
"matgl==2.0.2",
111110
"quippy-ase==0.9.14; python_version < '3.12'",
112111
"sevenn==0.10.4",
113112
"torch==2.2.0",
114113
"torchdata==0.7.1", # TODO: remove when issue fixed
115114
]
116115
strict = [
117116
"atomate2[strict-forcefields, docs, cclib, phonons, lobster, openmm, mp, defects, ase, ase-ext]",
117+
"numpy<2.0",
118118
]
119119

120120
[project.scripts]

src/atomate2/abinit/schemas/calculation.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
from abipy.flowtk import events
1212
from abipy.flowtk.utils import File
1313
from emmet.core.math import Matrix3D, Vector3D
14-
15-
try:
16-
from emmet.core.types.enums import ValueEnum
17-
except ImportError:
18-
from emmet.core.utils import ValueEnum
14+
from emmet.core.types.enums import ValueEnum
1915
from pydantic import BaseModel, Field
2016
from pymatgen.core import Structure
2117
from typing_extensions import Self

src/atomate2/aims/schemas/calculation.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
import numpy as np
1313
from ase.spectrum.band_structure import BandStructure
1414
from emmet.core.math import Matrix3D, Vector3D
15-
16-
try:
17-
from emmet.core.types.enums import ValueEnum
18-
except ImportError:
19-
from emmet.core.utils import ValueEnum
15+
from emmet.core.types.enums import ValueEnum
2016
from pydantic import BaseModel, Field
2117
from pymatgen.core import Molecule, Structure
2218
from pymatgen.core.trajectory import Trajectory

src/atomate2/ase/jobs.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
88
from dataclasses import dataclass, field
99
from typing import TYPE_CHECKING
1010

11-
from ase.io import Trajectory as AseTrajectory
12-
13-
try:
14-
from emmet.core.types.enums import StoreTrajectoryOption
15-
except ImportError:
16-
from emmet.core.vasp.calculation import StoreTrajectoryOption
11+
from emmet.core.types.enums import StoreTrajectoryOption
1712
from jobflow import Maker, job
1813
from pymatgen.core import Molecule, Structure
19-
from pymatgen.core.trajectory import Trajectory as PmgTrajectory
2014
from pymatgen.io.ase import AseAtomsAdaptor
2115

2216
from atomate2.ase.schemas import AseResult, AseTaskDoc
@@ -31,7 +25,7 @@
3125

3226
from atomate2.ase.schemas import AseMoleculeTaskDoc, AseStructureTaskDoc
3327

34-
_ASE_DATA_OBJECTS = [PmgTrajectory, AseTrajectory]
28+
_ASE_DATA_OBJECTS = ["trajectory"]
3529

3630

3731
@dataclass

0 commit comments

Comments
 (0)