Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ default_language_version:
exclude: ^(.github/|tests/test_data/abinit/)
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.9.3
rev: v0.15.8
hooks:
- id: ruff
args: [--fix]
exclude: tutorials/grueneisen_workflow.ipynb
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: fix-encoding-pragma
args: [--remove]
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
rev: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies: [black]
Expand All @@ -31,22 +31,22 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
rev: v1.19.1
hooks:
- id: mypy
files: ^src/
additional_dependencies:
- tokenize-rt==4.1.0
- types-paramiko
- repo: https://github.com/codespell-project/codespell
rev: v2.4.0
rev: v2.4.2
hooks:
- id: codespell
stages: [pre-commit, commit-msg]
args: [--ignore-words-list, 'titel,statics,ba,nd,te,atomate']
types_or: [python, rst, markdown]
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
rev: 0.9.1
hooks:
- id: nbstripout
args:
Expand Down
2 changes: 0 additions & 2 deletions docs/user/codes/openmm.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ for PF6- here, the built in partial charge method fails.
import numpy as np
from pymatgen.core.structure import Molecule


pf6 = Molecule(
["P", "F", "F", "F", "F", "F", "F"],
[
Expand Down Expand Up @@ -142,7 +141,6 @@ from atomate2.openmm.jobs.core import (
)
from jobflow import Flow, run_locally


production_maker = OpenMMFlowMaker(
name="production_flow",
makers=[
Expand Down
9 changes: 2 additions & 7 deletions docs/user/codes/vasp.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ A Grüneisen workflow for VASP can be started as follows:
from atomate2.vasp.flows.gruneisen import GruneisenMaker
from pymatgen.core.structure import Structure


structure = Structure(
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
species=["Mg", "O"],
Expand All @@ -324,7 +323,6 @@ The following script allows you to start the default workflow for VASP with some
from atomate2.vasp.flows.qha import QhaMaker
from pymatgen.core.structure import Structure


structure = Structure(
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
species=["Mg", "O"],
Expand All @@ -349,7 +347,6 @@ You can start the workflow as follows:
from atomate2.vasp.flows.eos import EosMaker
from pymatgen.core.structure import Structure


structure = Structure(
lattice=[[0, 2.13, 2.13], [2.13, 0, 2.13], [2.13, 2.13, 0]],
species=["Mg", "O"],
Expand Down Expand Up @@ -651,13 +648,11 @@ gamma_only_static_maker = StaticMaker(input_set_generator=custom_gamma_only_set)
For those who are more familiar with manual *k*-point generation, you can use a VASP-style KPOINTS file or string to set the *k*-points as well:

```py
kpoints = Kpoints.from_str(
"""Uniform density Monkhorst-Pack mesh
kpoints = Kpoints.from_str("""Uniform density Monkhorst-Pack mesh
0
Monkhorst-pack
5 5 5
"""
)
""")
custom_static_set = StaticSetGenerator(user_kpoints_settings=kpoints)
```

Expand Down
18 changes: 9 additions & 9 deletions src/atomate2/abinit/schemas/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
from datetime import datetime, timezone
from pathlib import Path
from typing import Optional, Union
from typing import Union

from abipy.electrons.gsr import GsrFile
from abipy.flowtk import events
Expand Down Expand Up @@ -82,23 +82,23 @@ class CalculationOutput(BaseModel):
None, description="The Fermi level from the calculation in eV"
)

forces: Optional[list[Vector3D]] = Field(
forces: list[Vector3D] | None = Field(
None, description="Forces acting on each atom"
)
stress: Optional[Matrix3D] = Field(None, description="The stress on the cell")
is_metal: Optional[bool] = Field(None, description="Whether the system is metallic")
bandgap: Optional[float] = Field(
stress: Matrix3D | None = Field(None, description="The stress on the cell")
is_metal: bool | None = Field(None, description="Whether the system is metallic")
bandgap: float | None = Field(
None, description="The band gap from the calculation in eV"
)
direct_bandgap: Optional[float] = Field(
direct_bandgap: float | None = Field(
None, description="The direct band gap from the calculation in eV"
)
cbm: Optional[float] = Field(
cbm: float | None = Field(
None,
description="The conduction band minimum, or LUMO for molecules, in eV "
"(if system is not metallic)",
)
vbm: Optional[float] = Field(
vbm: float | None = Field(
None,
description="The valence band maximum, or HOMO for molecules, in eV "
"(if system is not metallic)",
Expand Down Expand Up @@ -194,7 +194,7 @@ class Calculation(BaseModel):
event_report: events.EventReport = Field(
None, description="Event report of this abinit job."
)
output_file_paths: Optional[dict[str, str]] = Field(
output_file_paths: dict[str, str] | None = Field(
None,
description="Paths (relative to dir_name) of the Abinit output files "
"associated with this calculation",
Expand Down
48 changes: 23 additions & 25 deletions src/atomate2/abinit/schemas/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
from collections.abc import Sequence
from pathlib import Path
from typing import Any, Optional, Union
from typing import Any, Union

from abipy.abio.inputs import AbinitInput
from abipy.flowtk import events
Expand Down Expand Up @@ -89,7 +89,7 @@ class OutputDoc(BaseModel):
"""

structure: Union[Structure] = Field(None, description="The output structure object")
trajectory: Optional[Sequence[Union[Structure]]] = Field(
trajectory: Sequence[Union[Structure]] | None = Field(
None, description="The trajectory of output structures"
)
energy: float = Field(
Expand All @@ -98,15 +98,15 @@ class OutputDoc(BaseModel):
energy_per_atom: float = Field(
None, description="The final DFT energy per atom for the last calculation"
)
bandgap: Optional[float] = Field(
bandgap: float | None = Field(
None, description="The DFT bandgap for the last calculation"
)
cbm: Optional[float] = Field(None, description="CBM for this calculation")
vbm: Optional[float] = Field(None, description="VBM for this calculation")
forces: Optional[list[Vector3D]] = Field(
cbm: float | None = Field(None, description="CBM for this calculation")
vbm: float | None = Field(None, description="VBM for this calculation")
forces: list[Vector3D] | None = Field(
None, description="Forces on atoms from the last calculation"
)
stress: Optional[Matrix3D] = Field(
stress: Matrix3D | None = Field(
None, description="Stress on the unit cell from the last calculation"
)

Expand Down Expand Up @@ -179,49 +179,47 @@ class AbinitTaskDoc(StructureMetadata):
Additional json loaded from the calculation directory
"""

dir_name: Optional[str] = Field(
None, description="The directory for this Abinit task"
)
last_updated: Optional[str] = Field(
dir_name: str | None = Field(None, description="The directory for this Abinit task")
last_updated: str | None = Field(
default_factory=datetime_str,
description="Timestamp for when this task document was last updated",
)
completed_at: Optional[str] = Field(
completed_at: str | None = Field(
None, description="Timestamp for when this task was completed"
)
input: Optional[InputDoc] = Field(
input: InputDoc | None = Field(
None, description="The input to the first calculation"
)
output: Optional[OutputDoc] = Field(
output: OutputDoc | None = Field(
None, description="The output of the final calculation"
)
structure: Union[Structure] = Field(
None, description="Final output atoms from the task"
)
state: Optional[TaskState] = Field(None, description="State of this task")
event_report: Optional[events.EventReport] = Field(
state: TaskState | None = Field(None, description="State of this task")
event_report: events.EventReport | None = Field(
None, description="Event report of this abinit job."
)
included_objects: Optional[list[AbinitObject]] = Field(
included_objects: list[AbinitObject] | None = Field(
None, description="List of Abinit objects included with this task document"
)
abinit_objects: Optional[dict[AbinitObject, Any]] = Field(
abinit_objects: dict[AbinitObject, Any] | None = Field(
None, description="Abinit objects associated with this task"
)
task_label: Optional[str] = Field(None, description="A description of the task")
tags: Optional[list[str]] = Field(
task_label: str | None = Field(None, description="A description of the task")
tags: list[str] | None = Field(
None, description="Metadata tags for this task document"
)
author: Optional[str] = Field(
author: str | None = Field(
None, description="Author extracted from transformations"
)
icsd_id: Optional[str] = Field(
icsd_id: str | None = Field(
None, description="International crystal structure database id of the structure"
)
calcs_reversed: Optional[list[Calculation]] = Field(
calcs_reversed: list[Calculation] | None = Field(
None, description="The inputs and outputs for all Abinit runs in this task."
)
transformations: Optional[dict[str, Any]] = Field(
transformations: dict[str, Any] | None = Field(
None,
description="Information on the structural transformations, parsed from a "
"transformations.json file",
Expand All @@ -231,7 +229,7 @@ class AbinitTaskDoc(StructureMetadata):
description="Information on the custodian settings used to run this "
"calculation, parsed from a custodian.json file",
)
additional_json: Optional[dict[str, Any]] = Field(
additional_json: dict[str, Any] | None = Field(
None, description="Additional json loaded from the calculation directory"
)

Expand Down
28 changes: 14 additions & 14 deletions src/atomate2/aims/schemas/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from collections.abc import Sequence
from datetime import datetime, timezone
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
from typing import TYPE_CHECKING, Any

import numpy as np
from ase.spectrum.band_structure import BandStructure
Expand Down Expand Up @@ -98,32 +98,32 @@ class CalculationOutput(BaseModel):
None, description="The final structure from the calculation"
)

efermi: Optional[float] = Field(
efermi: float | None = Field(
None, description="The Fermi level from the calculation in eV"
)

forces: Optional[list[Vector3D]] = Field(
forces: list[Vector3D] | None = Field(
None, description="Forces acting on each atom"
)
all_forces: Optional[list[list[Vector3D]]] = Field(
all_forces: list[list[Vector3D]] | None = Field(
None,
description="Forces acting on each atom for each structure in the output file",
)
stress: Optional[Matrix3D] = Field(None, description="The stress on the cell")
stresses: Optional[list[Matrix3D]] = Field(
stress: Matrix3D | None = Field(None, description="The stress on the cell")
stresses: list[Matrix3D] | None = Field(
None, description="The atomic virial stresses"
)

is_metal: Optional[bool] = Field(None, description="Whether the system is metallic")
bandgap: Optional[float] = Field(
is_metal: bool | None = Field(None, description="Whether the system is metallic")
bandgap: float | None = Field(
None, description="The band gap from the calculation in eV"
)
cbm: float = Field(
None,
description="The conduction band minimum, or LUMO for molecules, in eV "
"(if system is not metallic)",
)
vbm: Optional[float] = Field(
vbm: float | None = Field(
None,
description="The valence band maximum, or HOMO for molecules, in eV "
"(if system is not metallic)",
Expand Down Expand Up @@ -264,7 +264,7 @@ def from_aims_files(
parse_dos: str | bool = False,
parse_bandstructure: str | bool = False,
store_trajectory: bool = False,
store_volumetric_data: Optional[Sequence[str]] = STORE_VOLUMETRIC_DATA,
store_volumetric_data: Sequence[str] | None = STORE_VOLUMETRIC_DATA,
) -> tuple[Self, dict[AimsObject, dict]]:
"""Create an FHI-aims calculation document from a directory and file paths.

Expand Down Expand Up @@ -393,7 +393,7 @@ def _get_output_file_paths(volumetric_files: list[str]) -> dict[AimsObject, str]
def _get_volumetric_data(
dir_name: Path,
output_file_paths: dict[AimsObject, str],
store_volumetric_data: Optional[Sequence[str]],
store_volumetric_data: Sequence[str] | None,
) -> dict[AimsObject, VolumetricData]:
"""
Load volumetric data files from a directory.
Expand Down Expand Up @@ -430,7 +430,7 @@ def _get_volumetric_data(
return volumetric_data


def _parse_dos(parse_dos: str | bool, aims_output: AimsOutput) -> Optional[Dos]:
def _parse_dos(parse_dos: str | bool, aims_output: AimsOutput) -> Dos | None:
"""Parse DOS outputs from FHI-aims calculation.

Parameters
Expand Down Expand Up @@ -458,7 +458,7 @@ def _parse_dos(parse_dos: str | bool, aims_output: AimsOutput) -> Optional[Dos]:

def _parse_bandstructure(
parse_bandstructure: str | bool, aims_output: AimsOutput
) -> Optional[BandStructure]:
) -> BandStructure | None:
"""
Get the band structure.

Expand All @@ -478,7 +478,7 @@ def _parse_bandstructure(
return None


def _parse_trajectory(aims_output: AimsOutput) -> Optional[Trajectory]:
def _parse_trajectory(aims_output: AimsOutput) -> Trajectory | None:
"""Grab a Trajectory object given an FHI-aims output object.

Parameters
Expand Down
Loading