Skip to content

Commit

Permalink
fix @field_validators are @classmethods
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Oct 19, 2023
1 parent 90b8d72 commit 650fb08
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.0
rev: v0.1.1
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/amset/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def from_directory(
transport=transport,
usage_stats=timing,
kpoint_mesh=inter_mesh,
nkpoints=np.product(inter_mesh),
nkpoints=np.prod(inter_mesh),
log=log,
**mesh_kwargs,
)
Expand Down
2 changes: 2 additions & 0 deletions src/atomate2/cp2k/schemas/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class CalculationInput(BaseModel):
)

@field_validator("atomic_kind_info", mode="before")
@classmethod
def remove_unnecessary(cls, atomic_kind_info) -> dict:
"""Remove unnecessary entry from atomic_kind_info."""
for k in atomic_kind_info:
Expand All @@ -91,6 +92,7 @@ def remove_unnecessary(cls, atomic_kind_info) -> dict:
return atomic_kind_info

@field_validator("dft", mode="before")
@classmethod
def cleanup_dft(cls, dft) -> dict:
"""Convert UKS strings to UKS=True."""
if any(v.upper() == "UKS" for v in dft.values()):
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/vasp/sets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ def _set_kspacing(
# known before calling VASP, but a warning is raised when the KSPACING value is
# > 0.5 (2 reciprocal Angstrom). An error handler in Custodian is available to
# correct overly large KSPACING values (small number of kpoints) if necessary.
if np.product(kpoints.kpts) < 4 and incar.get("ISMEAR", 0) == -5:
if np.prod(kpoints.kpts) < 4 and incar.get("ISMEAR", 0) == -5:
incar["ISMEAR"] = 0

elif "KSPACING" in user_incar_settings:
Expand Down

0 comments on commit 650fb08

Please sign in to comment.