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


Python Reaction.as_entry方法代码示例

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


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

示例1: test_as_entry

# 需要导入模块: from pymatgen.analysis.reaction_calculator import Reaction [as 别名]
# 或者: from pymatgen.analysis.reaction_calculator.Reaction import as_entry [as 别名]
 def test_as_entry(self):
     reactants = [Composition("MgO"), Composition("Al2O3")]
     products = [Composition("MgAl2O4")]
     energies = {Composition("MgO"): -0.1, Composition("Al2O3"): -0.2, Composition("MgAl2O4"): -0.5}
     rxn = Reaction(reactants, products)
     entry = rxn.as_entry(energies)
     self.assertEqual(entry.name, "1.000 MgO + 1.000 Al2O3 -> 1.000 MgAl2O4")
     self.assertAlmostEquals(entry.energy, -0.2, 5)
开发者ID:rousseab,项目名称:pymatgen,代码行数:10,代码来源:test_reaction_calculator.py

示例2: test_as_entry

# 需要导入模块: from pymatgen.analysis.reaction_calculator import Reaction [as 别名]
# 或者: from pymatgen.analysis.reaction_calculator.Reaction import as_entry [as 别名]
    def test_as_entry(self):
        reactants = [Composition("MgO"), Composition("Al2O3")]
        products = [Composition("MgAl2O4")]
        energies = {Composition("MgO"): -0.1, Composition("Al2O3"): -0.2,
                    Composition("MgAl2O4"): -0.5}
        rxn = Reaction(reactants, products)
        entry = rxn.as_entry(energies)
        self.assertEqual(entry.name,
                         "1.000 MgO + 1.000 Al2O3 -> 1.000 MgAl2O4")
        self.assertAlmostEqual(entry.energy, -0.2, 5)

        products = [Composition("Fe"), Composition("O2")]
        reactants = [Composition("Fe2O3")]
        rxn = Reaction(reactants, products)
        energies = {Composition("Fe"): 0, Composition("O2"): 0,
                    Composition("Fe2O3"): 0.5}
        entry = rxn.as_entry(energies)
        self.assertEqual(entry.composition.formula, "Fe1.33333333 O2")
        self.assertAlmostEqual(entry.energy, -0.333333, 5)
开发者ID:Lightslayer,项目名称:pymatgen,代码行数:21,代码来源:test_reaction_calculator.py

示例3: test_as_entry

# 需要导入模块: from pymatgen.analysis.reaction_calculator import Reaction [as 别名]
# 或者: from pymatgen.analysis.reaction_calculator.Reaction import as_entry [as 别名]
    def test_as_entry(self):
        reactants = [Composition("MgO"), Composition("Al2O3")]
        products = [Composition("MgAl2O4")]
        energies = {Composition("MgO"): -0.1, Composition("Al2O3"): -0.2,
                    Composition("MgAl2O4"): -0.5}
        rxn = Reaction(reactants, products)
        entry = rxn.as_entry(energies)
        self.assertEqual(entry.name,
                         "MgO + Al2O3 -> MgAl2O4")
        self.assertAlmostEqual(entry.energy, -0.2, 5)

        products = [Composition("Fe"), Composition("O2")]
        reactants = [Composition("Fe2O3")]
        rxn = Reaction(reactants, products)
        energies = {Composition("Fe"): 0, Composition("O2"): 0,
                    Composition("Fe2O3"): 0.5}
        entry = rxn.as_entry(energies)
        self.assertEqual(entry.composition, Composition("Fe1.0 O1.5"))
        self.assertAlmostEqual(entry.energy, -0.25, 5)
开发者ID:bocklund,项目名称:pymatgen,代码行数:21,代码来源:test_reaction_calculator.py


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