本文整理汇总了Python中pymatgen.entries.computed_entries.ComputedEntry类的典型用法代码示例。如果您正苦于以下问题:Python ComputedEntry类的具体用法?Python ComputedEntry怎么用?Python ComputedEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComputedEntry类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, structure, kpoints, incar, energy, correction=0.0,
parameters=None, data=None, entry_id=None):
ComputedEntry.__init__(self, structure.composition, energy,
correction=correction,
parameters=parameters,
data=data, entry_id=entry_id)
self.structure = structure
self.kpoints = kpoints
self.incar = incar
示例2: as_entry
def as_entry(self, energies):
"""
Returns a ComputedEntry representation of the reaction.
:return:
"""
comp = sum(self._all_comp, Composition())
entry = ComputedEntry(0.5 * comp, self.calculate_energy(energies))
entry.name = self.__str__()
return entry
示例3: as_entry
def as_entry(self, energies):
"""
Returns a ComputedEntry representation of the reaction.
:return:
"""
relevant_comp = [comp * abs(coeff) for coeff, comp
in zip(self._coeffs, self._all_comp)]
comp = sum(relevant_comp, Composition())
entry = ComputedEntry(0.5 * comp, self.calculate_energy(energies))
entry.name = self.__str__()
return entry
示例4: setUp
def setUp(self):
self.entry = ComputedEntry(vasprun.final_structure.composition,
vasprun.final_energy,
parameters=vasprun.incar)
self.entry2 = ComputedEntry({"Fe": 2, "O": 3}, 2.3)
self.entry3 = ComputedEntry("Fe2O3", 2.3)
self.entry4 = ComputedEntry("Fe2O3", 2.3, entry_id=1)
示例5: setUp
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)
示例6: ComputedEntryTest
class ComputedEntryTest(unittest.TestCase):
def setUp(self):
self.entry = ComputedEntry(vasprun.final_structure.composition, vasprun.final_energy, parameters=vasprun.incar)
self.entry2 = ComputedEntry({"Fe": 2, "O": 3}, 2.3)
self.entry3 = ComputedEntry("Fe2O3", 2.3)
self.entry4 = ComputedEntry("Fe2O3", 2.3, entry_id=1)
def test_energy(self):
self.assertAlmostEqual(self.entry.energy, -269.38319884)
self.entry.correction = 1.0
self.assertAlmostEqual(self.entry.energy, -268.38319884)
self.assertAlmostEqual(self.entry3.energy_per_atom, 2.3 / 5)
def test_composition(self):
self.assertEqual(self.entry.composition.reduced_formula, "LiFe4(PO4)4")
self.assertEqual(self.entry2.composition.reduced_formula, "Fe2O3")
def test_to_from_dict(self):
d = self.entry.as_dict()
e = ComputedEntry.from_dict(d)
self.assertAlmostEqual(e.energy, -269.38319884)
def test_entry_id(self):
self.assertEqual(self.entry4.entry_id, 1)
self.assertEqual(self.entry2.entry_id, None)
def test_str(self):
self.assertIsNotNone(str(self.entry))
示例7: test_get_corrections_dict
def test_get_corrections_dict(self):
compat = MaterialsProjectCompatibility()
ggacompat = MaterialsProjectCompatibility("GGA")
#Correct parameters
entry = ComputedEntry(
'Fe2O3', -1, 0.0,
parameters={'is_hubbard': True, 'hubbards': {'Fe': 5.3, 'O': 0},
'run_type': 'GGA+U',
'potcar_symbols': ['PAW_PBE Fe_pv 06Sep2000',
'PAW_PBE O 08Apr2002']})
c = compat.get_corrections_dict(entry)
self.assertAlmostEqual(c["MP Gas Correction"], -2.10687)
self.assertAlmostEqual(c["MP Advanced Correction"], -5.466)
entry.parameters["is_hubbard"] = False
del entry.parameters["hubbards"]
c = ggacompat.get_corrections_dict(entry)
self.assertNotIn("MP Advanced Correction", c)
示例8: test_get_corrections_dict
def test_get_corrections_dict(self):
compat = MaterialsProjectCompatibility(check_potcar_hash=False)
ggacompat = MaterialsProjectCompatibility("GGA", check_potcar_hash=False)
#Correct parameters
entry = ComputedEntry(
'Fe2O3', -1, 0.0,
parameters={'is_hubbard': True, 'hubbards': {'Fe': 5.3, 'O': 0},
'run_type': 'GGA+U',
'potcar_spec': [{'titel':'PAW_PBE Fe_pv 06Sep2000',
'hash': '994537de5c4122b7f1b77fb604476db4'},
{'titel': 'PAW_PBE O 08Apr2002',
'hash': "7a25bc5b9a5393f46600a4939d357982"}]})
c = compat.get_corrections_dict(entry)
self.assertAlmostEqual(c["MP Anion Correction"], -2.10687)
self.assertAlmostEqual(c["MP Advanced Correction"], -5.466)
entry.parameters["is_hubbard"] = False
del entry.parameters["hubbards"]
c = ggacompat.get_corrections_dict(entry)
self.assertNotIn("MP Advanced Correction", c)
示例9: from_dict
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)
示例10: test_to_from_dict
def test_to_from_dict(self):
d = self.entry.to_dict
e = ComputedEntry.from_dict(d)
self.assertAlmostEqual(e.energy, -269.38319884)
示例11: test_sulfide_energy
def test_sulfide_energy(self):
self.entry = ComputedEntry("BaS", -10.21249155)
self.assertAlmostEqual(self.entry.energy, -10.21249155)
self.assertAlmostEqual(self.entry.energy_per_atom, -10.21249155 / 2)
self.entry.correction = 1.0
self.assertAlmostEqual(self.entry.energy, -9.21249155)
示例12: convert
def convert(self, d):
if 'structure' in d:
return ComputedStructureEntry.from_dict(d)
else:
return ComputedEntry.from_dict(d)