diff --git a/custodian/vasp/handlers.py b/custodian/vasp/handlers.py index f9a2d8f5..dd6643c4 100644 --- a/custodian/vasp/handlers.py +++ b/custodian/vasp/handlers.py @@ -663,7 +663,7 @@ def correct(self, directory="./"): ) self.error_count["algo_tet"] += 1 - if "auto_nbands" in self.errors and not (nbands := self._get_nbands_from_outcar(directory)): + if "auto_nbands" in self.errors and (nbands := self._get_nbands_from_outcar(directory)): nelect = load_outcar(os.path.join(directory, "OUTCAR")).nelect if nelect and nbands > 2 * nelect: self.error_count["auto_nbands"] += 1 diff --git a/tests/vasp/test_handlers.py b/tests/vasp/test_handlers.py index 5de64407..e639d999 100644 --- a/tests/vasp/test_handlers.py +++ b/tests/vasp/test_handlers.py @@ -598,8 +598,11 @@ def test_auto_nbands(self) -> None: shutil.copy("OUTCAR_auto_nbands", "OUTCAR") handler = VaspErrorHandler("vasp.auto_nbands") handler.check() - dct = handler.correct() + with pytest.warns(UserWarning, match="NBANDS seems to be too high"): + dct = handler.correct() assert "auto_nbands" in dct["errors"] + + class AliasingErrorHandlerTest(PymatgenTest): def setUp(self) -> None: