Ejemplo n.º 1
0
 def test_check_correct_electronic_repeat(self):
     shutil.copy("vasprun.xml.electronic2", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d, {"errors": ["Unconverged"], "actions": None})
     os.remove("vasprun.xml")
Ejemplo n.º 2
0
 def test_check_correct_ionic(self):
     shutil.copy("vasprun.xml.ionic", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d["errors"], ['Unconverged'])
     os.remove("vasprun.xml")
Ejemplo n.º 3
0
 def test_check_correct_ionic(self):
     shutil.copy("vasprun.xml.ionic", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d["errors"], ['Unconverged'])
     os.remove("vasprun.xml")
Ejemplo n.º 4
0
 def test_check_correct_electronic_repeat(self):
     shutil.copy("vasprun.xml.electronic2", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d, {"errors": ["Unconverged"], "actions": None})
     os.remove("vasprun.xml")
Ejemplo n.º 5
0
 def test_check_correct_electronic_repeat(self):
     shutil.copy("vasprun.xml.electronic2", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d, {'actions': [{'action': {'_set': {'ALGO': 'All'}}, 'dict': 'INCAR'}],
                         'errors': ['Unconverged']})
     os.remove("vasprun.xml")
Ejemplo n.º 6
0
 def test_check_correct_scan(self):
     shutil.copy("vasprun.xml.scan", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d["errors"], ['Unconverged'])
     self.assertIn({"dict": "INCAR",
                        "action": {"_set": {"ALGO": "All"}}},d["actions"])
     os.remove("vasprun.xml")
Ejemplo n.º 7
0
 def test_check_correct_scan(self):
     shutil.copy("vasprun.xml.scan", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(d["errors"], ['Unconverged'])
     self.assertIn({"dict": "INCAR",
                        "action": {"_set": {"ALGO": "All"}}},d["actions"])
     os.remove("vasprun.xml")
Ejemplo n.º 8
0
    def test_check_correct(self):
        subdir = os.path.join(test_dir, "unconverged")
        os.chdir(subdir)

        shutil.copy("INCAR", "INCAR.orig")
        shutil.copy("KPOINTS", "KPOINTS.orig")
        shutil.copy("POSCAR", "POSCAR.orig")
        shutil.copy("CONTCAR", "CONTCAR.orig")

        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ['Unconverged'])

        os.remove(os.path.join(subdir, "error.1.tar.gz"))

        shutil.move("INCAR.orig", "INCAR")
        shutil.move("KPOINTS.orig", "KPOINTS")
        shutil.move("POSCAR.orig", "POSCAR")
        shutil.move("CONTCAR.orig", "CONTCAR")
Ejemplo n.º 9
0
 def test_check_correct_electronic_repeat(self):
     shutil.copy("vasprun.xml.electronic2", "vasprun.xml")
     h = UnconvergedErrorHandler()
     self.assertTrue(h.check())
     d = h.correct()
     self.assertEqual(
         d,
         {
             "actions": [{
                 "action": {
                     "_set": {
                         "ALGO": "All"
                     }
                 },
                 "dict": "INCAR"
             }],
             "errors": ["Unconverged"],
         },
     )
     os.remove("vasprun.xml")
Ejemplo n.º 10
0
    def test_check_correct(self):
        subdir = os.path.join(test_dir, "unconverged")
        os.chdir(subdir)

        shutil.copy("INCAR", "INCAR.orig")
        shutil.copy("KPOINTS", "KPOINTS.orig")
        shutil.copy("POSCAR", "POSCAR.orig")
        shutil.copy("CONTCAR", "CONTCAR.orig")

        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ['Unconverged'])

        os.remove(os.path.join(subdir, "error.1.tar.gz"))

        shutil.move("INCAR.orig", "INCAR")
        shutil.move("KPOINTS.orig", "KPOINTS")
        shutil.move("POSCAR.orig", "POSCAR")
        shutil.move("CONTCAR.orig", "CONTCAR")
Ejemplo n.º 11
0
    def test_check_correct_electronic(self):
        shutil.copy("vasprun.xml.electronic", "vasprun.xml")
        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ["Unconverged"])
        self.assertEqual(
            d,
            {
                "actions": [{
                    "action": {
                        "_set": {
                            "ALGO": "Normal"
                        }
                    },
                    "dict": "INCAR"
                }],
                "errors": ["Unconverged"],
            },
        )

        shutil.copy("vasprun.xml.electronic_veryfast", "vasprun.xml")
        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ["Unconverged"])
        self.assertEqual(
            d,
            {
                "actions": [{
                    "action": {
                        "_set": {
                            "ALGO": "Fast"
                        }
                    },
                    "dict": "INCAR"
                }],
                "errors": ["Unconverged"],
            },
        )

        shutil.copy("vasprun.xml.electronic_normal", "vasprun.xml")
        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ["Unconverged"])
        self.assertEqual(
            d,
            {
                "actions": [{
                    "action": {
                        "_set": {
                            "ALGO": "All"
                        }
                    },
                    "dict": "INCAR"
                }],
                "errors": ["Unconverged"],
            },
        )

        shutil.copy("vasprun.xml.electronic_metagga_fast", "vasprun.xml")
        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ["Unconverged"])
        self.assertEqual(
            d,
            {
                "actions": [{
                    "action": {
                        "_set": {
                            "ALGO": "All"
                        }
                    },
                    "dict": "INCAR"
                }],
                "errors": ["Unconverged"],
            },
        )

        shutil.copy("vasprun.xml.electronic_hybrid_fast", "vasprun.xml")
        h = UnconvergedErrorHandler()
        self.assertTrue(h.check())
        d = h.correct()
        self.assertEqual(d["errors"], ["Unconverged"])
        self.assertEqual(
            d,
            {
                "actions": [{
                    "action": {
                        "_set": {
                            "ALGO": "All"
                        }
                    },
                    "dict": "INCAR"
                }],
                "errors": ["Unconverged"],
            },
        )

        os.remove("vasprun.xml")
Ejemplo n.º 12
0
 def run_task(self, fw_spec):
     ueh = UnconvergedErrorHandler()
     custodian_out = ueh.correct()
     return FWAction(stored_data={'error_list': custodian_out['errors']})