Skip to content

Commit cb972d6

Browse files
authored
Merge branch 'materialsproject:main' into bump_monty
2 parents 61704bd + eccfaf1 commit cb972d6

27 files changed

+1357
-285
lines changed

.github/workflows/testing.yml

+78-2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
micromamba activate a2
9090
pytest --splits 3 --group ${{ matrix.split }} --durations-path tests/.pytest-split-durations --splitting-algorithm least_duration --ignore=tests/ase --cov=atomate2 --cov-report=xml
9191
92+
9293
- uses: codecov/codecov-action@v1
9394
if: matrix.python-version == '3.10' && github.repository == 'materialsproject/atomate2'
9495
with:
@@ -150,7 +151,7 @@ jobs:
150151
- name: Test Notebooks
151152
run: |
152153
micromamba activate a2
153-
pytest --nbmake ./tutorials --ignore=./tutorials/openmm_tutorial.ipynb
154+
pytest --nbmake ./tutorials --ignore=./tutorials/openmm_tutorial.ipynb --ignore=./tutorials/force_fields
154155
155156
- name: Test ASE
156157
env:
@@ -165,6 +166,81 @@ jobs:
165166
token: ${{ secrets.CODECOV_TOKEN }}
166167
file: ./coverage.xml
167168

169+
test-force-field-notebook:
170+
# prevent this action from running on forks
171+
if: github.repository == 'materialsproject/atomate2'
172+
173+
services:
174+
local_mongodb:
175+
image: mongo:4.0
176+
ports:
177+
- 27017:27017
178+
179+
runs-on: ubuntu-latest
180+
defaults:
181+
run:
182+
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
183+
strategy:
184+
matrix:
185+
python-version: ["3.10", "3.11", "3.12"]
186+
187+
steps:
188+
- name: Check out repo
189+
uses: actions/checkout@v4
190+
191+
- name: Set up micromamba
192+
uses: mamba-org/setup-micromamba@main
193+
194+
- name: Create mamba environment
195+
run: |
196+
micromamba create -n a2 python=${{ matrix.python-version }} --yes
197+
198+
- name: Install uv
199+
run: micromamba run -n a2 pip install uv
200+
201+
- name: Install conda dependencies
202+
run: |
203+
micromamba install -n a2 -c conda-forge enumlib packmol bader openbabel openff-toolkit==0.16.2 openff-interchange==0.3.22 --yes
204+
205+
- name: Install dependencies
206+
run: |
207+
micromamba activate a2
208+
python -m pip install --upgrade pip
209+
mkdir -p ~/.abinit/pseudos
210+
cp -r tests/test_data/abinit/pseudos/ONCVPSP-PBE-SR-PDv0.4 ~/.abinit/pseudos
211+
uv pip install .[strict,strict-forcefields,tests,abinit]
212+
uv pip install torch-runstats
213+
uv pip install --no-deps nequip==0.5.6
214+
215+
- name: Install pymatgen from master if triggered by pymatgen repo dispatch
216+
if: github.event_name == 'repository_dispatch' && github.event.action == 'pymatgen-ci-trigger'
217+
run: |
218+
micromamba activate a2
219+
uv pip install --upgrade 'git+https://github.com/materialsproject/pymatgen@${{ github.event.client_payload.pymatgen_ref }}'
220+
221+
- name: Forcefield tutorial
222+
env:
223+
MP_API_KEY: ${{ secrets.MP_API_KEY }}
224+
225+
# regenerate durations file with `pytest --store-durations --durations-path tests/.pytest-split-durations`
226+
# Note the use of `--splitting-algorithm least_duration`.
227+
# This helps prevent a test split having no tests to run, and then the GH action failing, see:
228+
# https://github.com/jerry-git/pytest-split/issues/95
229+
# However this `splitting-algorithm` means that tests cannot depend sensitively on the order they're executed in.
230+
run: |
231+
micromamba activate a2
232+
pytest --nbmake ./tutorials/force_fields
233+
234+
235+
- uses: codecov/codecov-action@v1
236+
if: matrix.python-version == '3.10' && github.repository == 'materialsproject/atomate2'
237+
with:
238+
token: ${{ secrets.CODECOV_TOKEN }}
239+
name: coverage
240+
file: ./coverage.xml
241+
242+
243+
168244
docs:
169245
runs-on: ubuntu-latest
170246

@@ -186,7 +262,7 @@ jobs:
186262
run: sphinx-build docs docs_build
187263

188264
automerge:
189-
needs: [lint, test-non-ase, test-notebooks-and-ase, docs]
265+
needs: [lint, test-non-ase, test-notebooks-and-ase, test-force-field-notebook, docs]
190266
runs-on: ubuntu-latest
191267

192268
permissions:

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ started:
9696

9797
- [Introduction to running workflows][running-workflows]
9898
- [Using atomate2 with FireWorks][atomate2_fireworks]
99+
- [Overview of key concepts][key-concepts]
99100
- [List of VASP workflows][vasp_workflows]
100101

101102
## Need help?
@@ -151,6 +152,7 @@ A journal submission of `atomate2` is undergoing peer review. In the meantime, p
151152
[contributors]: https://materialsproject.github.io/atomate2/about/contributors.html
152153
[license]: https://raw.githubusercontent.com/materialsproject/atomate2/main/LICENSE
153154
[running-workflows]: https://materialsproject.github.io/atomate2/user/running-workflows.html
155+
[key-concepts]: https://materialsproject.github.io/atomate2/user/key_concepts_overview.html#key-concepts-in-atomate2-job-flow-makers-inputset-taskdocument-and-builder
154156
[atomate2_fireworks]: https://materialsproject.github.io/atomate2/user/fireworks.html
155157
[vasp_workflows]: https://materialsproject.github.io/atomate2/user/codes/vasp.html
156158
[RelaxBandStructure]: https://materialsproject.github.io/atomate2/user/codes/vasp.html#relax-and-band-structure

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
user/index
55
user/install
66
user/running-workflows
7+
user/key_concepts_overview
78
user/docs-schemas-emmet
89
user/fireworks
910
user/atomate-1-vs-2

docs/user/codes/vasp.md

+108-38
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,25 @@ adjust them if necessary. The default might not be strict enough
248248
for your specific case.
249249
```
250250

251+
You can use the following code to start the standard version of the workflow:
252+
```py
253+
from atomate2.vasp.flows.phonons import PhononMaker
254+
from pymatgen.core.structure import Structure
255+
256+
structure = Structure(
257+
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
258+
species=["Mg", "O"],
259+
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
260+
)
261+
262+
phonon_flow = PhononMaker(min_length=15.0, store_force_constants=False).make(
263+
structure=struct
264+
)
265+
```
266+
267+
268+
269+
251270
### Gruneisen parameter workflow
252271

253272
Calculates mode-dependent Grüneisen parameters with the help of Phonopy.
@@ -352,8 +371,85 @@ lobster = update_user_incar_settings(lobster, {"NPAR": 4})
352371
run_locally(lobster, create_folders=True, store=SETTINGS.JOB_STORE)
353372
```
354373

