当前位置: 首页>>代码示例>>Python>>正文


Python handlers.VaspErrorHandler类代码示例

本文整理汇总了Python中custodian.vasp.handlers.VaspErrorHandler的典型用法代码示例。如果您正苦于以下问题:Python VaspErrorHandler类的具体用法?Python VaspErrorHandler怎么用?Python VaspErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VaspErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_nicht_konv

 def test_nicht_konv(self):
     h = VaspErrorHandler("vasp.nicht_konvergent")
     h.natoms_large_cell = 5
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["nicht_konv"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["LREAL"], True)
开发者ID:shyamd,项目名称:custodian,代码行数:7,代码来源:test_handlers.py

示例2: test_brmix

    def test_brmix(self):
        h = VaspErrorHandler("vasp.brmix")
        self.assertEqual(h.check(), True)

        # The first (no good OUTCAR) correction, check IMIX
        d = h.correct()
        self.assertEqual(d["errors"], ['brmix'])
        vi = VaspInput.from_directory(".")
        self.assertEqual(vi["INCAR"]["IMIX"], 1)
        self.assertTrue(os.path.exists("CHGCAR"))

        # The next correction check Gamma and evenize
        h.correct()
        vi = VaspInput.from_directory(".")
        self.assertFalse("IMIX" in vi["INCAR"])
        self.assertTrue(os.path.exists("CHGCAR"))
        if vi["KPOINTS"].style == Kpoints.supported_modes.Gamma and vi["KPOINTS"].num_kpts < 1:
            all_kpts_even = all([
                bool(n % 2 == 0) for n in vi["KPOINTS"].kpts[0]
            ])
            self.assertFalse(all_kpts_even)

        # The next correction check ISYM and no CHGCAR
        h.correct()
        vi = VaspInput.from_directory(".")
        self.assertEqual(vi["INCAR"]["ISYM"], 0)
        self.assertFalse(os.path.exists("CHGCAR"))

        shutil.copy("INCAR.nelect", "INCAR")
        h = VaspErrorHandler("vasp.brmix")
        self.assertEqual(h.check(), False)
        d = h.correct()
        self.assertEqual(d["errors"], [])
开发者ID:shyamd,项目名称:custodian,代码行数:33,代码来源:test_handlers.py

示例3: test_dentet

 def test_dentet(self):
     h = VaspErrorHandler("vasp.dentet")
     h.check()
     d = h.correct()
     self.assertEqual(d["errors"], ['dentet'])
     self.assertEqual(d["actions"],
                      [{'action': {'_set': {'ISMEAR': 0}},
                        'dict': 'INCAR'}])
开发者ID:shyamd,项目名称:custodian,代码行数:8,代码来源:test_handlers.py

示例4: test_eddrmm

 def test_eddrmm(self):
     h = VaspErrorHandler("vasp.eddrmm")
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["eddrmm"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["ALGO"], "Normal")
     self.assertEqual(h.correct()["errors"], ["eddrmm"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["POTIM"], 0.25)
开发者ID:shyamd,项目名称:custodian,代码行数:9,代码来源:test_handlers.py

示例5: test_rhosyg

 def test_rhosyg(self):
     h = VaspErrorHandler("vasp.rhosyg")
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["rhosyg"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["SYMPREC"], 1e-4)
     self.assertEqual(h.correct()["errors"], ["rhosyg"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["ISYM"], 0)
开发者ID:shyamd,项目名称:custodian,代码行数:9,代码来源:test_handlers.py

示例6: test_first_step

 def test_first_step(self):
     shutil.copy("OSZICAR.empty", "OSZICAR")
     s1 = Structure.from_file("POSCAR")
     h = VaspErrorHandler("vasp.out")
     self.assertEqual(h.check(), True)
     d = h.correct()
     self.assertEqual(d['errors'], ['zpotrf'])
     s2 = Structure.from_file("POSCAR")
     self.assertAlmostEqual(s2.volume, s1.volume * 1.2 ** 3, 3)
开发者ID:shyamd,项目名称:custodian,代码行数:9,代码来源:test_handlers.py

示例7: test_potim_correction

 def test_potim_correction(self):
     shutil.copy("OSZICAR.one_step", "OSZICAR")
     s1 = Structure.from_file("POSCAR")
     h = VaspErrorHandler("vasp.out")
     self.assertEqual(h.check(), True)
     d = h.correct()
     self.assertEqual(d['errors'], ['zpotrf'])
     s2 = Structure.from_file("POSCAR")
     self.assertAlmostEqual(s2.volume, s1.volume, 3)
     self.assertAlmostEqual(Incar.from_file("INCAR")['POTIM'], 0.25)
开发者ID:shyamd,项目名称:custodian,代码行数:10,代码来源:test_handlers.py

示例8: test_too_few_bands

 def test_too_few_bands(self):
     os.chdir(os.path.join(test_dir, "too_few_bands"))
     shutil.copy("INCAR", "INCAR.orig")
     h = VaspErrorHandler("vasp.too_few_bands")
     h.check()
     d = h.correct()
     self.assertEqual(d["errors"], ['too_few_bands'])
     self.assertEqual(d["actions"],
                      [{'action': {'_set': {'NBANDS': 501}},
                        'dict': 'INCAR'}])
     os.remove("error.1.tar.gz")
     shutil.move("INCAR.orig", "INCAR")
开发者ID:navnidhirajput,项目名称:custodian,代码行数:12,代码来源:test_handlers.py

示例9: test_rot_matrix

 def test_rot_matrix(self):
     if "PMG_VASP_PSP_DIR" not in os.environ:
         os.environ["PMG_VASP_PSP_DIR"] = test_dir
     subdir = os.path.join(test_dir, "poscar_error")
     os.chdir(subdir)
     shutil.copy("KPOINTS", "KPOINTS.orig")
     h = VaspErrorHandler()
     h.check()
     d = h.correct()
     self.assertEqual(d["errors"], ["rot_matrix"])
     os.remove(os.path.join(subdir, "error.1.tar.gz"))
     shutil.copy("KPOINTS.orig", "KPOINTS")
     os.remove("KPOINTS.orig")
开发者ID:shyamd,项目名称:custodian,代码行数:13,代码来源:test_handlers.py

示例10: test_aliasing

    def test_aliasing(self):
        os.chdir(os.path.join(test_dir, "aliasing"))
        shutil.copy("INCAR", "INCAR.orig")
        h = VaspErrorHandler("vasp.aliasing")
        h.check()
        d = h.correct()
        shutil.move("INCAR.orig", "INCAR")
        clean_dir()
        os.chdir(test_dir)

        self.assertEqual(d["errors"], ['aliasing'])
        self.assertEqual(d["actions"],
                         [{'action': {'_set': {'NGX': 34}},
                           'dict': 'INCAR'}, {"file": "CHGCAR",
                            "action": {"_file_delete": {'mode': "actual"}}},
                          {"file": "WAVECAR",
                            "action": {"_file_delete": {'mode': "actual"}}}])
开发者ID:image-tester,项目名称:custodian,代码行数:17,代码来源:test_handlers.py

示例11: test_static_run_correction

    def test_static_run_correction(self):
        shutil.copy("OSZICAR.empty", "OSZICAR")
        s1 = Structure.from_file("POSCAR")
        incar = Incar.from_file("INCAR")

        # Test for NSW 0
        incar.update({"NSW": 0})
        incar.write_file("INCAR")
        h = VaspErrorHandler("vasp.out")
        self.assertEqual(h.check(), True)
        d = h.correct()
        self.assertEqual(d['errors'], ['zpotrf'])
        s2 = Structure.from_file("POSCAR")
        self.assertAlmostEqual(s2.volume, s1.volume, 3)
        self.assertEqual(Incar.from_file("INCAR")["ISYM"], 0)

        # Test for ISIF 0-2
        incar.update({"NSW":99, "ISIF":2})
        incar.write_file("INCAR")
        h = VaspErrorHandler("vasp.out")
        self.assertEqual(h.check(), True)
        d = h.correct()
        self.assertEqual(d['errors'], ['zpotrf'])
        s2 = Structure.from_file("POSCAR")
        self.assertAlmostEqual(s2.volume, s1.volume, 3)
        self.assertEqual(Incar.from_file("INCAR")["ISYM"], 0)
开发者ID:shyamd,项目名称:custodian,代码行数:26,代码来源:test_handlers.py

示例12: test_brmix

    def test_brmix(self):
        h = VaspErrorHandler("vasp.brmix")
        self.assertEqual(h.check(), True)
        d = h.correct()
        self.assertEqual(d["errors"], ['brmix'])
        self.assertFalse(os.path.exists("CHGCAR"))

        shutil.copy("INCAR.nelect", "INCAR")
        h = VaspErrorHandler("vasp.brmix")
        self.assertEqual(h.check(), False)
        d = h.correct()
        self.assertEqual(d["errors"], [])
开发者ID:image-tester,项目名称:custodian,代码行数:12,代码来源:test_handlers.py

示例13: test_subspace

    def test_subspace(self):
        h = VaspErrorHandler("vasp.subspace")
        h.check()
        d = h.correct()
        self.assertEqual(d["errors"], ['subspacematrix'])
        self.assertEqual(d["actions"],
                         [{'action': {'_set': {'LREAL': False}},
                           'dict': 'INCAR'}])

        # 2nd error should set PREC to accurate.
        h.check()
        d = h.correct()
        self.assertEqual(d["errors"], ['subspacematrix'])
        self.assertEqual(d["actions"],
                         [{'action': {'_set': {'PREC': 'Accurate'}},
                           'dict': 'INCAR'}])
开发者ID:shyamd,项目名称:custodian,代码行数:16,代码来源:test_handlers.py

示例14: test_brmix

    def test_brmix(self):
        h = VaspErrorHandler("vasp.brmix")
        self.assertEqual(h.check(), True)
        d = h.correct()
        self.assertEqual(d["errors"], ['brmix'])

        vi = VaspInput.from_directory(".")
        chgcar_exists = os.path.exists("CHGCAR")
        if h.error_count['brmix'] > 1:
            self.assertFalse(chgcar_exists)
        else:
            self.assertTrue(chgcar_exists)
            if vi["KPOINTS"].style == Kpoints.supported_modes.Gamma and vi["KPOINTS"].num_kpts < 1:
                all_kpts_even = all([
                    bool(n % 2 == 0) for n in vi["KPOINTS"].kpts[0]
                ])
                self.assertFalse(all_kpts_even)

        shutil.copy("INCAR.nelect", "INCAR")
        h = VaspErrorHandler("vasp.brmix")
        self.assertEqual(h.check(), False)
        d = h.correct()
        self.assertEqual(d["errors"], [])
开发者ID:aykol,项目名称:custodian,代码行数:23,代码来源:test_handlers.py

示例15: test_point_group

 def test_point_group(self):
     h = VaspErrorHandler("vasp.point_group")
     self.assertEqual(h.check(), True)
     self.assertEqual(h.correct()["errors"], ["point_group"])
     i = Incar.from_file("INCAR")
     self.assertEqual(i["ISYM"], 0)
开发者ID:shyamd,项目名称:custodian,代码行数:6,代码来源:test_handlers.py


注:本文中的custodian.vasp.handlers.VaspErrorHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。