Beispiel #1
0
def get_mu_range(mpid, ext_elts=[]):
    if 'hse' in mpid:
        mpid = mpid.split('_')[0]
    try:
        entry = m.get_entry_by_material_id(mpid)
	in_MP = True
    except:
	from high_throughput.defects.database import TasksOperater
	in_MP = False
	TO = TasksOperater()
	id_ = TO.groups['bulk'][mpid][0]
	rec = TO.collection.find_one({'_id':id_},['output'])
	stru_tmp =Structure.from_dict(rec['output']['crystal'])
	energy = rec['output']['final_energy']
	entry = PDEntry(stru_tmp.composition, energy)
    elts = [i.symbol for i in entry.composition.elements]
    for i in ext_elts:
        elts.append(i)
    entries = m.get_entries_in_chemsys(elts)
    if not in_MP:
	entries.append(entry)
    for entry in entries:
        entry.correction = 0.0
    pd=PhaseDiagram(entries)
    pda=PDAnalyzer(pd)
    chempots={}
    decompositions=pda.get_decomposition(entry.composition).keys()
    decomposition_inds=[pd.qhull_entries.index(entry) for entry in decompositions]
    facets_around=[]
    for facet in pd.facets:
        is_facet_around=True
        for ind in decomposition_inds:
            if ind not in facet:
                is_facet_around=False
        if is_facet_around==True:
            facets_around.append(facet)
    for facet in facets_around:
        s=[]
        for ind in facet:
            s.append(str(pd.qhull_entries[ind].name))
        s.sort()
        chempots['-'.join(s)]=pda.get_facet_chempots(facet)
    chempots={i:{j.symbol:chempots[i][j] for j in chempots[i]} for i in chempots}
    return chempots