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


Python inputs.VaspInput类代码示例

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


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

示例1: test_from_directory

 def test_from_directory(self):
     vi = VaspInput.from_directory(test_dir, optional_files={"CONTCAR.Li2O": Poscar})
     self.assertEqual(vi["INCAR"]["ALGO"], "Damped")
     self.assertIn("CONTCAR.Li2O", vi)
     d = vi.as_dict()
     vinput = VaspInput.from_dict(d)
     self.assertIn("CONTCAR.Li2O", vinput)
开发者ID:gpetretto,项目名称:pymatgen,代码行数:7,代码来源:test_inputs.py

示例2: VaspInputTest

class VaspInputTest(PymatgenTest):
    def setUp(self):
        filepath = self.TEST_FILES_DIR / 'INCAR'
        incar = Incar.from_file(filepath)
        filepath = self.TEST_FILES_DIR / 'POSCAR'
        poscar = Poscar.from_file(filepath,check_for_POTCAR=False)
        if "PMG_VASP_PSP_DIR" not in os.environ:
            os.environ["PMG_VASP_PSP_DIR"] = str(self.TEST_FILES_DIR)
        filepath = self.TEST_FILES_DIR / 'POTCAR'
        potcar = Potcar.from_file(filepath)
        filepath = self.TEST_FILES_DIR / 'KPOINTS.auto'
        kpoints = Kpoints.from_file(filepath)
        self.vinput = VaspInput(incar, kpoints, poscar, potcar)

    def test_to_from_dict(self):
        d = self.vinput.as_dict()
        vinput = VaspInput.from_dict(d)
        comp = vinput["POSCAR"].structure.composition
        self.assertEqual(comp, Composition("Fe4P4O16"))

    def test_write(self):
        tmp_dir = Path("VaspInput.testing")
        self.vinput.write_input(tmp_dir)

        filepath = tmp_dir / "INCAR"
        incar = Incar.from_file(filepath)
        self.assertEqual(incar["NSW"], 99)

        for name in ("INCAR", "POSCAR", "POTCAR", "KPOINTS"):
            (tmp_dir / name).unlink()

        tmp_dir.rmdir()

    def test_run_vasp(self):
        # To add some test.
        with ScratchDir(".") as d:
            self.vinput.run_vasp(d, vasp_cmd=["cat", "INCAR"])
            with open(os.path.join(d, "vasp.out"), "r") as f:
                output = f.read()
                self.assertEqual(output.split("\n")[0], "ALGO = Damped")

    def test_from_directory(self):
        vi = VaspInput.from_directory(self.TEST_FILES_DIR,
                                      optional_files={"CONTCAR.Li2O": Poscar})
        self.assertEqual(vi["INCAR"]["ALGO"], "Damped")
        self.assertIn("CONTCAR.Li2O", vi)
        d = vi.as_dict()
        vinput = VaspInput.from_dict(d)
        self.assertIn("CONTCAR.Li2O", vinput)
开发者ID:adengz,项目名称:pymatgen,代码行数:49,代码来源:test_inputs.py

示例3: VaspInputTest

class VaspInputTest(unittest.TestCase):

    def setUp(self):
        filepath = os.path.join(test_dir, 'INCAR')
        incar = Incar.from_file(filepath)
        filepath = os.path.join(test_dir, 'POSCAR')
        poscar = Poscar.from_file(filepath)
        if "VASP_PSP_DIR" not in os.environ:
            test_potcar_dir = os.path.abspath(
                os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
                             "test_files"))
            os.environ["VASP_PSP_DIR"] = test_potcar_dir
        filepath = os.path.join(test_dir, 'POTCAR')
        potcar = Potcar.from_file(filepath)
        filepath = os.path.join(test_dir, 'KPOINTS.auto')
        kpoints = Kpoints.from_file(filepath)
        self.vinput = VaspInput(incar, kpoints, poscar, potcar)

    def test_to_from_dict(self):
        d = self.vinput.as_dict()
        vinput = VaspInput.from_dict(d)
        comp = vinput["POSCAR"].structure.composition
        self.assertEqual(comp, Composition("Fe4P4O16"))

    def test_write(self):
        tmp_dir = "VaspInput.testing"
        self.vinput.write_input(tmp_dir)

        filepath = os.path.join(tmp_dir, "INCAR")
        incar = Incar.from_file(filepath)
        self.assertEqual(incar["NSW"], 99)

        for name in ("INCAR", "POSCAR", "POTCAR", "KPOINTS"):
            os.remove(os.path.join(tmp_dir, name))

        os.rmdir(tmp_dir)

    def test_from_directory(self):
        vi = VaspInput.from_directory(test_dir,
                                      optional_files={"CONTCAR.Li2O": Poscar})
        self.assertEqual(vi["INCAR"]["ALGO"], "Damped")
        self.assertIn("CONTCAR.Li2O", vi)
        d = vi.as_dict()
        vinput = VaspInput.from_dict(d)
        self.assertIn("CONTCAR.Li2O", vinput)
