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


Python Incar.from_string方法代码示例

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


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

示例1: test_lsorbit_magmom

# 需要导入模块: from pymatgen.io.vasp.inputs import Incar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Incar import from_string [as 别名]
    def test_lsorbit_magmom(self):
        magmom1 = [[0.0, 0.0, 3.0], [0, 1, 0], [2, 1, 2]]
        magmom2 = [-1, -1, -1, 0, 0, 0, 0, 0]

        ans_string1 = "LSORBIT = True\nMAGMOM = 0.0 0.0 3.0 0 1 0 2 1 2\n"
        ans_string2 = "LSORBIT = True\nMAGMOM = 3*3*-1 3*5*0\n"
        ans_string3 = "LSORBIT = False\nMAGMOM = 2*-1 2*9\n"

        incar = Incar({})
        incar["MAGMOM"] = magmom1
        incar["LSORBIT"] = "T"
        self.assertEqual(ans_string1, str(incar))

        incar["MAGMOM"] = magmom2
        incar["LSORBIT"] = "T"
        self.assertEqual(ans_string2, str(incar))

        incar = Incar.from_string(ans_string1)
        self.assertEqual(incar["MAGMOM"], [[0.0, 0.0, 3.0], [0, 1, 0], [2, 1, 2]])

        incar = Incar.from_string(ans_string2)
        self.assertEqual(
            incar["MAGMOM"],
            [[-1, -1, -1], [-1, -1, -1], [-1, -1, -1], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],
        )

        incar = Incar.from_string(ans_string3)
        self.assertFalse(incar["LSORBIT"])
        self.assertEqual(incar["MAGMOM"], [-1, -1, 9, 9])
开发者ID:gpetretto,项目名称:pymatgen,代码行数:31,代码来源:test_inputs.py

示例2: test_quad_efg

# 需要导入模块: from pymatgen.io.vasp.inputs import Incar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Incar import from_string [as 别名]
 def test_quad_efg(self):
     incar1 = Incar({})
     incar1["LEFG"] = True
     incar1["QUAD_EFG"] = [0.0, 146.6, -25.58]
     ans_string1 = "LEFG = True\nQUAD_EFG = 0.0 146.6 -25.58\n"
     self.assertEqual(ans_string1, str(incar1))
     incar2 = Incar.from_string(ans_string1)
     self.assertEqual(ans_string1, str(incar2))
开发者ID:ExpHP,项目名称:pymatgen,代码行数:10,代码来源:test_inputs.py

示例3: test_lsorbit_magmom

# 需要导入模块: from pymatgen.io.vasp.inputs import Incar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Incar import from_string [as 别名]
    def test_lsorbit_magmom(self):
        magmom1 = [[0.0, 0.0, 3.0], [0, 1, 0], [2, 1, 2]]
        magmom2 = [-1, -1, -1, 0, 0, 0, 0, 0]
        magmom4 = [Magmom([1.0, 2.0, 2.0])]

        ans_string1 = "LANGEVIN_GAMMA = 10 10 10\nLSORBIT = True\n" \
                      "MAGMOM = 0.0 0.0 3.0 0 1 0 2 1 2\n"
        ans_string2 = "LANGEVIN_GAMMA = 10\nLSORBIT = True\n" \
                      "MAGMOM = 3*3*-1 3*5*0\n"
        ans_string3 = "LSORBIT = False\nMAGMOM = 2*-1 2*9\n"
        ans_string4_nolsorbit = "LANGEVIN_GAMMA = 10\nLSORBIT = False\nMAGMOM = 1*3.0\n"
        ans_string4_lsorbit = "LANGEVIN_GAMMA = 10\nLSORBIT = True\nMAGMOM = 1.0 2.0 2.0\n"

        incar = Incar({})
        incar["MAGMOM"] = magmom1
        incar["LSORBIT"] = "T"
        incar["LANGEVIN_GAMMA"] = [10, 10, 10]
        self.assertEqual(ans_string1, str(incar))

        incar["MAGMOM"] = magmom2
        incar["LSORBIT"] = "T"
        incar["LANGEVIN_GAMMA"] = 10
        self.assertEqual(ans_string2, str(incar))

        incar["MAGMOM"] = magmom4
        incar["LSORBIT"] = "F"
        self.assertEqual(ans_string4_nolsorbit, str(incar))
        incar["LSORBIT"] = "T"
        self.assertEqual(ans_string4_lsorbit, str(incar))

        incar = Incar.from_string(ans_string1)
        self.assertEqual(incar["MAGMOM"],
                         [[0.0, 0.0, 3.0], [0, 1, 0], [2, 1, 2]])
        self.assertEqual(incar["LANGEVIN_GAMMA"], [10, 10, 10])

        incar = Incar.from_string(ans_string2)
        self.assertEqual(incar["MAGMOM"], [[-1, -1, -1], [-1, -1, -1],
                                           [-1, -1, -1], [0, 0, 0],
                                           [0, 0, 0], [0, 0, 0],
                                           [0, 0, 0], [0, 0, 0]])
        self.assertEqual(incar["LANGEVIN_GAMMA"], [10])

        incar = Incar.from_string(ans_string3)
        self.assertFalse(incar["LSORBIT"])
        self.assertEqual(incar["MAGMOM"], [-1, -1, 9, 9])
开发者ID:ExpHP,项目名称:pymatgen,代码行数:47,代码来源:test_inputs.py

示例4: test_types

# 需要导入模块: from pymatgen.io.vasp.inputs import Incar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Incar import from_string [as 别名]
    def test_types(self):
        incar_str = """ALGO = Fast
ECUT = 510
EDIFF = 1e-07
EINT = -0.85 0.85
IBRION = -1
ICHARG = 11
ISIF = 3
ISMEAR = 1
ISPIN = 1
LPARD = True
NBMOD = -3
PREC = Accurate
SIGMA = 0.1"""
        i = Incar.from_string(incar_str)
        self.assertIsInstance(i["EINT"], list)
        self.assertEqual(i["EINT"][0], -0.85)

        incar_str += "\nLHFCALC = .TRUE. ; HFSCREEN = 0.2"
        incar_str += "\nALGO = All;"
        i = Incar.from_string(incar_str)
        self.assertTrue(i["LHFCALC"])
        self.assertEqual(i["HFSCREEN"], 0.2)
        self.assertEqual(i["ALGO"], "All")
开发者ID:ExpHP,项目名称:pymatgen,代码行数:26,代码来源:test_inputs.py

示例5: test_types

# 需要导入模块: from pymatgen.io.vasp.inputs import Incar [as 别名]
# 或者: from pymatgen.io.vasp.inputs.Incar import from_string [as 别名]
    def test_types(self):
        incar_str = """ALGO = Fast
ECUT = 510
EDIFF = 1e-07
EINT = -0.85 0.85
IBRION = -1
ICHARG = 11
ISIF = 3
ISMEAR = 1
ISPIN = 1
LPARD = True
NBMOD = -3
PREC = Accurate
SIGMA = 0.1"""
        i = Incar.from_string(incar_str)
        self.assertIsInstance(i["EINT"], list)
        self.assertEqual(i["EINT"][0], -0.85)
开发者ID:matk86,项目名称:pymatgen,代码行数:19,代码来源:test_inputs.py


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