Repository: materialsproject/custodian
Pull request #154 (2020-08-21 20:36:00)

Handle new symmetry precision error
Needs a test file.


Patch:
diff --git a/custodian/vasp/handlers.py b/custodian/vasp/handlers.py
index 15089c18..a2740dff 100644
--- a/custodian/vasp/handlers.py
+++ b/custodian/vasp/handlers.py
@@ -102,6 +102,7 @@ class VaspErrorHandler(ErrorHandler):
         "rhosyg": ["RHOSYG"],
         "posmap": ["POSMAP"],
         "point_group": ["group operation missing"],
+        "symprec_noise": ["determination of the symmetry of your systems shows a strong"]
     }
 
     def __init__(
@@ -483,6 +484,12 @@ class VaspErrorHandler(ErrorHandler):
         if "point_group" in self.errors:
             actions.append({"dict": "INCAR", "action": {"_set": {"ISYM": 0}}})
 
+        if "symprec_noise" in self.errors:
+            if (vi["INCAR"].get("ISYM", 2) > 0) and (vi["INCAR"].get("SYMPREC", 1e-5) > 1e-6):
+                actions.append({"dict": "INCAR", "action": {"_set": {"SYMPREC": 1e-6}}})
+            else:
+                actions.append({"dict": "INCAR", "action": {"_set": {"ISYM": 0}}})
+
         VaspModder(vi=vi).apply_actions(actions)
         return {"errors": list(self.errors), "actions": actions}
 


Test patch:
diff --git a/custodian/vasp/tests/test_handlers.py b/custodian/vasp/tests/test_handlers.py
index 5e14c9a3..617011bf 100644
--- a/custodian/vasp/tests/test_handlers.py
+++ b/custodian/vasp/tests/test_handlers.py
@@ -303,6 +303,13 @@ class VaspErrorHandlerTest(unittest.TestCase):
         self.assertEqual(h.correct()["errors"], ["point_group"])
         i = Incar.from_file("INCAR")
         self.assertEqual(i["ISYM"], 0)
+        
+    def test_symprec_noise(self):
+        h = VaspErrorHandler("vasp.symprec_noise")
+        self.assertEqual(h.check(), True)
+        self.assertEqual(h.correct()["errors"], ["symprec_noise"])
+        i = Incar.from_file("INCAR")
+        self.assertEqual(i["SYMPREC"], 1e-6)
 
     def test_point_group_vasp6(self):
         # the error message is formatted differently in VASP6 compared to VASP5
diff --git a/test_files/vasp.symprec_noise b/test_files/vasp.symprec_noise
new file mode 100644
index 00000000..80b48cfb
--- /dev/null
+++ b/test_files/vasp.symprec_noise
@@ -0,0 +1,15 @@
+ -----------------------------------------------------------------------------
+|                                                                             |
+|           W    W    AA    RRRRR   N    N  II  N    N   GGGG   !!!           |
+|           W    W   A  A   R    R  NN   N  II  NN   N  G    G  !!!           |
+|           W    W  A    A  R    R  N N  N  II  N N  N  G       !!!           |
+|           W WW W  AAAAAA  RRRRR   N  N N  II  N  N N  G  GGG   !            |
+|           WW  WW  A    A  R   R   N   NN  II  N   NN  G    G                |
+|           W    W  A    A  R    R  N    N  II  N    N   GGGG   !!!           |
+|                                                                             |
+|     The determination of the symmetry of your systems shows a strong        |
+|     dependence on the tolerance parameter SYMPREC. This is often the        |
+|     result of "noise" in the structural parameters (lattice vectors         |
+|     and/or ionic positions). Set NWRITE=3 for more details.                 |
+|                                                                             |
+ -----------------------------------------------------------------------------
\ No newline at end of file