Skip to content

Commit

Permalink
precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
esoteric-ephemera committed Jul 10, 2024
1 parent bf15dc1 commit f936917
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/custodian/vasp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,7 @@ def correct(self, directory="./"):
UserWarning,
)

elif (nbands := vi["INCAR"].get("NBANDS")):

elif nbands := vi["INCAR"].get("NBANDS"):
kpar = vi["INCAR"].get("KPAR", 1)
ncore = vi["INCAR"].get("NCORE", 1)
# If the user set an NBANDS that isn't compatible with parallelization settings,
Expand Down
7 changes: 2 additions & 5 deletions tests/vasp/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,19 +606,16 @@ def test_auto_nbands(self) -> None:
assert "auto_nbands" in dct["errors"]

def test_auto_nbands_bad_parallelization(self) -> None:

shutil.copy("OUTCAR_auto_nbands_parallel", "OUTCAR")
# hacky way to deal with custodian CI unzipping test files
Incar.from_file(zpath("INCAR.auto_nbands_parallel")).write_file("INCAR")

handler = VaspErrorHandler(zpath("vasp.auto_nbands"))
handler.check()
with pytest.warns(UserWarning, match = "setting was incompatible with your parallelization"):
with pytest.warns(UserWarning, match="setting was incompatible with your parallelization"):
dct = handler.correct()
assert "auto_nbands" in dct["errors"]
assert dct["actions"] == [
{"dict": "INCAR", "action": {"_set": {"NBANDS": 64}}}
]
assert dct["actions"] == [{"dict": "INCAR", "action": {"_set": {"NBANDS": 64}}}]


class AliasingErrorHandlerTest(PymatgenTest):
Expand Down

0 comments on commit f936917

Please sign in to comment.