本文整理汇总了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)
示例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)
示例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)