355-
It is, however, computationally very beneficial to define two different types of job scripts for the VASP and Lobster runs, as VASP and Lobster runs are parallelized differently (MPI vs. OpenMP).
356-
[FireWorks](https://github.com/materialsproject/fireworks) allows one to run the VASP and Lobster jobs with different job scripts. Please check out the [jobflow documentation on FireWorks](https://materialsproject.github.io/jobflow/tutorials/8-fireworks.html#setting-the-manager-configs) for more information.
374+
There are currently three different ways available to run the workflow efficiently, as VASP and LOBSTER rely on a different parallelization (MPI vs. OpenMP).
375+
One can use a job script (with some restrictions), or [Jobflow-remote](https://matgenix.github.io/jobflow-remote/) / [Fireworks](https://github.com/materialsproject/fireworks) for high-throughput runs.
376+
377+
378+
#### Running the LOBSTER workflow without database and with one job script only
379+
380+
It is possible to run the VASP-LOBSTER workflow efficiently with a minimal setup.
381+
In this case, you will run the VASP calculations on the same node as the LOBSTER calculations.
382+
In between, the different computations you will switch from MPI to OpenMP parallelization.
383+
384+
For example, for a node with 48 cores, you could use an adapted version of the following SLURM script:
385+
386+
```bash
387+
#!/bin/bash
388+
#SBATCH -J vasplobsterjob
389+
#SBATCH -o ./%x.%j.out
390+
#SBATCH -e ./%x.%j.err
391+
#SBATCH -D ./
392+
#SBATCH --mail-type=END
393+
394+
#SBATCH --time=24:00:00
395+
#SBATCH --nodes=1
396+
#This needs to be adapted if you run with different cores
397+
#SBATCH --ntasks=48
398+
399+
# ensure you load the modules to run VASP, e.g., module load vasp
400+
module load my_vasp_module
401+
# please activate the required conda environment
402+
conda activate my_environment
403+
cd my_folder
404+
# the following script needs to contain the workflow
405+
python xyz.py
406+
```
407+
408+
The `LOBSTER_CMD` now needs an additional export of the number of threads.
409+
410+
```yaml
411+
VASP_CMD: <<VASP_CMD>>
412+
LOBSTER_CMD: OMP_NUM_THREADS=48 <<LOBSTER_CMD>>
413+
```
414+
415+
416+
#### Jobflow-remote
417+
Please refer first to the general documentation of jobflow-remote: [https://matgenix.github.io/jobflow-remote/](https://matgenix.github.io/jobflow-remote/).
418+
419+
```py
420+
from atomate2.vasp.flows.lobster import VaspLobsterMaker
421+
from pymatgen.core.structure import Structure
422+
from jobflow_remote import submit_flow, set_run_config
423+
from atomate2.vasp.powerups import update_user_incar_settings
424+
425+
structure = Structure(
426+
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
427+
species=["Mg", "O"],
428+
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
429+
)
430+
431+
lobster = VaspLobsterMaker().make(structure)
432+
433+
resources = {"nodes": 3, "partition": "micro", "time": "00:55:00", "ntasks": 144}
434+
435+
resources_lobster = {"nodes": 1, "partition": "micro", "time": "02:55:00", "ntasks": 48}
436+
lobster = set_run_config(lobster, name_filter="lobster", resources=resources_lobster)
437+
438+
lobster = update_user_incar_settings(lobster, {"NPAR": 4})
439+
submit_flow(lobster, worker="my_worker", resources=resources, project="my_project")
440+
```
441+
442+
The `LOBSTER_CMD` also needs an export of the threads.
443+
444+
```yaml
445+
VASP_CMD: <<VASP_CMD>>
446+
LOBSTER_CMD: OMP_NUM_THREADS=48 <<LOBSTER_CMD>>
447+
```
448+
449+
450+
451+
#### Fireworks
452+
Please first refer to the general documentation on running atomate2 workflows with fireworks: [https://materialsproject.github.io/atomate2/user/fireworks.html](https://materialsproject.github.io/atomate2/user/fireworks.html)
357453
358454
Specifically, you might want to change the `_fworker` for the LOBSTER runs and define a separate `lobster` worker within FireWorks:
359455

@@ -389,6 +485,16 @@ lpad = LaunchPad.auto_load()
389485
lpad.add_wf(wf)
390486
```
391487

488+
489+
The `LOBSTER_CMD` can now be adapted to not include the number of threads:
490+
491+
```yaml
492+
VASP_CMD: <<VASP_CMD>>
493+
LOBSTER_CMD: <<LOBSTER_CMD>>
494+
```
495+
496+
#### Analyzing outputs
497+
392498
Outputs from the automatic analysis with LobsterPy can easily be extracted from the database and also plotted:
393499

394500
```py
@@ -425,42 +531,6 @@ for number, (key, cohp) in enumerate(
425531
plotter.save_plot(f"plots_cation_anion_bonds{number}.pdf")
426532
```
427533

428-
#### Running the LOBSTER workflow without database and with one job script only
429-
430-
It is also possible to run the VASP-LOBSTER workflow with a minimal setup.
431-
In this case, you will run the VASP calculations on the same node as the LOBSTER calculations.
432-
In between, the different computations you will switch from MPI to OpenMP parallelization.
433-
434-
For example, for a node with 48 cores, you could use an adapted version of the following SLURM script:
435-
436-
```bash
437-
#!/bin/bash
438-
#SBATCH -J vasplobsterjob
439-
#SBATCH -o ./%x.%j.out
440-
#SBATCH -e ./%x.%j.err
441-
#SBATCH -D ./
442-
#SBATCH --mail-type=END
443-
444-
#SBATCH --time=24:00:00
445-
#SBATCH --nodes=1
446-
#This needs to be adapted if you run with different cores
447-
#SBATCH --ntasks=48
448-
449-
# ensure you load the modules to run VASP, e.g., module load vasp
450-
module load my_vasp_module
451-
# please activate the required conda environment
452-
conda activate my_environment
453-
cd my_folder
454-
# the following script needs to contain the workflow
455-
python xyz.py
456-
```
457-
458-
The `LOBSTER_CMD` now needs an additional export of the number of threads.
459-
460-
```yaml
461-
VASP_CMD: <<VASP_CMD>>
462-
LOBSTER_CMD: OMP_NUM_THREADS=48 <<LOBSTER_CMD>>
463-
```
464534

465535
(modifying_input_sets)=
466536
Modifying input sets

0 commit comments

Comments
 (0)