Repository: materialsproject/custodian
Pull request #211 (2022-03-25 02:59:43)

VASP handler for "while reading plane wave coef. from WAVECAR"
## Summary
This PR includes a handler for the following error. The fix is to delete the WAVECAR.

```
 -----------------------------------------------------------------------------
|                                                                             |
|     EEEEEEE  RRRRRR   RRRRRR   OOOOOOO  RRRRRR      ###     ###     ###     |
|     E        R     R  R     R  O     O  R     R     ###     ###     ###     |
|     E        R     R  R     R  O     O  R     R     ###     ###     ###     |
|     EEEEE    RRRRRR   RRRRRR   O     O  RRRRRR       #       #       #      |
|     E        R   R    R   R    O     O  R   R                               |
|     E        R    R   R    R   O     O  R    R      ###     ###     ###     |
|     EEEEEEE  R     R  R     R  OOOOOOO  R     R     ###     ###     ###     |
|                                                                             |
|     ERROR: while reading plane wave coef. from WAVECAR 13 1 129             |
|                                                                             |
|       ---->  I REFUSE TO CONTINUE WITH THIS SICK JOB ... BYE!!! <----       |
|                                                                             |
 -----------------------------------------------------------------------------
```



Patch:
diff --git a/custodian/vasp/handlers.py b/custodian/vasp/handlers.py
index fbdb8b97..0c261efc 100644
--- a/custodian/vasp/handlers.py
+++ b/custodian/vasp/handlers.py
@@ -102,6 +102,7 @@ class VaspErrorHandler(ErrorHandler):
         "bravais": ["Inconsistent Bravais lattice"],
         "nbands_not_sufficient": ["number of bands is not sufficient"],
         "hnform": ["HNFORM: k-point generating"],
+        "coef": ["while reading plane"],
     }
 
     def __init__(
@@ -357,6 +358,9 @@ class VaspErrorHandler(ErrorHandler):
         if "pricel" in self.errors:
             actions.append({"dict": "INCAR", "action": {"_set": {"SYMPREC": 1e-8, "ISYM": 0}}})
 
+        if "coef" in self.errors:
+            actions.append({"file": "WAVECAR", "action": {"_file_delete": {"mode": "actual"}}})
+
         if "brions" in self.errors:
 
             # Copy CONTCAR to POSCAR so we do not lose our progress.


Test patch:
diff --git a/custodian/vasp/tests/test_handlers.py b/custodian/vasp/tests/test_handlers.py
index 502655fe..c012e881 100644
--- a/custodian/vasp/tests/test_handlers.py
+++ b/custodian/vasp/tests/test_handlers.py
@@ -259,6 +259,17 @@ class VaspErrorHandlerTest(unittest.TestCase):
         self.assertEqual(h.check(), True)
         self.assertEqual(h.correct()["errors"], ["rot_matrix"])
 
+    def test_coef(self):
+        h = VaspErrorHandler("vasp6.coef")
+        h.check()
+        d = h.correct()
+        self.assertEqual(
+            d["actions"],
+            [
+                {"file": "WAVECAR", "action": {"_file_delete": {"mode": "actual"}}},
+            ],
+        )
+
     def test_to_from_dict(self):
         h = VaspErrorHandler("random_name")
         h2 = VaspErrorHandler.from_dict(h.as_dict())
diff --git a/test_files/vasp6.coef b/test_files/vasp6.coef
new file mode 100644
index 00000000..5d628275
--- /dev/null
+++ b/test_files/vasp6.coef
@@ -0,0 +1,16 @@
+ -----------------------------------------------------------------------------
+|                                                                             |
+|     EEEEEEE  RRRRRR   RRRRRR   OOOOOOO  RRRRRR      ###     ###     ###     |
+|     E        R     R  R     R  O     O  R     R     ###     ###     ###     |
+|     E        R     R  R     R  O     O  R     R     ###     ###     ###     |
+|     EEEEE    RRRRRR   RRRRRR   O     O  RRRRRR       #       #       #      |
+|     E        R   R    R   R    O     O  R   R                               |
+|     E        R    R   R    R   O     O  R    R      ###     ###     ###     |
+|     EEEEEEE  R     R  R     R  OOOOOOO  R     R     ###     ###     ###     |
+|                                                                             |
+|     ERROR: while reading plane wave coef. from WAVECAR 13 1 129             |
+|                                                                             |
+|       ---->  I REFUSE TO CONTINUE WITH THIS SICK JOB ... BYE!!! <----       |
+|                                                                             |
+ -----------------------------------------------------------------------------
+