本文整理汇总了Python中pymatgen.MPRester.get_entry_by_material_id方法的典型用法代码示例。如果您正苦于以下问题:Python MPRester.get_entry_by_material_id方法的具体用法?Python MPRester.get_entry_by_material_id怎么用?Python MPRester.get_entry_by_material_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.MPRester
的用法示例。
在下文中一共展示了MPRester.get_entry_by_material_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SurfaceEnergyAnalyzer
# 需要导入模块: from pymatgen import MPRester [as 别名]
# 或者: from pymatgen.MPRester import get_entry_by_material_id [as 别名]
class SurfaceEnergyAnalyzer(object):
"""
A class used for analyzing the surface energies of a material of a given
material_id. By default, this will use entries calculated from the
Materials Project to obtain chemical potential and bulk energy. As a
result, the difference in VASP parameters between the user's entry
(vasprun_dict) and the parameters used by Materials Project, may lead
to a rough estimate of the surface energy. For best results, it is
recommend that the user calculates all decomposition components first,
and insert the results into their own database as a pymatgen-db entry
and use those entries instead (custom_entries). In addition, this code
will only use one bulk entry to calculate surface energy. Ideally, to
get the most accurate surface energy, the user should compare their
slab energy to the energy of the oriented unit cell with both calculations
containing consistent k-points to avoid converegence problems as the
slab size is varied. See:
Sun, W.; Ceder, G. Efficient creation and convergence of surface slabs,
Surface Science, 2013, 617, 53–59, doi:10.1016/j.susc.2013.05.016.
and
Rogal, J., & Reuter, K. (2007). Ab Initio Atomistic Thermodynamics for
Surfaces : A Primer. Experiment, Modeling and Simulation of Gas-Surface
Interactions for Reactive Flows in Hypersonic Flights, 2–1 – 2–18.
.. attribute:: ref_element
All chemical potentials cna be written in terms of the range of chemical
potential of this element which will be used to calculate surface energy.
.. attribute:: mprester
Materials project rester for querying entries from the materials project.
Requires user MAPIKEY.
.. attribute:: ucell_entry
Materials Project entry of the material of the slab.
.. attribute:: x
Reduced amount composition of decomposed compound A in the bulk.
.. attribute:: y
Reduced amount composition of ref_element in the bulk.
.. attribute:: gbulk
Gibbs free energy of the bulk per formula unit
.. attribute:: chempot_range
List of the min and max chemical potential of ref_element.
.. attribute:: e_of_element
Energy per atom of ground state ref_element, eg. if ref_element=O,
than e_of_element=1/2*E_O2.
.. attribute:: vasprun_dict
Dictionary containing a list of Vaspruns for slab calculations as
items and the corresponding Miller index of the slab as the key
"""
def __init__(self, material_id, vasprun_dict, ref_element,
exclude_ids=[], custom_entries=[], mapi_key=None):
"""
Analyzes surface energies and Wulff shape of a particular
material using the chemical potential.
Args:
material_id (str): Materials Project material_id (a string,
e.g., mp-1234).
vasprun_dict (dict): Dictionary containing a list of Vaspruns
for slab calculations as items and the corresponding Miller
index of the slab as the key.
eg. vasprun_dict = {(1,1,1): [vasprun_111_1, vasprun_111_2,
vasprun_111_3], (1,1,0): [vasprun_111_1, vasprun_111_2], ...}
element: element to be considered as independent
variables. E.g., if you want to show the stability
ranges of all Li-Co-O phases wrt to uLi
exclude_ids (list of material_ids): List of material_ids
to exclude when obtaining the decomposition components
to calculate the chemical potential
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
#.........这里部分代码省略.........
示例2:
# 需要导入模块: from pymatgen import MPRester [as 别名]
# 或者: from pymatgen.MPRester import get_entry_by_material_id [as 别名]
#print "coordination number = 2, e^hull < 50meV/atom"
#for ic in cursor:
# if ic["c_num"] == 2 and ic["ehull"] <0.05:
# print mpr.get_entry_by_material_id(ic["task_id"]).composition.reduced_formula
# print "https://materialsproject.org/materials/"+ic["task_id"]+"/"
#cursor = cddb.find()
#print "coordination number = 3, e^hull < 50meV/atom"
#for ic in cursor:
# if ic["c_num"] == 3 and ic["ehull"] <0.05:
# print mpr.get_entry_by_material_id(ic["task_id"]).composition.reduced_formula
# print "https://materialsproject.org/materials/"+ic["task_id"]+"/"
cursor = cddb.find()
print "coordination number = 5, e^hull < 50meV/atom"
for ic in cursor:
if ic["c_num"] == 5 and ic["ehull"] <0.05:
print mpr.get_entry_by_material_id(ic["task_id"]).composition.reduced_formula
print "https://materialsproject.org/materials/"+ic["task_id"]+"/"
cursor = cddb.find()
print "coordination number = 8, e^hull < 50meV/atom"
for ic in cursor:
if ic["c_num"] == 8 and ic["ehull"] <0.05:
print mpr.get_entry_by_material_id(ic["task_id"]).composition.reduced_formula
print "https://materialsproject.org/materials/"+ic["task_id"]+"/"
'''
for c in cursor:
#if c["c_num"]== 3:
# plt.errorbar(c["c_dis"], c["ehull"], xerr=c["c_dis_"], yerr=0.0,color="blue",fmt="-o",alpha=0.5)
#if c["c_num"]== 4:
# plt.errorbar(c["c_dis"], c["ehull"], xerr=c["c_dis_"], yerr=0.0,linewidth=1,color="green",ms= 2,marker="o",alpha=0.1)
#if c["c_num"]== 5: