當前位置: 首頁>>代碼示例>>Python>>正文


Python MPRester.get_entry_by_material_id方法代碼示例

本文整理匯總了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
#.........這裏部分代碼省略.........
開發者ID:matk86,項目名稱:pymatgen,代碼行數:103,代碼來源:surface_analysis.py

示例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:
開發者ID:miaoliu,項目名稱:MVB,代碼行數:33,代碼來源:plt_coordinates.py


注:本文中的pymatgen.MPRester.get_entry_by_material_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。