Pourbaix diagrams of the compounds with the same elements but different formulas

Hello:

Recently, I try to extract the Gibbs energies from the Pourbaix diagram at different PHs and potentials.
I found something confused me.
For example, I want to know if the RuO2 is stable at PH=0 for ORR and OER.
I checked the RuO2 (mp-825) in the Materials Project and found the Gibbs energy is 0 - ~0.12 eV/atom at PH=0 and potentials are in the range of 0.6-1.2 V.
But if I checked the RuO4(mp-547094) in the Materials Project, there are also the region for the RuO2 but the Gibbs energy of RuO2 in the Pourbaix diagram of RuO4 is different from that was extracted from the RuO2 (mp-825).

So may I ask if there are some reference standard for all the Pourbaix diagrams? If I want to extracted the Gibbs energies for different compounds, what should I do? For example, if I want to have the Gibbs energy for the RuO2, what is the difference between the results in the mp-825 and mp-547094? Which one I should choose? is there some formulas I should consider?

I am looking forward to hearing from you.
Thank you very much in advance.

Best regards
Xue

Hi @Xue_Jia , a good starting point for understanding the reference standard, thermodynamic formulas, etc. behind our Pourbaix Diagrams is the MP Documentation Page. From there, you might consider reading some of the linked papers for even more detail.

As to your specific question - the Pourbaix Diagrams that are shown on the “Aqueous Stability” section of any material have color coding that indicates the free energy of all the phases in the chemical system relative to the material whose page you are on. Essentially, it shows you a stability map of that material. So mp-825 will have a Gpbx = 0 by definition on the mp-825 detail page, and mp-547094 will have Gpx=0 on the mp-547094 detail page. However, the Pourbaix domains (the regions labeled with different phases) are the same, and they indicate which phases are stable.

If you open the Pourbaix Diagram app on the left sidebar of the website, you can make this Pourbaix diagram yourself, and you have the option to disable the shading.

I hope this helps!

Dear Mr Rkingsbury:

Thank you very much for your reply,
I will study the related documents you recommended to me.

I am so sorry to bother you but I still have an another problem regarding the poubiax diagram.
Recently, I have updated my pymatgen to the newest version, but the program to extract the poubiax diagram has been changed. I haven’t find the “help documents” about the new program for the poubiax diagram.

For example, the poubiax diagram program using the old version is

entry = m.get_entries(material_id)[0]
composition = entry.composition
comp_dict = {str(key):value for key, value in composition. items()
if key not in ELEMENTS_HO}
    # Ge t da ta
    #fetch_start = time.time()
    data = m.get_pourbaix_entries(list(comp_dict.keys()))
    #fetch_elapsed = time.time()−fetch_start
if len(data) > 0:
    entry = [e for e in data if e.entry_id == material_id][0]
    pbx = PourbaixDiagram(data, comp_dict=comp_dict, filter_solids = False)

But in the new version, they don’t work!

I tried to change the code such as
ion_data = self.get_ion_reference_data_for_chemsys(chemsys)…
But it didn’t work as well.

So could you give some suggestion about it?

Many thanks in advance.

Best regards
Xue

Hi @Xue_Jia , sorry you’re having trouble. I’m not sure why your code snippet is not working in the newer version. As I think you’re aware, we have recently transitioned to a new API client (which you get via pip install mp-api and import as from mp_api.client import MPRester) which replaces the legacy on that still lives in pymatgen itself. Note that you need a different API key to use the new client - full docs here. For the interactive Pourbaix diagrams on the website - this docs page might also help if you haven’t seen it.

I’d say the most likely problem is that you are trying to use an old API key with the new API. Other than that, your code snippet looks like it should work to me. What is the specific error you’re getting?

Dear Mr Rkingsbury:

Thank you so much for your reply.
Yes, I have transferred to the new version using "from mp_api.client import MPRester“.
I also get the new API key, but the program doesn’t work.

Do you mean the programs are the same between the old version and the same version if I want to extract the data of Poubiax diagram?
Does it mean the above program also works in the old version?

I guess there may be some confits in my computer. I will check it carefully.

Thanks again.

Best regards
Xue

Hi Xue, I’m sorry to hear you’re still having trouble. I’d like to help, but in order to do so I need you to post the specific code and error messages that you are seeing. Otherwise there’s no way for me to know what the problem might be.

Dear Mr Rkingsbury:
Thanks for your reply.
Sorry to reply to you so late.
My codes are as following:

#from pymatgen.ext.matproj import MPRester
from mp_api.client import MPRester
from tqdm.autonotebook import tqdm
import numpy as np
import pandas as pd
import pymatgen.analysis.phase_diagram as phase_diagram
import pymatgen.analysis.pourbaix_diagram as pbx
from pymatgen.core import Composition
from pymatgen.entries.computed_entries import ComputedStructureEntry
from pymatgen.ext.matproj import MPRester
#m = MPRester("key")
m = MPRester("key")
import time
from pymatgen.analysis.pourbaix_diagram import PourbaixDiagram,ELEMENTS_HO, PourbaixPlotter


material_id = 'mp-1224786'
entry = m.get_entries(material_id)[0]
composition = entry.composition
comp_dict = {str(key):value for key, value in composition. items()
            if key not in ELEMENTS_HO}
        # Ge t da ta
        #fetch_start = time.time()
data = m.get_pourbaix_entries(list(comp_dict.keys()))
entry = [e for e in data if e.entry_id == material_id][0]
pbx = PourbaixDiagram(data, comp_dict=comp_dict, filter_solids = False)





---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_1636\2818593477.py in <cell line: 2>()
      1 material_id = 'mp-1224786'
----> 2 entry = m.get_entries(material_id)[0]
      3 composition = entry.composition
      4 comp_dict = {str(key):value for key, value in composition. items()
      5             if key not in ELEMENTS_HO}

AttributeError: 'MPRester' object has no attribute 'get_entries'

Since I transfered to use the mp-api, the program didn’t work.
So if there also are some updates for the programms to extract the data by the new api?

Best regards
Xue

Hi, I also found “get_pourbaix_entries” also didn’t work in the new mp-api.

Looking at your code, I think you are still calling the legacy MPRester, because your last import

from pymatgen.ext.matproj import MPRester

will override the previous import

from mp_api.client import MPRester

Second, I just want to confirm that in your working code you replace "key" in m = MPRester("key") with your actual API key, correct?

Because the error message indicates the MPRester is not being instantiated (i.e., that m=MPRester not m=MPRester()

Thread closed due to inactivity, please open a new thread to address related issues.