Skip to content

Commit

Permalink
Merge branch 'forcefield-phonons' of github.com:JaGeo/atomate2 into f…
Browse files Browse the repository at this point in the history
…orcefield-phonons
  • Loading branch information
JaGeo committed Jul 24, 2023
2 parents 43ff9af + 7c877a8 commit 8f54d31
Show file tree
Hide file tree
Showing 24 changed files with 268 additions and 121 deletions.
File renamed without changes.
8 changes: 4 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: testing

on:
push:

branches: [main]
pull_request:
branches: [main]

Expand All @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: "3.8"
cache: pip
cache-dependency-path: pyproject.toml

Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.10"
cache: pip
cache-dependency-path: pyproject.toml

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
exclude: '^src/atomate2/vasp/schemas/calc_types/|^.github/'
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
rev: v0.0.277
hooks:
- id: ruff
args: [--fix]
Expand Down Expand Up @@ -46,7 +46,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.4.1
hooks:
- id: mypy
files: ^src/
Expand All @@ -55,7 +55,7 @@ repos:
- types-pkg_resources==0.1.2
- types-paramiko
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.5
hooks:
- id: codespell
stages: [commit, commit-msg]
Expand Down
27 changes: 26 additions & 1 deletion docs/user/codes/vasp.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ adjust them if necessary. The default might not be strict enough
for your specific case.
```

## Lobster
### Lobster

Perform bonding analysis with [LOBSTER](http://cohp.de/) and [LobsterPy](https://github.com/jageo/lobsterpy)

Expand All @@ -258,6 +258,31 @@ VASP_CMD: <<VASP_CMD>>
LOBSTER_CMD: <<LOBSTER_CMD>>
```
The corresponding flow could, for example, be started with the following code:
```Python
from jobflow import SETTINGS
from jobflow import run_locally
from pymatgen.core.structure import Structure

from atomate2.vasp.flows.lobster import VaspLobsterMaker
from atomate2.vasp.powerups import update_user_incar_settings

structure = Structure(
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
species=["Mg", "O"],
coords=[[0, 0, 0], [0.5, 0.5, 0.5]],
)

lobster = VaspLobsterMaker().make(structure)

# update the incar
lobster = update_user_incar_settings(lobster, {"NPAR": 4})
# run the job
run_locally(lobster, create_folders=True, store=SETTINGS.JOB_STORE)
```

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).
[FireWorks](https://github.com/materialsproject/fireworks) allows 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.

Outputs from the automatic analysis with LobsterPy can easily be extracted from the database and also plotted:
Expand Down
36 changes: 21 additions & 15 deletions docs/user/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This guide will get you up and running in an environment for running high-throug
workflows with atomate2. atomate2 is built on the pymatgen, custodian, jobflow, and
FireWorks libraries. Briefly:

- [pymatgen] is used create input files and analyze the output of materials science codes.
- [pymatgen] is used to create input files and analyze the output of materials science codes.
- [custodian] runs your simulation code (e.g., VASP) and performs error checking/handling
and checkpointing.
- [jobflow] is used to design computational workflows.
Expand All @@ -22,9 +22,9 @@ Note that this installation tutorial is VASP-centric since almost all functional
currently in atomate2 pertains to VASP.

[pymatgen]: http://pymatgen.org
[custodian]: https://materialsproject.github.io/custodian/
[fireworks]: https://materialsproject.github.io/fireworks/
[jobflow]: https://materialsproject.github.io/jobflow/
[custodian]: https://materialsproject.github.io/custodian
[fireworks]: https://materialsproject.github.io/fireworks
[jobflow]: https://materialsproject.github.io/jobflow

### Objectives

Expand Down Expand Up @@ -64,8 +64,8 @@ tutorial.

### MongoDB

[MongoDB](https://docs.mongodb.com/manual/) is a NoSQL database that stores each database
entry as a document, which is represented in the JSON format (the formatting is similar to
[MongoDB](https://docs.mongodb.com/manual) is a NoSQL database that stores each database
entry as a document, which is represented in JSON format (the formatting is similar to
a dictionary in Python). Atomate2 uses MongoDB to:

- Create a database of calculation results.
Expand All @@ -77,7 +77,7 @@ workflows. Thus, it is strongly recommended that you have a server to run MongoD
(simpler) use a hosting service. Your options are:

- Use a commercial service to host your MongoDB instance. These are typically the
easiest to use and offer high quality service but require payment for larger
easiest to use and offer high-quality service but require payment for larger
databases. [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) offers a free 500 MB
server which is certainly enough to get started for small to medium size projects, and
it is easy to upgrade or migrate your database if you exceed the free allocation.
Expand All @@ -90,7 +90,7 @@ If you're just starting, we suggest the first (with a free plan) or second optio
accept outside connections properly which can sometimes be tricky.

Next, create a new database and set up an account with admin access. Keep a record of
your credentials - we will configure jobflow to connect to them in a later step. Also
your credentials - we will configure `jobflow` to connect to them in a later step. Also,
make sure you note down the hostname and port for the MongoDB instance.

```{note}
Expand Down Expand Up @@ -151,7 +151,7 @@ Python codes using a conda virtual environment. Some of the main benefits are:
this solves permissions issues with installing and modifying packages.

The easiest way to get a Python virtual environment is to use the `conda` tool.
Most clusters (e.g., NESRC) have [Anaconda](https://www.continuum.io) installed already
Most clusters (e.g., NESRC) have [Anaconda](https://continuum.io) installed already
which provides access to the `conda` binary. If the `conda` tool is not available, you can
install it by following the installation instructions for
[Miniconda](https://docs.conda.io/en/latest/miniconda.html). To set up your conda environment:
Expand Down Expand Up @@ -199,7 +199,7 @@ Create the following files in `<<INSTALL_DIR>>/config`.
The `jobflow.yaml` file contains the credentials of the MongoDB server that will store
calculation outputs. The `jobflow.yaml` file requires you to enter the basic database
information as well as what to call the main collection that results are kept in (e.g.
`ouputs`). Note that you should replace the whole `<<PROPERTY>>` definition with
`outputs`). Note that you should replace the whole `<<PROPERTY>>` definition with
your own settings.

```yaml
Expand Down Expand Up @@ -318,14 +318,20 @@ and then return to this tutorial.
### Materials Project API key

You can get an API key from the [Materials Project] by logging in and going to your
[Dashboard](https://materialsproject.org/dashboard). Add this also to
your `~/.pmgrc.yaml` so that it looks like the following
[Dashboard](materials project). Add this also to
your `~/.config/.pmgrc.yaml` so that it looks like the following

```yaml
PMG_VASP_PSP_DIR: <<INSTALL_DIR>>/pps
PMG_MAPI_KEY: <<YOUR_API_KEY>>
```

You can generate this file and set these values using the `pymatgen` CLI:

```bash
pmg config --add PMG_VASP_PSP_DIR /abs/path/to/psp PMG_MAPI_KEY your_api_key
```

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

## Run a test workflow
Expand All @@ -336,7 +342,7 @@ workflow. Next, we'll submit a job to run the script. Finally, we'll examine the
database to check the job output. In this tutorial, we will be submitting an individual
workflow manually. If you want to manage and execute many workflows simultaneously
this can be achieved using the FireWorks package and is covered in
[](atomate2_FireWorks).
[](atomate2_fireWorks).

This particular workflow will only run a single calculation that optimizes a crystal
structure (not very exciting). In the subsequent tutorials, we'll run more complex
Expand Down Expand Up @@ -442,13 +448,13 @@ See the following pages for more information on the topics we covered here:
- To see how to run and customize the existing Workflows in atomate2, try the
[](running_workflows) tutorial (suggested next step).
- To see how to manage and execute many workflows at once, try the
[](atomate2_FireWorks) tutorial.
[](atomate2_fireWorks) tutorial.

## Troubleshooting and FAQ

### My job failed

Check the job error files in the launch directory for any errors. Also check the job
Check the job error files in the launch directory for any errors. Also, check the job
standard output for a full log of the workflow execution and to check for a Python
traceback.

Expand Down
2 changes: 1 addition & 1 deletion docs/user/running-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ At this point, you might:
* Learn how to chain workflows together: [](connecting_vasp_jobs).
* Learn how to customise VASP input settings: [](modifying_input_sets).
* Configure atomate2 with FireWorks to manage and execute many workflows at once:
[](atomate2_FireWorks).
[](atomate2_fireWorks).
95 changes: 49 additions & 46 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ mp = ["mp-api>=0.27.5"]
phonons = ["phonopy>=1.10.8", "seekpath"]
lobster = ["lobsterpy"]
defects = ["dscribe>=1.2.0", "pymatgen-analysis-defects>=2022.11.30"]
forcefields = ["chgnet==0.1.3", "matgl==0.5.6"]
forcefields = ["chgnet==0.2.0", "matgl==0.7.1"]
docs = [
"FireWorks==2.0.3",
"autodoc_pydantic==1.8.0",
"autodoc_pydantic==1.9.0",
"furo==2023.5.20",
"ipython==8.14.0",
"jsonschema[format]",
Expand All @@ -56,27 +56,27 @@ docs = [
"sphinx_design==0.4.1",
]
dev = ["pre-commit>=2.12.1"]
tests = ["FireWorks==2.0.3", "pytest-cov==4.1.0", "pytest==7.3.2"]
tests = ["FireWorks==2.0.3", "pytest-cov==4.1.0", "pytest==7.4.0"]
strict = [
"PyYAML==6.0",
"PyYAML==6.0.1",
"cclib==1.7.2",
"chgnet==0.1.3",
"click==8.1.3",
"custodian==2023.6.5",
"dscribe==2.0.0",
"emmet-core==0.57.1",
"chgnet==0.2.0",
"click==8.1.6",
"custodian==2023.7.22",
"dscribe==2.0.1",
"emmet-core==0.60.1",
"jobflow==0.1.11",
"lobsterpy==0.2.9",
"matgl==0.5.6",
"matgl==0.7.1",
"monty==2023.5.8",
"mp-api==0.33.3",
"numpy",
"phonopy==2.19.1",
"phonopy==2.20.0",
"pydantic==1.10.9",
"pymatgen-analysis-defects==2023.6.1",
"pymatgen-analysis-defects==2023.7.12",
"pymatgen==2023.5.31",
"seekpath==2.1.0",
"typing-extensions==4.6.3",
"typing-extensions==4.7.1",
]

[project.scripts]
Expand Down Expand Up @@ -141,42 +141,45 @@ exclude_lines = [
[tool.ruff]
target-version = "py38"
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle error
"EXE", # flake8-executable
"F", # pyflakes
"FLY", # flynt
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"PD", # pandas-vet
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PYI", # flakes8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"TID", # tidy imports
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle warning
"YTT", # flake8-2020
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle error
"EXE", # flake8-executable
"F", # pyflakes
"FLY", # flynt
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"PD", # pandas-vet
"PERF", # perflint
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PYI", # flakes8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"TCH", # flake8-type-checking
"TID", # tidy imports
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"W", # pycodestyle warning
"YTT", # flake8-2020
]
ignore = [
"PD011", # pandas-use-of-dot-values
"PLC1901", # compare-to-empty-string
"PLR", # pylint-refactor
"PT004", # pytest-missing-fixture-name-underscore
"PT006", # pytest-parametrize-names-wrong-type
"PD011", # pandas-use-of-dot-values
"PLR", # pylint-refactor
"PT004", # pytest-missing-fixture-name-underscore
"PT006", # pytest-parametrize-names-wrong-type
"RUF013", # implicit-optional
# TODO remove PT011, pytest.raises() should always check err msg
"PT011", # pytest-raises-too-broad
"PT013", # pytest-incorrect-pytest-import
"PERF203", # try-except-in-loop
"PT011", # pytest-raises-too-broad
"PT013", # pytest-incorrect-pytest-import
]
pydocstyle.convention = "numpy"
isort.known-first-party = ["atomate2"]
Expand Down
Loading

0 comments on commit 8f54d31

Please sign in to comment.