/atomistic-skills:mat-pourbaix-diagramfrom Atomistic Skills
Calculates Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using MLIP energies and pymatgen. Useful for assessing corrosion resistance, battery electrode stability, and solid-state electrolyte durability.
Ships in Atomistic Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
[!NOTE] Steps written
server.toolare MCP tool calls:fairchem.load_modelis theload_modeltool of thefairchemserver (mcp__fairchem__load_model, ormcp__plugin_atomistic-skills_fairchem__load_modelwhen installed as a plugin). Without a connected server, run the same tools from the shell. Tools named in one command share a process, so a model loaded byload_modelstays loaded:${CLAUDE_SKILL_DIR}/../../venv/run fairchem python -m src.mcp_server.cli fairchem load_model key=value relax_structure key=value
To calculate thermodynamically consistent Pourbaix (pH-voltage) diagrams for assessing the aqueous electrochemical stability of materials. This skill uses Machine Learning Interatomic Potentials (MLIPs) for solid phase energies combined with Materials Project data for aqueous species, following the rigorous methodology of Persson et al. (2012)¹.
Applications:
mat-elemental-energies skill to fill missing terminal entries (e.g., if you relaxed LiCoO2 but forgot Li metal, it will be auto-loaded).resources/h2o_energies.json values matching the MLIP checkpoint. If found, uses this pre-calculated energy. If not found, falls back to look for H2O relaxation in the --relaxed_solids directory.gga-ggau-mixed-mlips.yaml.A Pourbaix diagram shows the thermodynamically stable phases as a function of pH and electrochemical potential (voltage vs. SHE). The diagram maps stability domains for solids and dissolved ions in aqueous environments.
The Challenge: Mixing computational (MLIP/DFT) solid energies with experimental aqueous ion data creates energy scale mismatch.
The Solution (Persson et al. 2012)¹: Water correction that aligns MLIP water formation energy with experimental Gibbs free energy. We use a robust cycle that fixes the hydrogen reference to the Standard Hydrogen Electrode (SHE) scale.
The script calculate_pourbaix.py automatically:
mat-elemental-energies skill.resources/h2o_energies.json values matching the MLIP checkpoint. If found, uses this pre-calculated energy. If not found, falls back to look for H2O relaxation in the --relaxed_solids directory.Is calculate_water_correction.py still needed?
No. The correction logic is now internal to calculate_pourbaix.py to simplify the workflow.
resources/h2o_energies.json: A dictionary mapping MLIP checkpoint names (e.g., MACE-MP-medium, uma-s-1p1_omat) to the relaxed energy of H2O per atom. This avoids the need for manual H2O relaxation when using supported MLIPs. Keys are {model}_{head} where a head applies; a model absent from the file falls back to relaxing H2O locally. The uma-s-1_* entries are a record of a checkpoint matgl/fairchem no longer serve — inert, not selectable.There are two ways to generate Pourbaix diagrams using this skill. Prioritize Method 1 (Pure MP) if the target chemical system's energies are likely present and accurate in the Materials Project database. Use Method 2 (MLIP) when investigating novel materials, specific polymorphs not in MP, or when high-fidelity MLIP energies are preferred.
Use calculate_pourbaix_mp.py to fetch entries directly from Materials Project. This requires no local relaxation and uses MP's internal DFT energies.
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_pourbaix_mp.py \
--comp_dict "Li=1,Fe=1" \
--output ./output_dir
Use this workflow to calculate stability using specific MLIP models. This involves fetching structures, relaxing them, and then generating the diagram.
Query all relevant solid phases and reference molecules:
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/get_pourbaix_structures.py \
--chemsys "Zn" \
--output_dir ./structures/
This retrieves:
Choose an appropriate MLIP based on your system (see ${CLAUDE_SKILL_DIR}/../ml-foundation-potentials/SKILL.md).
[!IMPORTANT] Recommended for Pourbaix diagrams: MatPES-r2SCAN To ensure energy scale compatibility with Materials Project aqueous ions (which are often based on r2SCAN or compatible corrections), prioritize using r2SCAN-trained MLIPs.
- MatGL:
CHGNet-PES-MatPES-r2SCAN-1M-2026.9- MACE:
MACE-MH-1withmatpes_r2scanhead.
The script get_pourbaix_structures.py automatically copies H₂O into the references/ subdirectory.
Relax it using the same MLIP model to allow internal calibration:
# Example with FairChem UMA-small (recommended)
fairchem.load_model(model_name="uma-s-1p1")
# Relax H2O reference
fairchem.relax_structure(
structure_data="./structures/references/H2O.cif",
fmax=0.02,
steps=500,
relax_cell=True,
output_dir="./relaxed_solids/" # SAVE TO SAME DIR AS SOLIDS
)
Critical: Use fmax ≤ 0.02 eV/Å for reliable energies.
Note: H₂ and O₂ references are NOT required to be relaxed locally because the script uses pre-computed elemental energies for gas phase corrections. Only H₂O is needed for determining the specific water formation energy offset.
Relax all solid phases (and included H2O) using the same MLIP:
# Batch relax all solids with same MLIP
# (Model already loaded from step 3)
fairchem.relax_structure(
structure_data="./structures/structures/", # Directory with all CIF files
relax_cell=True,
fmax=0.02,
steps=500,
output_dir="./relaxed_solids/"
)
Critical: Use the same MLIP model for molecules and solids!
Construct the diagram using automated referencing (fetching elemental energies and deriving corrections internally):
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_pourbaix.py \
--relaxed_solids ./relaxed_solids/ \
--target "Zn" \
--mlip_name "uma-s-1p1" \
--output ./pourbaix_results/ \
--apply_solid_compat
Parameters:
--relaxed_solids: Directory with MLIP-relaxed solid structures (MUST include the relaxed H2O)--target: Target metal element (or use --comp_dict for multi-element)--comp_dict: (Optional) Composition dictionary for K-nary systems (e.g. "Li=1,Fe=1")--mlip_name: Name for the plot title (and for looking up elemental energies)--output: Output directory--apply_solid_compat: (Optional) Apply Materials Project 2020 compatibility corrections. Use only if your MLIP is trained on MP data (e.g. MACE-MP). Do NOT use for UMA or generic potentials unless verified.--ion_concentration: Ion concentration in M (default: 1e-6)Critical: Use the same MLIP for all structures in a single workflow!
The scripts generate:
pourbaix_diagram.png: Visual representationstable_entries.json: List of all stable phases in the diagramInterpretation:
fmax ≤ 0.02 eV/Å for both molecules and solids.MP_API_KEY environment variable.Following Persson et al. (2012)¹, the grand Pourbaix potential is:
ϕ_pbx = G - μ_H·N_H - μ_O·N_O - eV·Q
The water correction aligns MLIP solid energies (computational scale) with MP aqueous ion free energies (experimental scale) by enforcing:
ΔGf(H₂O)_corrected = -2.4583 eV (experimental)
This allows thermodynamically consistent mixing of:
K. A. Persson, B. Waldwick, P. Lazic, G. Ceder. "Prediction of solid-aqueous equilibria: Scheme to combine first-principles calculations of solids with experimental aqueous states." Physical Review B 85, 235438 (2012). DOI:10.1103/PhysRevB.85.235438
Hierarchical screening methodology: arXiv:2511.20964
Pymatgen Pourbaix module: https://pymatgen.org/pymatgen.analysis.pourbaix_diagram.html
Related skills:
Author: Bowen Deng Contact: GitHub @learningmatter-mit
examples/NaNi_MP.png (opens in a new tab)examples/NaNi_MatPES_r2SCAN.png (opens in a new tab)examples/README.md (opens in a new tab)resources/H2.cif (opens in a new tab)resources/H2O.cif (opens in a new tab)resources/O2.cif (opens in a new tab)resources/README.md (opens in a new tab)resources/example_chemsys.json (opens in a new tab)resources/h2o_energies.json (opens in a new tab)scripts/calculate_pourbaix.py (opens in a new tab)scripts/calculate_pourbaix_mp.py (opens in a new tab)scripts/get_pourbaix_structures.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
133 skills in this plugin
/chem-bond-dissociationCalculate homolytic and heterolytic bond dissociation energies (BDEs) for all single bonds in a molecule using MLIPs with RDKit fragmentation./chem-conformer-searchGenerate molecular conformers with RDKit ETKDG, relax with MLIPs, and rank by energy with Boltzmann weighting./chem-db-mofQuery multiple MOF databases (QMOF via MPContribs; ARC-MOF DB7/Majumdar et al. via Materials Cloud) and download CIF structures with optional element or identifier filters.npx claudepluginhub learningmatter-mit/atomisticskills --plugin atomistic-skillsOther plugins' skills for the same job