diff --git a/custodian/vasp/handlers.py b/custodian/vasp/handlers.py index 9b6a27b5..a005bd98 100644 --- a/custodian/vasp/handlers.py +++ b/custodian/vasp/handlers.py @@ -192,25 +192,12 @@ def correct(self, directory="./"): if self.errors.intersection(["tet", "dentet"]): # follow advice in this thread # https://vasp.at/forum/viewtopic.php?f=3&t=416&p=4047&hilit=dentet#p4047 - err_type = "tet" if "tet" in self.errors else "dentet" - if self.error_count[err_type] == 0: - if vi["INCAR"].get("KSPACING"): - # decrease KSPACING by 20% in each direction (approximately double no. of kpoints) - action = {"_set": {"KSPACING": vi["INCAR"].get("KSPACING") * 0.8}} - actions.append({"dict": "INCAR", "action": action}) - elif vi["KPOINTS"] and vi["KPOINTS"].num_kpts < 1: - # increase KPOINTS by 20% in each direction (approximately double no. of kpoints) - new_kpts = tuple(int(round(num * 1.2, 0)) for num in vi["KPOINTS"].kpts[0]) - actions.append({"dict": "KPOINTS", "action": {"_set": {"kpoints": (new_kpts,)}}}) - elif vi["KPOINTS"] and vi["KPOINTS"].num_kpts >= 1: - n_kpts = vi["KPOINTS"].num_kpts * 1.2 - new_kpts = tuple([int(round(n_kpts**1 / 3, 0))] * 3) - actions.append( - {"dict": "KPOINTS", "action": {"_set": {"generation_style": "Gamma", "kpoints": (new_kpts,)}}} - ) + if vi["INCAR"].get("KSPACING"): + # decrease KSPACING by 20% in each direction (approximately double no. of kpoints) + action = {"_set": {"KSPACING": vi["INCAR"].get("KSPACING") * 0.8}} + actions.append({"dict": "INCAR", "action": action}) else: actions.append({"dict": "INCAR", "action": {"_set": {"ISMEAR": 0, "SIGMA": 0.05}}}) - self.error_count[err_type] += 1 # Missing AMIN error handler: # previously, custodian would kill the job without letting it run if AMIN was flagged diff --git a/tests/vasp/test_handlers.py b/tests/vasp/test_handlers.py index d2a4f219..f78ec588 100644 --- a/tests/vasp/test_handlers.py +++ b/tests/vasp/test_handlers.py @@ -106,11 +106,6 @@ def test_subspace(self) -> None: def test_check_correct(self) -> None: handler = VaspErrorHandler("vasp.teterror") - handler.check() - dct = handler.correct() - assert dct["errors"] == ["tet"] - assert dct["actions"] == [{"action": {"_set": {"kpoints": ((10, 2, 2),)}}, "dict": "KPOINTS"}] - handler.check() dct = handler.correct() assert dct["errors"] == ["tet"] @@ -157,11 +152,6 @@ def test_brions(self) -> None: def test_dentet(self) -> None: handler = VaspErrorHandler("vasp.dentet") - handler.check() - dct = handler.correct() - assert dct["errors"] == ["dentet"] - assert dct["actions"] == [{"action": {"_set": {"kpoints": ((10, 2, 2),)}}, "dict": "KPOINTS"}] - handler.check() dct = handler.correct() assert dct["errors"] == ["dentet"] @@ -515,13 +505,6 @@ def test_bzint_vasp6(self) -> None: dct = handler.correct() assert dct["errors"] == ["tet"] incar = Incar.from_file("INCAR") - assert incar["ISMEAR"] == -5 - assert incar["SIGMA"] == 0.05 - assert dct["actions"] == [{"action": {"_set": {"kpoints": ((10, 2, 2),)}}, "dict": "KPOINTS"}] - - assert handler.check() is True - assert handler.correct()["errors"] == ["tet"] - incar = Incar.from_file("INCAR") assert incar["ISMEAR"] == 0 assert incar["SIGMA"] == 0.05