Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* pre-commit autoupdate && pre-commit run --all-files

bump ruff to v0.9.3, mypy to v1.14.1, and codespell to v2.4.0 plus auto-fixes

* fix .github/workflows/docs.yml by bumping actions/upload-pages-artifact@v2 to v3, actions/deploy-pages@v2 to v4

prior actions/upload-pages-artifact versions started failing, see
https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions
and https://github.com/actions/upload-pages-artifact/releases/tag/v3.0.0
  • Loading branch information
janosh authored Jan 23, 2025
1 parent 233c2a9 commit ff9f938
Show file tree
Hide file tree
Showing 27 changed files with 88 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: sphinx-build docs docs_build

- name: Upload build artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: ./docs_build

Expand All @@ -52,4 +52,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
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: ^(.github/|tests/test_data/abinit/)
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.0
rev: v0.9.3
hooks:
- id: ruff
args: [--fix]
Expand All @@ -30,15 +30,15 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
files: ^src/
additional_dependencies:
- tokenize-rt==4.1.0
- types-paramiko
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
stages: [pre-commit, commit-msg]
Expand Down
3 changes: 1 addition & 2 deletions src/atomate2/abinit/jobs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def setup_job(

if structure is None and prev_outputs is None and restart_from is None:
raise RuntimeError(
"At least one of structure, prev_outputs or "
"restart_from should be defined."
"At least one of structure, prev_outputs or restart_from should be defined."
)

if history is None:
Expand Down
6 changes: 3 additions & 3 deletions src/atomate2/aims/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class PhononMaker(BasePhononMaker):
High-throughput electronic band structure calculations:
Challenges and tools. Computational Materials Science,
49(2), 299-312. doi:10.1016/j.commatsci.2010.05.010.
We will however use seekpath and primitive structures
as determined by from phonopy to compute the phonon band structure
We will, however, use seekpath and primitive structures
as determined by phonopy to compute the phonon band structure
bulk_relax_maker : .BaseAimsMaker or None
A maker to perform a tight relaxation on the bulk.
Set to ``None`` to skip the
Expand Down Expand Up @@ -106,7 +106,7 @@ class PhononMaker(BasePhononMaker):
it relies on phonopy to handle the relationship
to the primitive cell and not pymatgen
code: str
determines the dft or forcefield code.
determines the DFT or forcefield code.
store_force_constants: bool
if True, force constants will be stored
socket: bool
Expand Down
12 changes: 4 additions & 8 deletions src/atomate2/ase/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class AseResult(BaseModel):
is_force_converged: Optional[bool] = Field(
None,
description=(
"Whether the calculation is converged with respect "
"to interatomic forces."
"Whether the calculation is converged with respect to interatomic forces."
),
)

Expand Down Expand Up @@ -220,8 +219,7 @@ class AseStructureTaskDoc(StructureMetadata):
is_force_converged: Optional[bool] = Field(
None,
description=(
"Whether the calculation is converged with respect "
"to interatomic forces."
"Whether the calculation is converged with respect to interatomic forces."
),
)

Expand Down Expand Up @@ -285,8 +283,7 @@ class AseMoleculeTaskDoc(MoleculeMetadata):
is_force_converged: Optional[bool] = Field(
None,
description=(
"Whether the calculation is converged with respect "
"to interatomic forces."
"Whether the calculation is converged with respect to interatomic forces."
),
)

Expand Down Expand Up @@ -329,8 +326,7 @@ class AseTaskDoc(AseBaseModel):
is_force_converged: Optional[bool] = Field(
None,
description=(
"Whether the calculation is converged with respect "
"to interatomic forces."
"Whether the calculation is converged with respect to interatomic forces."
),
)

Expand Down
6 changes: 3 additions & 3 deletions src/atomate2/cli/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ def test_run_{test_name}(self, mock_abinit, abinit_test_dir, clean_dir):
from atomate2.abinit.schemas.core import AbinitTaskDocument
# load the initial structure, the maker and the ref_paths from the test_dir
test_dir = abinit_test_dir / {" / ".join(
[f'"{part}"' for part in test_dir.parts[index_part:]]
)}
test_dir = abinit_test_dir / {
" / ".join([f'"{part}"' for part in test_dir.parts[index_part:]])
}
structure = Structure.from_file(test_dir / "initial_structure.json.gz")
maker_info = loadfn(test_dir / "maker.json.gz")
maker = maker_info["maker"]
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/common/flows/anharmonicity.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def make(
It has to be given per formula unit (as a result in corresponding Doc).
Instead of recomputing the energy of the bulk structure every time, this
value can also be provided in eV. If it is provided, the static run will be
skipped. This energy is the typical output dft energy of the dft workflow.
skipped. This energy is the typical output DFT energy of the DFT workflow.
No conversion needed. It is set to 0 by default.
supercell_matrix: Optional[Matrix3D]
Instead of min_length, also a supercell_matrix can be given, e.g.
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/common/flows/gruneisen.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BaseGruneisenMaker(Maker, ABC):
bulk_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker, .BaseVaspMaker, or None
A maker to perform an initial tight relaxation on the bulk.
code: str
determines the dft or force field code.
determines the DFT or force field code.
const_vol_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker,
.BaseVaspMaker, or None. A maker to perform a tight relaxation
on the expanded and shrunk structures at constant volume.
Expand Down
5 changes: 2 additions & 3 deletions src/atomate2/common/flows/mpmorph.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ def make(
structure=deformed_structures[index].final_structure,
prev_dir=None,
)
md_job.name = (
f"{self.name} {md_job.name} {len(working_outputs['relax']['volume'])+1}"
)
relaxed_vol = len(working_outputs["relax"]["volume"])
md_job.name = f"{self.name} {md_job.name} {relaxed_vol + 1}"

working_outputs["relax"]["energies"].append(md_job.output.output.energy)
working_outputs["relax"]["volume"].append(md_job.output.structure.volume)
Expand Down
8 changes: 4 additions & 4 deletions src/atomate2/common/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class BasePhononMaker(Maker, ABC):
High-throughput electronic band structure calculations:
Challenges and tools. Computational Materials Science,
49(2), 299-312. doi:10.1016/j.commatsci.2010.05.010.
We will however use seekpath and primitive structures
as determined by from phonopy to compute the phonon band structure
We will, however, use seekpath and primitive structures
as determined by phonopy to compute the phonon band structure
bulk_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker, .BaseVaspMaker, or None
A maker to perform a tight relaxation on the bulk.
Set to ``None`` to skip the
Expand Down Expand Up @@ -128,7 +128,7 @@ class BasePhononMaker(Maker, ABC):
it relies on phonopy to handle the relationship
to the primitive cell and not pymatgen
code: str
determines the dft or force field code.
determines the DFT or force field code.
store_force_constants: bool
if True, force constants will be stored
socket: bool
Expand Down Expand Up @@ -200,7 +200,7 @@ def make(
It has to be given per formula unit (as a result in corresponding Doc).
Instead of recomputing the energy of the bulk structure every time, this
value can also be provided in eV. If it is provided, the static run will be
skipped. This energy is the typical output dft energy of the dft workflow.
skipped. This energy is the typical output dft energy of the DFT workflow.
No conversion needed.
supercell_matrix: list
Instead of min_length, also a supercell_matrix can be given, e.g.
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/common/schemas/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ElasticTensorDocument(BaseModel):
class ElasticWarnings(Enum):
"""Warnings for elastic document."""

FAILED_PERTURBATIONS: str = "failed_perturbations"
FAILED_PERTURBATIONS = "failed_perturbations"


class ElasticDocument(StructureMetadata):
Expand Down
24 changes: 11 additions & 13 deletions src/atomate2/common/schemas/qha.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]

temperatures: Optional[list[float]] = Field(
None,
description="temperatures at which the vibrational"
" part of the free energies"
description="temperatures at which the vibrational part of the free energies"
" and other properties have been computed",
)

Expand All @@ -33,8 +32,8 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]
)
thermal_expansion: Optional[list[float]] = Field(
None,
description="Thermal expansion coefficients at temperatures."
"Shape=(temperatures, ). ",
description="Thermal expansion coefficients at temperatures. "
"Shape=(temperatures,).",
)
helmholtz_volume: Optional[list[list[float]]] = Field(
None,
Expand All @@ -43,25 +42,24 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]
)
volume_temperature: Optional[list[float]] = Field(
None,
description="Volumes in Angstrom^3 at temperatures.Shape: (temperatures, )",
description="Volumes in Angstrom^3 at temperatures.Shape: (temperatures,)",
)
gibbs_temperature: Optional[list[float]] = Field(
None,
description="Gibbs free energies in eV at temperatures."
"Shape: (temperatures, )",
description="Gibbs free energies in eV at temperatures. Shape: (temperatures,)",
)
bulk_modulus_temperature: Optional[list[float]] = Field(
None,
description="Bulk modulus in GPa at temperature.Shape: (temperatures, )",
description="Bulk modulus in GPa at temperature.Shape: (temperatures,)",
)
heat_capacity_p_numerical: Optional[list[float]] = Field(
None,
description="Heat capacities in J/K/mol at constant pressure at temperatures."
"Shape: (temperatures, )",
"Shape: (temperatures,)",
)
gruneisen_temperature: Optional[list[float]] = Field(
None,
description="Gruneisen parameters at temperatures.Shape: (temperatures, )",
description="Gruneisen parameters at temperatures.Shape: (temperatures,)",
)
pressure: Optional[float] = Field(
None, description="Pressure in GPA at which Gibb's energy was computed"
Expand All @@ -75,17 +73,17 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]
free_energies: Optional[list[list[float]]] = Field(
None,
description="List of free energies in J/mol for per formula unit. "
"Shape: (temperatuers, volumes)",
"Shape: (temperatures, volumes)",
)
heat_capacities: Optional[list[list[float]]] = Field(
None,
description="List of heat capacities in J/K/mol per formula unit. "
"Shape: (temperatuers, volumes)",
"Shape: (temperatures, volumes)",
)
entropies: Optional[list[list[float]]] = Field(
None,
description="List of entropies in J/(K*mol) per formula unit. "
"Shape: (temperatuers, volumes) ",
"Shape: (temperatures, volumes) ",
)
formula_units: Optional[int] = Field(None, description="Formula units")

Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/forcefields/flows/gruneisen.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GruneisenMaker(BaseGruneisenMaker):
bulk_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker, .BaseVaspMaker, or None
A maker to perform an initial tight relaxation on the bulk.
code: str
determines the dft or force field code.
determines the DFT or force field code.
const_vol_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker,
.BaseVaspMaker, or None. A maker to perform a tight relaxation
on the expanded and shrunk structures at constant volume.
Expand Down
6 changes: 3 additions & 3 deletions src/atomate2/forcefields/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class PhononMaker(BasePhononMaker):
High-throughput electronic band structure calculations:
Challenges and tools. Computational Materials Science,
49(2), 299-312. doi:10.1016/j.commatsci.2010.05.010.
We will however use seekpath and primitive structures
as determined by from phonopy to compute the phonon band structure
We will, however, use seekpath and primitive structures
as determined by phonopy to compute the phonon band structure
bulk_relax_maker : .ForceFieldRelaxMaker or None
A maker to perform a tight relaxation on the bulk.
Set to ``None`` to skip the
Expand Down Expand Up @@ -101,7 +101,7 @@ class PhononMaker(BasePhononMaker):
it relies on phonopy to handle the relationship
to the primitive cell and not pymatgen
code: str
determines the dft or force field code.
determines the DFT or force field code.
store_force_constants: bool
if True, force constants will be stored
socket: bool
Expand Down
3 changes: 1 addition & 2 deletions src/atomate2/forcefields/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class ForceFieldTaskDocument(AseStructureTaskDoc):
is_force_converged: Optional[bool] = Field(
None,
description=(
"Whether the calculation is converged with respect "
"to interatomic forces."
"Whether the calculation is converged with respect to interatomic forces."
),
)

Expand Down
3 changes: 1 addition & 2 deletions src/atomate2/openmm/jobs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from openff.units import unit
except ImportError as e:
raise ImportError(
"Using the atomate2.openmm.generate "
"module requires the openff-toolkit package."
"Using the atomate2.openmm.generate module requires the openff-toolkit package."
) from e


Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/utils/datetime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Helper functions for datetime objects."""
"""Helper functions for datetime objects.""" # noqa: A005

from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/vasp/flows/gruneisen.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GruneisenMaker(BaseGruneisenMaker):
bulk_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker, .BaseVaspMaker, or None
A maker to perform an initial tight relaxation on the bulk.
code: str
determines the dft or force field code.
determines the DFT or force field code.
const_vol_relax_maker: .ForceFieldRelaxMaker, .BaseAimsMaker,
.BaseVaspMaker, or None. A maker to perform a tight relaxation
on the expanded and shrunk structures at constant volume.
Expand Down
4 changes: 2 additions & 2 deletions src/atomate2/vasp/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class PhononMaker(BasePhononMaker):
High-throughput electronic band structure calculations:
Challenges and tools. Computational Materials Science,
49(2), 299-312. doi:10.1016/j.commatsci.2010.05.010.
We will however use seekpath and primitive structures
as determined by from phonopy to compute the phonon band structure
We will, however, use seekpath and primitive structures
as determined by phonopy to compute the phonon band structure
bulk_relax_maker : .BaseVaspMaker or None
A maker to perform a tight relaxation on the bulk.
Set to ``None`` to skip the
Expand Down
16 changes: 9 additions & 7 deletions tests/abinit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,10 @@ def check_equivalent_frac_coords(
len(find_in_coord_list_pbc(ref_frac_coords, coord, atol=atol)) > 0
for coord in user_frac_coords
]
assert all(coord_match), f"The two structures have different frac. coords: \
assert all(coord_match), (
f"The two structures have different frac. coords: \
{user_frac_coords} vs. {ref_frac_coords}."
)


def check_equivalent_znucl_typat(
Expand All @@ -172,20 +174,20 @@ def check_equivalent_znucl_typat(

sorted_znucl_a = sorted(znucl_a, reverse=True)
sorted_znucl_b = sorted(znucl_b, reverse=True)
assert (
sorted_znucl_a == sorted_znucl_b
), f"The elements are different: {znucl_a} vs. {znucl_b}"
assert sorted_znucl_a == sorted_znucl_b, (
f"The elements are different: {znucl_a} vs. {znucl_b}"
)

count_sorted_znucl_a = [
list(typat_a).count(list(znucl_a).index(s) + 1) for s in sorted_znucl_a
]
count_sorted_znucl_b = [
list(typat_b).count(list(znucl_b).index(s) + 1) for s in sorted_znucl_b
]
assert (
count_sorted_znucl_a == count_sorted_znucl_b
), f"The number of same elements is different: \
assert count_sorted_znucl_a == count_sorted_znucl_b, (
f"The number of same elements is different: \
{count_sorted_znucl_a} vs. {count_sorted_znucl_b}"
)


def check_abinit_input_json(ref_path: str | Path):
Expand Down
Loading

0 comments on commit ff9f938

Please sign in to comment.