Skip to content

Commit 7b74005

Browse files
Add a handler for the spin polarized harris error (#402)
1 parent 5c1d71a commit 7b74005

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/custodian/vasp/handlers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class VaspErrorHandler(ErrorHandler):
139139
"auto_nbands": ["The number of bands has been changed"],
140140
"ibzkpt": ["not all point group operations"],
141141
"fexcf": ["supplied exchange-correlation table"],
142+
"spin_polarized_harris": ["Spin polarized Harris functional dynamics is a good joke"],
142143
}
143144

144145
def __init__(
@@ -715,6 +716,14 @@ def correct(self, directory="./"):
715716
warnings.warn("Looks like you made a typo in the INCAR. Please double-check it.", UserWarning)
716717
return {"errors": ["read_error"], "actions": None}
717718

719+
if "spin_polarized_harris" in self.errors:
720+
# Unfixable error --- the user made a mistake in the INCAR
721+
warnings.warn(
722+
"You cannot run a calculation with ICHARG >= 10, ISPIN = 2, and NSW > 0. Try setting NSW = 0.",
723+
UserWarning,
724+
)
725+
return {"errors": ["spin_polarized_harris"], "actions": None}
726+
718727
if "hnform" in self.errors and vi["INCAR"].get("ISYM", 2) > 0:
719728
# The only solution is to change your k-point grid or disable symmetry
720729
# For internal calculation compatibility's sake, we do the latter

tests/files/vasp.harris

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Spin polarized Harris functional dynamics is a good joke

tests/vasp/test_handlers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,13 @@ def test_read_error(self) -> None:
566566
assert dct["errors"] == ["read_error"]
567567
assert dct["actions"] is None
568568

569+
def test_harris(self) -> None:
570+
handler = VaspErrorHandler("vasp.harris")
571+
assert handler.check() is True
572+
dct = handler.correct()
573+
assert dct["errors"] == ["spin_polarized_harris"]
574+
assert dct["actions"] is None
575+
569576
def test_amin(self) -> None:
570577
# Cell with at least one dimension >= 50 A, but AMIN > 0.01, and calculation not yet complete
571578
shutil.copy("INCAR.amin", "INCAR")

0 commit comments

Comments
 (0)