本文整理汇总了Python中pymatgen.MPRester.get_entries_in_chemsys方法的典型用法代码示例。如果您正苦于以下问题:Python MPRester.get_entries_in_chemsys方法的具体用法?Python MPRester.get_entries_in_chemsys怎么用?Python MPRester.get_entries_in_chemsys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.MPRester
的用法示例。
在下文中一共展示了MPRester.get_entries_in_chemsys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SurfaceEnergyAnalyzer
# 需要导入模块: from pymatgen import MPRester [as 别名]
# 或者: from pymatgen.MPRester import get_entries_in_chemsys [as 别名]
#.........这里部分代码省略.........
custom_entries (list of pymatgen-db type entries): List of
user specified pymatgen-db type entries to use in finding
decomposition components for the chemical potential
mapi_key (str): Materials Project API key for accessing the
MP database via MPRester
"""
self.ref_element = ref_element
self.mprester = MPRester(mapi_key) if mapi_key else MPRester()
self.ucell_entry = \
self.mprester.get_entry_by_material_id(material_id,
inc_structure=True,
property_data=
["formation_energy_per_atom"])
ucell = self.ucell_entry.structure
# Get x and y, the number of species in a formula unit of the bulk
reduced_comp = ucell.composition.reduced_composition.as_dict()
if len(reduced_comp.keys()) == 1:
x = y = reduced_comp[ucell[0].species_string]
else:
for el in reduced_comp.keys():
if self.ref_element == el:
y = reduced_comp[el]
else:
x = reduced_comp[el]
# Calculate Gibbs free energy of the bulk per unit formula
gbulk = self.ucell_entry.energy /\
(len([site for site in ucell
if site.species_string == self.ref_element]) / y)
entries = [entry for entry in
self.mprester.get_entries_in_chemsys(list(reduced_comp.keys()),
property_data=["e_above_hull",
"material_id"])
if entry.data["e_above_hull"] == 0 and
entry.data["material_id"] not in exclude_ids] \
if not custom_entries else custom_entries
pd = PhaseDiagram(entries)
chempot_ranges = pd.get_chempot_range_map([Element(self.ref_element)])
# If no chemical potential is found, we return u=0, eg.
# for a elemental system, the relative u of Cu for Cu is 0
chempot_range = [chempot_ranges[entry] for entry in chempot_ranges.keys()
if entry.composition ==
self.ucell_entry.composition][0][0]._coords if \
chempot_ranges else [[0,0], [0,0]]
e_of_element = [entry.energy_per_atom for entry in
entries if str(entry.composition.reduced_composition)
== self.ref_element + "1"][0]
self.x = x
self.y = y
self.gbulk = gbulk
chempot_range = list(chempot_range)
self.chempot_range = sorted([chempot_range[0][0], chempot_range[1][0]])
self.e_of_element = e_of_element
self.vasprun_dict = vasprun_dict
def calculate_gamma(self, vasprun):
"""
Calculates the surface energy for a single slab.
Args:
vasprun (Vasprun): A Vasprun object