Skip to content

Commit

Permalink
Cleaner handling of NPAR
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-S-Rosen authored Feb 11, 2025
1 parent 55e9c10 commit 597790f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/custodian/vasp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,13 @@ def correct(self, directory="./"):
actions.append({"dict": "INCAR", "action": {"_set": {"POTIM": potim}}})

if self.errors.intersection(["subspacematrix"]):
# Sometimes, this error can be due to parallelization issues with running across too many cores
# on a small structure. If this is the case, try reducing the number of cores or increasing NCORE or NPAR
if self.error_count["subspacematrix"] == 0 and vi["INCAR"].get("LREAL", False) is not False:
actions.append({"dict": "INCAR", "action": {"_set": {"LREAL": False}}})
elif self.error_count["subspacematrix"] == 1 and vi["INCAR"].get("PREC", "Normal") != "Accurate":
actions.append({"dict": "INCAR", "action": {"_set": {"PREC": "Accurate"}}})
elif
self.error_count["subspacematrix"] += 1

if (
Expand Down Expand Up @@ -570,6 +573,8 @@ def correct(self, directory="./"):
nelect = 1 # dummy value
if nelect < nprocs:
actions.append({"dict": "INCAR", "action": {"_set": {"NCORE": vi["INCAR"].get("NCORE", 1) * 2}}})
if "NPAR" in vi["INCAR"]:
actions.append({"dict": "INCAR", "action": {"_unset": {"NPAR": 1}}})

if "grad_not_orth" in self.errors:
# Often coincides with algo_tet, in which the algo_tet error handler will also resolve grad_not_orth.
Expand Down

0 comments on commit 597790f

Please sign in to comment.