Skip to content

Commit

Permalink
use vi correctly in VaspErrorHandler.check
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Jul 27, 2023
1 parent ae6cf63 commit ad04784
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions custodian/vasp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,28 +620,32 @@ def correct(self):
# NOTE: This is the algo_tet handler response.
# set ALGO to normal
algo = vi["INCAR"].get("ALGO", "Normal").lower()
if (algo in ["all", "damped"] or (50 <= vi.incar.get("IALGO", 38) <= 59)) and vi.incar.get("ISMEAR", 1) < 0:
if self.error_count["algo_tet"] == 0:
# first recovery attempt is to set ALGO to fast. Could fail again in which
# case we end up here again if some other handler switches algo back to all/damped.
# This time try the recovery below.
actions.append({"dict": "INCAR", "action": {"_set": {"ALGO": "Fast"}}})
if self.error_count["algo_tet"] == 1:
# ALGO=All/Damped / IALGO=5X often fails with ISMEAR < 0. There are two options VASP
# suggests: 1) Use ISMEAR = 0 (and a small sigma) to get the SCF to converge.
# 2) Use ALGO = Damped but only *after* an ISMEAR = 0 run where the wavefunction
# has been stored and read in for the subsequent run.
#
# For simplicity, we go with Option 1 here, but if the user wants high-quality
# DOS then they should consider running a subsequent job with ISMEAR = -5 and
# ALGO = Damped, provided the wavefunction has been stored.
actions.append({"dict": "INCAR", "action": {"_set": {"ISMEAR": 0, "SIGMA": 0.05}}})
if vi.incar.get("NEDOS") or vi.incar.get("EMIN") or vi.incar.get("EMAX"):
warnings.warn(
"This looks like a DOS run. You may want to follow-up this job with ALGO = Damped"
" and ISMEAR = -5, using the wavefunction from the current job.",
UserWarning,
)

if "algo_tet" in self.errors:
if (algo in ["all", "damped"] or (50 <= vi["INCAR"].get("IALGO", 38) <= 59)) and vi["INCAR"].get(
"ISMEAR", 1
) < 0:
if self.error_count["algo_tet"] == 0:
# first recovery attempt is to set ALGO to fast. Could fail again in which
# case we end up here again if some other handler switches algo back to all/damped.
# This time try the recovery below.
actions.append({"dict": "INCAR", "action": {"_set": {"ALGO": "Fast"}}})
if self.error_count["algo_tet"] == 1:
# ALGO=All/Damped / IALGO=5X often fails with ISMEAR < 0. There are two options VASP
# suggests: 1) Use ISMEAR = 0 (and a small sigma) to get the SCF to converge.
# 2) Use ALGO = Damped but only *after* an ISMEAR = 0 run where the wavefunction
# has been stored and read in for the subsequent run.
#
# For simplicity, we go with Option 1 here, but if the user wants high-quality
# DOS then they should consider running a subsequent job with ISMEAR = -5 and
# ALGO = Damped, provided the wavefunction has been stored.
actions.append({"dict": "INCAR", "action": {"_set": {"ISMEAR": 0, "SIGMA": 0.05}}})
if vi["INCAR"].get("NEDOS") or vi["INCAR"].get("EMIN") or vi["INCAR"].get("EMAX"):
warnings.warn(
"This looks like a DOS run. You may want to follow-up this job with ALGO = Damped"
" and ISMEAR = -5, using the wavefunction from the current job.",
UserWarning,
)

VaspModder(vi=vi).apply_actions(actions)
return {"errors": list(self.errors), "actions": actions}
Expand Down

0 comments on commit ad04784

Please sign in to comment.