Пример #1
0
def aq_correction(entries):
    """
    Applies the Materials Project Aqueous Compatibility scheme for mixing GGA
    and GGA+U to a list of entries.
    Removes entries which aren't compatible with the mixing scheme

    Args:
        entries: List of entries on which the correction will be applied
    """
    #| -  aq_correction
    from pymatgen.entries.compatibility import MaterialsProjectAqueousCompatibility

    def contains_entry(entry_list, ent):
        """
        Helpful to filter duplicate entries, if entry
        is in entry_list, return True
        Args:
            entry_list: list of pymatgen entries to consider
            entry: entry which will be analyzed
        """

        ent_id = ent.entry_id
        ent_E = ent.energy_per_atom
        ent_redfor = ent.composition.reduced_formula
        for e in entry_list:
            if e.entry_id == ent_id or (abs(ent_E - e.energy_per_atom) < 1e-6
            and ent_redfor == e.composition.reduced_formula):
                return True

    aqcompat = MaterialsProjectAqueousCompatibility() #Implements the GGA/GGA+U mixing scheme,

    entries_aqcorr = list()
    for entry in entries:
        aq_corrected_entry = aqcompat.process_entry(entry) #Corrections, if none applicable, gets rid of entry

        if not contains_entry(entries_aqcorr, aq_corrected_entry): #If entry already in entries_aqcorr don't add
            entries_aqcorr.append(aq_corrected_entry)

    return entries_aqcorr
Пример #2
0
#__|

#NOTE This line assumes that the every entry in the experimental ion energy
# has the same ref. st. solid
ref_state = str(ion_dict[0]['Reference Solid'])
ref_dict = {ref_state: ion_dict[0]['Reference solid energy']}

# Run aqueouscorrection on the entries
# Entries without applicable corrections will be discarded
# Implements the GGA/GGA+U mixing scheme
aqcompat = MaterialsProjectAqueousCompatibility()

entries_aqcorr = list()
for entry in entries:
    # Applies corrections to entry, if none applicable it gets rid of entry
    aq_corrected_entry = aqcompat.process_entry(entry)
    # If entry already in entries_aqcorr then don't add to list
    if not contains_entry(entries_aqcorr, aq_corrected_entry):
        entries_aqcorr.append(aq_corrected_entry)

# Generate a phase diagram to consider only solid entries stable in water.
pd = PhaseDiagram(entries_aqcorr)
stable_solids = pd.stable_entries
stable_solids_minus_h2o = [
    entry for entry in stable_solids
    if entry.composition.reduced_formula not in ["H2", "O2", "H2O", "H2O2"]
]

# +
pbx_solid_entries = []
for entry in stable_solids_minus_h2o: