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


Python VaspErrorHandler.check方法代码示例

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


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

示例1: test_static_run_correction

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    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,代码行数:28,代码来源:test_handlers.py

示例2: test_brmix

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    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,代码行数:35,代码来源:test_handlers.py

示例3: test_dentet

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:10,代码来源:test_handlers.py

示例4: test_too_few_bands

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:14,代码来源:test_handlers.py

示例5: test_brmix

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    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,代码行数:14,代码来源:test_handlers.py

示例6: test_rot_matrix

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:15,代码来源:test_handlers.py

示例7: test_nicht_konv

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:9,代码来源:test_handlers.py

示例8: test_subspace

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    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,代码行数:18,代码来源:test_handlers.py

示例9: test_aliasing

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    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,代码行数:19,代码来源:test_handlers.py

示例10: test_eddrmm

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:11,代码来源:test_handlers.py

示例11: test_rhosyg

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:11,代码来源:test_handlers.py

示例12: test_first_step

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:11,代码来源:test_handlers.py

示例13: test_potim_correction

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
 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,代码行数:12,代码来源:test_handlers.py

示例14: test_check_correct

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    def test_check_correct(self):
        h = VaspErrorHandler("vasp.teterror")
        h.check()
        d = h.correct()
        self.assertEqual(d["errors"], ['tet'])
        self.assertEqual(d["actions"],
                         [{'action': {'_set': {'ISMEAR': 0}},
                           'dict': 'INCAR'}])
        h = VaspErrorHandler("vasp.sgrcon")
        h.check()
        d = h.correct()
        self.assertEqual(d["errors"], ['rot_matrix'])
        self.assertEqual(set([a["dict"] for a in d["actions"]]),
                         {"KPOINTS"})

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

        subdir = os.path.join(test_dir, "large_cell_real_optlay")
        os.chdir(subdir)
        shutil.copy("INCAR", "INCAR.orig")
        h = VaspErrorHandler()
        h.check()
        d = h.correct()
        self.assertEqual(d["errors"], ['real_optlay'])
        vi = VaspInput.from_directory(".")
        self.assertEqual(vi["INCAR"]["LREAL"], True)
        h.check()
        d = h.correct()
        self.assertEqual(d["errors"], ['real_optlay'])
        vi = VaspInput.from_directory(".")
        self.assertEqual(vi["INCAR"]["LREAL"], False)
        shutil.copy("INCAR.orig", "INCAR")
        os.remove("INCAR.orig")
        os.remove("error.1.tar.gz")
        os.remove("error.2.tar.gz")
        os.chdir(test_dir)
开发者ID:xhqu1981,项目名称:custodian,代码行数:44,代码来源:test_handlers.py

示例15: test_brmix

# 需要导入模块: from custodian.vasp.handlers import VaspErrorHandler [as 别名]
# 或者: from custodian.vasp.handlers.VaspErrorHandler import check [as 别名]
    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,代码行数:25,代码来源:test_handlers.py


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