本文整理汇总了Python中pymatgen.entries.computed_entries.ComputedEntry.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python ComputedEntry.from_dict方法的具体用法?Python ComputedEntry.from_dict怎么用?Python ComputedEntry.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.entries.computed_entries.ComputedEntry
的用法示例。
在下文中一共展示了ComputedEntry.from_dict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from pymatgen.entries.computed_entries import ComputedEntry [as 别名]
# 或者: from pymatgen.entries.computed_entries.ComputedEntry import from_dict [as 别名]
def setUp(self):
d = [
{"correction": 0.0, "data": {}, "energy": -108.56492362, "parameters": {}, "composition": {"Li": 54}},
{
"correction": 0.0,
"data": {},
"energy": -577.94689128,
"parameters": {},
"composition": {"O": 32, "Li": 64},
},
{"correction": 0.0, "data": {}, "energy": -17.02844794, "parameters": {}, "composition": {"O": 2}},
{
"correction": 0.0,
"data": {},
"energy": -959.64693323,
"parameters": {},
"composition": {"O": 72, "Li": 72},
},
]
entries = []
for e in d:
entries.append(ComputedEntry.from_dict(e))
rcts = list(filter(lambda e: e.composition.reduced_formula in ["Li", "O2"], entries))
prods = list(filter(lambda e: e.composition.reduced_formula == "Li2O2", entries))
self.rxn = ComputedReaction(rcts, prods)
示例2: from_dict
# 需要导入模块: from pymatgen.entries.computed_entries import ComputedEntry [as 别名]
# 或者: from pymatgen.entries.computed_entries.ComputedEntry import from_dict [as 别名]
def from_dict(cls, d):
entries = [ComputedEntry.from_dict(dd) for dd in d["all_entries"]]
elements = [Element.from_dict(dd) for dd in d["elements"]]
return cls(entries, elements)
示例3: test_to_from_dict
# 需要导入模块: from pymatgen.entries.computed_entries import ComputedEntry [as 别名]
# 或者: from pymatgen.entries.computed_entries.ComputedEntry import from_dict [as 别名]
def test_to_from_dict(self):
d = self.entry.to_dict
e = ComputedEntry.from_dict(d)
self.assertAlmostEqual(e.energy, -269.38319884)
示例4: convert
# 需要导入模块: from pymatgen.entries.computed_entries import ComputedEntry [as 别名]
# 或者: from pymatgen.entries.computed_entries.ComputedEntry import from_dict [as 别名]
def convert(self, d):
if 'structure' in d:
return ComputedStructureEntry.from_dict(d)
else:
return ComputedEntry.from_dict(d)