Agent skill

Mat Pourbaix Diagram

by learningmatter-mit in learningmatter-mit/AtomisticSkills

Calculate Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using water-corrected MLIP energies and pymatgen.

MITAuto-check passedDevelopment

Install Mat Pourbaix Diagram

skills CLI
$ npx skills add learningmatter-mit/AtomisticSkills --skill mat-pourbaix-diagram -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install learningmatter-mit/AtomisticSkills mat-pourbaix-diagram --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/learningmatter-mit/AtomisticSkills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mat-pourbaix-diagram .claude/skills/mat-pourbaix-diagram && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mat-pourbaix-diagram
GitHub stars
176
Token cost
~2.6k tokens
SKILL.md length
1,057 words
Files
13 (incl. scripts)
Skills in repo
129
Repo updated
First seen
Licence
MIT

At a glance

Calculate Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using water-corrected MLIP energies and pymatgen.

  • Works in 2 steps: Automated Referencing → Interpret Results
  • Tasks that involve Diagrams
  • SKILL.md covers Goal, Features, Background and Resources, plus 4 more sections
  • Runs Python scripts from its folder; needs MP_API_KEY

What it does

Mat Pourbaix Diagram is an agent skill from learningmatter-mit/AtomisticSkills. Calculate Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using water-corrected MLIP energies and pymatgen.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 15 other files, including scripts (for example `examples/README.md`, `resources/README.md` and `resources/example_chemsys.json`).

It sits in Development, covering Diagrams and Physical and earth sciences. It works with Model Context Protocol. The repository describes itself as: Integrating AtomisticSkills into Agentic IDEs (Cursor, Claude Code, Codex, Google Antigravity, Hermes Agent, etc). The licence is MIT.

When your agent uses it

  • Tasks that involve Diagrams
  • Tasks that involve Physical and earth sciences

Example prompts

  • “/mat-pourbaix-diagram”

Requirements

  • Python 3
  • A credential in MP_API_KEY

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Automated Referencing
  2. Interpret Results

What it can do on your machine

Read from SKILL.md and the folder at commit 6257444. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • doi.org
    • arxiv.org
    • pymatgen.org
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • MP_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mat Pourbaix Diagram loads about 2.6k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 1,057 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from learningmatter-mit/AtomisticSkills at commit 6257444, republished under its MIT licence (© learningmatter-mit). 1,057 words, ~2,622 tokens.