开发者ID:Bismarrck,项目名称:pymatgen,代码行数:45,代码来源:test_inputs.py

示例4: setUp

 def setUp(self):
     filepath = self.TEST_FILES_DIR / 'INCAR'
     incar = Incar.from_file(filepath)
     filepath = self.TEST_FILES_DIR / 'POSCAR'
     poscar = Poscar.from_file(filepath,check_for_POTCAR=False)
     if "PMG_VASP_PSP_DIR" not in os.environ:
         os.environ["PMG_VASP_PSP_DIR"] = str(self.TEST_FILES_DIR)
     filepath = self.TEST_FILES_DIR / 'POTCAR'
     potcar = Potcar.from_file(filepath)
     filepath = self.TEST_FILES_DIR / 'KPOINTS.auto'
     kpoints = Kpoints.from_file(filepath)
     self.vinput = VaspInput(incar, kpoints, poscar, potcar)
开发者ID:adengz,项目名称:pymatgen,代码行数:12,代码来源:test_inputs.py

示例5: setUp

 def setUp(self):
     filepath = os.path.join(test_dir, 'INCAR')
     incar = Incar.from_file(filepath)
     filepath = os.path.join(test_dir, 'POSCAR')
     poscar = Poscar.from_file(filepath,check_for_POTCAR=False)
     if "PMG_VASP_PSP_DIR" not in os.environ:
         test_potcar_dir = os.path.abspath(
             os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
                          "test_files"))
         os.environ["PMG_VASP_PSP_DIR"] = test_potcar_dir
     filepath = os.path.join(test_dir, 'POTCAR')
     potcar = Potcar.from_file(filepath)
     filepath = os.path.join(test_dir, 'KPOINTS.auto')
     kpoints = Kpoints.from_file(filepath)
     self.vinput = VaspInput(incar, kpoints, poscar, potcar)
开发者ID:ExpHP,项目名称:pymatgen,代码行数:15,代码来源:test_inputs.py

示例6: setUp

 def setUp(self):
     filepath = os.path.join(test_dir, "INCAR")
     incar = Incar.from_file(filepath)
     filepath = os.path.join(test_dir, "POSCAR")
     poscar = Poscar.from_file(filepath)
     if "VASP_PSP_DIR" not in os.environ:
         test_potcar_dir = os.path.abspath(
             os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "test_files")
         )
         os.environ["VASP_PSP_DIR"] = test_potcar_dir
     filepath = os.path.join(test_dir, "POTCAR")
     potcar = Potcar.from_file(filepath)
     filepath = os.path.join(test_dir, "KPOINTS.auto")
     kpoints = Kpoints.from_file(filepath)
     self.vinput = VaspInput(incar, kpoints, poscar, potcar)
开发者ID:gpetretto,项目名称:pymatgen,代码行数:15,代码来源:test_inputs.py

示例7: test_to_from_dict

 def test_to_from_dict(self):
     d = self.vinput.as_dict()
     vinput = VaspInput.from_dict(d)
     comp = vinput["POSCAR"].structure.composition
     self.assertEqual(comp, Composition("Fe4P4O16"))
开发者ID:ExpHP,项目名称:pymatgen,代码行数:5,代码来源:test_inputs.py


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