materialsproject / api

New API client for the Materials Project
https://materialsproject.github.io/api/
Other
105 stars 34 forks source link

MPRester can not reproduce the same pourbaix diagram as MP website #855

Closed Jeff-oakley closed 9 months ago

Jeff-oakley commented 9 months ago

I am trying to reproduce the same pourbaix diagram as shown in Materials Project. However, I find the pourbaix diagram generated is different from what I find in Materials Project website. I tried to switch solid_compat between MaterialsProjectCompatibility and MaterialsProject2020Compatibility but failed to reproduce the same pourbaix diagram. Here is the reference pourbaix digarm from Materials Project. I am look at FeNi3 and it shows as an stable entry in some region of Pourbaix diagram as well Screen Shot 2023-10-12 at 11 00 10

Here is the code I used to query the entries and generate the same pourbaix diagram.

def get_pourbaix_stability(ele_lst, target_comp):
    """
    Args:
        ele_lst: The list of elements to be considered
        target_comp: The target composition to show stability
    """
    mpr = MPRester('HgxDEuZIOSRIDxNncSMKLVBi5NCk36W3')
    pb_entries = mpr.get_pourbaix_entries(ele_lst,solid_compat='MaterialsProjectCompatibility')

    pbd = PourbaixDiagram(pb_entries,filter_solids=False)
    pbp = PourbaixPlotter(pbd)
    pbp.show()

    for entry in pbd.all_entries:
        print(entry.composition.get_integer_formula_and_factor()[0])
        if entry.composition.get_integer_formula_and_factor()[0] == \
            Composition(target_comp).get_integer_formula_and_factor()[0]:
            target_entry = deepcopy(entry)
            break

    ax = pbp.plot_entry_stability(
        target_entry,V_range=[-1,2],
        cmap='PiYG_r',
        **{'label_domains': False, 'show_neutral_axes': False,'limits':[[0,14],[-1.0,2.0]]}
    )

get_pourbaix_stability(['Fe','Ni'], 'FeNi3')

The call of method get_pourbaix_stability can not even obtain FeNi3 as a valid entry. Also in the function all valid entry compositions will be printed out. I only see entries with Fe:Ni = 1:3. Is that some issues of the new requester or maybe I did not do the right thing?

Jeff-oakley commented 9 months ago

I think I figure out the issue. I need to use the right concentration.