Download SKILL.mdSave it as .claude/skills/mat-pourbaix-diagram/SKILL.md (or your agent's skills folder). This skill also uses 12 other files; get the full folder from GitHub.
name
mat-pourbaix-diagram
description
Calculate Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using water-corrected MLIP energies and pymatgen.
metadata.category
materials
metadata.venv
cpu, fairchem

Pourbaix Diagram

<!-- mcp-tools-note -->

[!NOTE] Steps written server.tool are MCP tool calls: fairchem.load_model is the load_model tool of the fairchem server (mcp__fairchem__load_model, or mcp__plugin_atomistic-skills_fairchem__load_model when 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 by load_model stays loaded:

bash
${CLAUDE_SKILL_DIR}/../../venv/run fairchem python -m src.mcp_server.cli fairchem load_model key=value relax_structure key=value

Goal

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:

  • Alkaline-stable solid-state electrolytes (Li-air batteries)
  • Corrosion-resistant materials
  • Aqueous battery electrodes
  • Electrochemical stability screening

Features

  • Automated Referenced: Fetches elemental energies from elemental-energies skill to fill missing terminal entries (e.g., if you relaxed LiCoO2 but forgot Li metal, it will be auto-loaded).
  • H2O Reference: Checks 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.
  • MP2020 Compatibility: Automatically detects if compatibility corrections are needed via gga-ggau-mixed-mlips.yaml.

Background

Pourbaix Diagrams

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.

Critical: Thermodynamic Consistency

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.

3. Automated Referencing

The script calculate_pourbaix.py automatically:

  1. Fetches per-atom elemental energies from the elemental-energies skill.
  2. Applies thermodynamic corrections for H₂ gas ($S^\circ$, $\Delta H$) to deriving $\mu_H$.
  3. Uses a locally relaxed H₂O structure to derive $\mu_O$, ensuring correct water formation energy.
    • H2O Reference: Checks 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

  • resources/h2o_energies.json: A dictionary mapping MLIP checkpoint names (e.g., MACE-MP-medium, uma-s-1_omat) to the relaxed energy of H2O per atom. This avoids the need for manual H2O relaxation when using supported MLIPs.

Methods: MLIP vs. Pure Materials Project

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.

bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_pourbaix_mp.py \
    --comp_dict "Li=1,Fe=1" \
    --output ./output_dir
Method 2: MLIP-Calculated Workflow (For novel/specific structures)

Use this workflow to calculate stability using specific MLIP models. This involves fetching structures, relaxing them, and then generating the diagram.

1. Get Structures from Materials Project

Query all relevant solid phases and reference molecules:

bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/get_pourbaix_structures.py \
    --chemsys "Zn" \
    --output_dir ./structures/

This retrieves:

  • All solid phases in the chemical system (e.g., Zn, ZnO, ZnO2, etc.)
  • Reference molecule: H₂O (Required for water correction)
2. Select Foundation Potential

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-1 with matpes_r2scan head.
Show full SKILL.md (455 more words)Show less
3. Relax Reference H₂O

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:

python
# 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.

4. Relax Solid Phases

Relax all solid phases (and included H2O) using the same MLIP:

python
# 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!

5. Calculate Pourbaix Diagram

Construct the diagram using automated referencing (fetching elemental energies and deriving corrections internally):

bash
${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, CHGNet). 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!

6. Interpret Results

The scripts generate:

  • pourbaix_diagram.png: Visual representation
  • stable_entries.json: List of all stable phases in the diagram
  • Stability domains for each phase across pH/V space

Interpretation:

  • Solid domain: Material is thermodynamically stable as a solid
  • Ion domain: Material dissolves into aqueous ions
  • Passivation: Material covered by protective oxide layer

Constraints

  • Energy Consistency: All structures (molecules + solids) MUST be relaxed with the same MLIP model.
  • Water Correction: REQUIRED for thermodynamic consistency. Skipping water correction will produce incorrect diagrams.
  • Convergence: Use fmax ≤ 0.02 eV/Å for both molecules and solids.
  • Chemical System: Automatically determined from target material and MP ion data.
  • Temperature: Calculations assume 298 K (25°C).
  • Reference Electrode: Results are vs. Standard Hydrogen Electrode (SHE).
  • Materials Project Access: Requires MP_API_KEY environment variable.
  • DFT Validation: For publication-quality results, validate critical stability boundaries with DFT.

Theoretical Background

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:

  • MLIP total energies for solids
  • MP Gibbs free energies for aqueous ions

References

  1. 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

  2. Hierarchical screening methodology: arXiv:2511.20964

  3. Pymatgen Pourbaix module: https://pymatgen.org/pymatgen.analysis.pourbaix_diagram.html

  4. Related skills:


Author: Bowen Deng Contact: GitHub @learningmatter-mit

© learningmatter-mit, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 12 other files (scripts) in skills/mat-pourbaix-diagram of learningmatter-mit/AtomisticSkills.

  • SKILL.md
  • examples/NaNi_MP.png
  • examples/NaNi_MatPES_r2SCAN.png
  • examples/README.md
  • resources/H2.cif
  • resources/H2O.cif
  • resources/O2.cif
  • resources/README.md
  • resources/example_chemsys.json
  • resources/h2o_energies.json
  • scripts/calculate_pourbaix.py
  • scripts/calculate_pourbaix_mp.py
  • scripts/get_pourbaix_structures.py

Open the folder on GitHubat commit 6257444

Compare with similar skills

Mat Pourbaix Diagram next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mat Pourbaix Diagram compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mat Pourbaix Diagram this skilllearningmatter-mit/AtomisticSkills176—~2.6kAutomated safety check: PassMIT
Excalidraw Skillyctimlin/mcp_excalidraw2.5k—~4.6kAutomated safety check: PassMIT
GitDiagram Repository Overviewahmedkhaleel2004/gitdiagram18k—~427Automated safety check: PassMIT
Drawio Diagram BuilderWill-hxw/drawio-diagram-builder412—~5.9kAutomated safety check: PassMIT
Drawiobahayonghang/drawio-skills286—~4.1kAutomated safety check: NotesMIT
Mermaid Diagramsveelenga/claude-mermaid214—~1.3kAutomated safety check: PassMIT

Similar skills

  • Excalidraw Skill

    yctimlin/mcp_excalidraw

    Excalidraw canvas toolkit for creating, editing, and refining diagrams on a live canvas.

    2.5k GitHub stars~4.6k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • GitDiagram Repository Overview

    ahmedkhaleel2004/gitdiagram

    Explains the architecture of a public GitHub repository through GitDiagram: how the code is organized, the main components with paths, and a Mermaid diagram.

    18k GitHub stars~427 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Drawio Diagram Builder

    Will-hxw/drawio-diagram-builder

    Create, edit, replicate, and iteratively refine editable research and technical diagrams in diagrams.net/draw.io (.drawio XML) from prompts, papers, repositories, screenshots, or existing diagrams.

    412 GitHub stars~5.9k tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Drawio

    bahayonghang/drawio-skills

    Create, edit, replicate, import, and export draw.io diagrams with an offline YAML-first workflow: architecture, network topologies, flowcharts, UML/ER, org charts, Mermaid/CSV conversion, existing…

    286 GitHub stars~4.1k tokensUpdated 1 mo ago
    DevelopmentAuto-check: notes
  • Mermaid Diagrams

    veelenga/claude-mermaid

    Creating and refining Mermaid diagrams with live reload. An agent skill from veelenga/claude-mermaid.

    214 GitHub stars~1.3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Drawio Chart

    Snailclimb/AIGuide

    Draw.io 配图专家:用于生成和导出 .drawio 图表。在用户要求 draw.io、diagrams.net、流程图、架构图、时序图、ER 图、状态图、思维导图,或明确提到 .drawio、PNG、SVG、PDF 导出、技术文章配图时使用。默认输出专业技术风格,并遵循 floracat-architecture-diagram 的视觉规范。

    669 GitHub stars~687 tokensUpdated 3 mo ago
    DevelopmentAuto-check passed

More from learningmatter-mit/AtomisticSkills

All 129 skills in this repo
  • Drug Binding Site Definition

    learningmatter-mit/AtomisticSkills

    Define a docking search box (center coordinates + box dimensions in Angstroms) from a co-crystal ligand, binding-site residues, or a saved JSON specification.

    176 GitHub stars~2.9k tokensUpdated yesterday
    Auto-check passed
  • Drug Complex System Builder

    learningmatter-mit/AtomisticSkills

    Build a solvated, charge-neutralized protein-ligand complex for OpenMM molecular dynamics simulation.

    176 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Drug Pocket Detection

    learningmatter-mit/AtomisticSkills

    Identify and rank ligandable pockets on a protein structure or model using geometry (fpocket) or an ML predictor (P2Rank).

    176 GitHub stars~4k tokensUpdated yesterday
    Auto-check passed
  • Chem Bond Dissociation

    learningmatter-mit/AtomisticSkills

    Calculate homolytic and heterolytic bond dissociation energies (BDEs) for all single bonds in a molecule using MLIPs with RDKit fragmentation.

    176 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check passed
  • Chem Conformer Search

    learningmatter-mit/AtomisticSkills

    Generate molecular conformers with RDKit ETKDG, relax with MLIPs, and rank by energy with Boltzmann weighting.

    176 GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • Chem DB Mof

    learningmatter-mit/AtomisticSkills

    Query multiple MOF databases (QMOF via MPContribs; ARC-MOF DB7/Majumdar et al.

    176 GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Mat Pourbaix Diagram

What does Mat Pourbaix Diagram do?

Calculate Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using water-corrected MLIP energies and pymatgen. Mat Pourbaix Diagram is an agent skill from learningmatter-mit/AtomisticSkills. Calculate Pourbaix (pH-voltage) diagrams for aqueous electrochemical stability using water-corrected MLIP energies and pymatgen.

When should I use Mat Pourbaix Diagram?

Mat Pourbaix Diagram fits situations like: tasks that involve Diagrams; tasks that involve Physical and earth sciences.

How do I install Mat Pourbaix Diagram in Claude Code?

Run `npx skills add learningmatter-mit/AtomisticSkills --skill mat-pourbaix-diagram -a claude-code`. Or copy the skill folder (skills/mat-pourbaix-diagram in learningmatter-mit/AtomisticSkills) into .claude/skills/mat-pourbaix-diagram in your project. Claude Code loads it when a task matches its description.

How do I install Mat Pourbaix Diagram in Codex?

Run `npx skills add learningmatter-mit/AtomisticSkills --skill mat-pourbaix-diagram -a codex`. Or copy the skill folder (skills/mat-pourbaix-diagram in learningmatter-mit/AtomisticSkills) into .agents/skills/mat-pourbaix-diagram in your project. Codex loads it when a task matches its description.

Can I use Mat Pourbaix Diagram in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add learningmatter-mit/AtomisticSkills --skill mat-pourbaix-diagram -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mat-pourbaix-diagram, .gemini/skills/mat-pourbaix-diagram, .github/skills/mat-pourbaix-diagram and .opencode/skills/mat-pourbaix-diagram in your project.

What does Mat Pourbaix Diagram need to run?

Going by SKILL.md and its folder, Mat Pourbaix Diagram needs Python for the scripts in its folder and credentials named MP_API_KEY. Our summary lists: Python 3; A credential in MP_API_KEY.

Does Mat Pourbaix Diagram access the network?

SKILL.md names 4 domains. As links in the text: doi.org, arxiv.org, pymatgen.org and github.com. This is read from the text; nothing was executed.

Is Mat Pourbaix Diagram safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Mat Pourbaix Diagram use?

Mat Pourbaix Diagram is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mat Pourbaix Diagram use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mat Pourbaix Diagram?

Skills that share tags, products or a category with Mat Pourbaix Diagram: Excalidraw Skill (yctimlin/mcp_excalidraw, 2.5k stars), GitDiagram Repository Overview (ahmedkhaleel2004/gitdiagram, 18k stars), Drawio Diagram Builder (Will-hxw/drawio-diagram-builder, 412 stars) and Drawio (bahayonghang/drawio-skills, 286 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mat Pourbaix Diagram?

learningmatter-mit (a GitHub organization) maintains it in learningmatter-mit/AtomisticSkills, which has 176 GitHub stars. The repository holds 129 skills in this directory. The repository was last updated on October 7, 2026.

Source: learningmatter-mit/AtomisticSkills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.