Skip to content

Commit

Permalink
Fix MeshSymmetryErrorHandler treating ISYM=-1 as symmetry ON (#285)
Browse files Browse the repository at this point in the history
* fix MeshSymmetryErrorHandler treating ISYM=-1 as symmetry ON

* PositiveEnergyErrorHandler don't decrease POTIM for static calcs
  • Loading branch information
janosh authored Aug 15, 2023
1 parent 26bf28a commit e133fe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.282
rev: v0.0.284
hooks:
- id: ruff
args: [--fix, --ignore, D]
Expand All @@ -27,7 +27,7 @@ repos:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.5.0
hooks:
- id: mypy
additional_dependencies: [types-requests]
Expand Down
22 changes: 7 additions & 15 deletions custodian/vasp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,18 +841,9 @@ def correct(self):
if grid_adjusted and "NGZ" in line:
actions.append({"dict": "INCAR", "action": {"_set": changes_dict}})
if vi["INCAR"].get("ICHARG", 0) < 10:
actions.extend(
[
{
"file": "CHGCAR",
"action": {"_file_delete": {"mode": "actual"}},
},
{
"file": "WAVECAR",
"action": {"_file_delete": {"mode": "actual"}},
},
]
)
delete_chgcar = {"file": "CHGCAR", "action": {"_file_delete": {"mode": "actual"}}}
delete_wavecar = {"file": "WAVECAR", "action": {"_file_delete": {"mode": "actual"}}}
actions.extend([delete_chgcar, delete_wavecar])
break

if "aliasing_incar" in self.errors:
Expand Down Expand Up @@ -991,9 +982,9 @@ def check(self):
return False

# According to VASP admins, you can disregard this error
# if symmetry is off
# if symmetry is off (i.e. ISYM = -1 or 0)
# Also disregard if automatic KPOINT generation is used
if (not vi["INCAR"].get("ISYM", True)) or (
if vi["INCAR"].get("ISYM", 2) <= 0 or (
vi["KPOINTS"] and vi["KPOINTS"].style == Kpoints.supported_modes.Automatic
):
return False
Expand Down Expand Up @@ -1772,7 +1763,8 @@ def correct(self):
actions = [{"dict": "INCAR", "action": {"_set": {"ALGO": "Normal"}}}]
VaspModder(vi=vi).apply_actions(actions)
return {"errors": ["Positive energy"], "actions": actions}
if algo == "normal":
# decrease POTIM if ALGO is 'normal' and IBRION != -1 (i.e. it's not a static calculation)
if algo == "normal" and vi["INCAR"].get("IBRION", 1) > -1:
potim = round(vi["INCAR"].get("POTIM", 0.5) / 2.0, 2)
actions = [{"dict": "INCAR", "action": {"_set": {"POTIM": potim}}}]
VaspModder(vi=vi).apply_actions(actions)
Expand Down

0 comments on commit e133fe0

Please sign in to comment.