Skip to content
Agentmart
Submit a tool

mat-ionic-substitution

Discover new crystal structures by data-mined ionic substitution — propose candidates from existing structures (forward) or find potential structures for a…

Skill by learningmatter-mit

IndexedMIT★ 183
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/learningmatter-mit-mat-ionic-substitution

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Discover new crystal structures by data-mined ionic substitution — propose candidates from existing structures (forward) or find potential structures for a target composition (reverse).

Use cases: data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mat-ionic-substitution

What's inside

Skill name
mat-ionic-substitution
Description
Discover new crystal structures by data-mined ionic substitution — propose candidates from existing structures (forward) or find potential structures for a target composition (reverse).
License
MIT
Instructions
104 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (18)

  • SKILL.md
  • 000_Li2ZrCl6_from_Li2ZrF6_mp-542219.cif · examples/Li2ZrCl6_reverse/
  • 001_Li2ZrCl6_from_Li2ZrF6_mp-556176.cif · examples/Li2ZrCl6_reverse/
  • 002_Li2ZrCl6_from_Li2ZrF6_mp-4002.cif · examples/Li2ZrCl6_reverse/
  • 003_Li2ZrCl6_from_Rb2ZrCl6_mp-27831.cif · examples/Li2ZrCl6_reverse/
  • 004_Li2ZrCl6_from_Na2ZrF6_mp-27307.cif · examples/Li2ZrCl6_reverse/
  • README.md · examples/Li2ZrCl6_reverse/
  • structure_manifest.json · examples/Li2ZrCl6_reverse/
  • 000_NaFeO2.cif · examples/NaCoO2_forward/
  • 001_NaScO2.cif · examples/NaCoO2_forward/
  • 002_NaCrO2.cif · examples/NaCoO2_forward/
  • 003_NaAlO2.cif · examples/NaCoO2_forward/
  • 004_NaMnO2.cif · examples/NaCoO2_forward/
  • 016_LiCoO2.cif · examples/NaCoO2_forward/
  • README.md · examples/NaCoO2_forward/
  • substitution_manifest.json · examples/NaCoO2_forward/
  • find_structures_for_composition.py · scripts/
  • propose_substitutions.py · scripts/

SKILL.md (first lines)

# Ionic Substitution

## Goal

To discover new crystal structures using data-mined ionic substitution (Hautier et al. 2011). Two modes:

1. **Forward (propose)**: Given an existing structure, propose all high-probability ion-substituted variants. E.g., input NaCoO₂ → get LiCoO₂, KCoO₂, NaNiO₂, etc.
2. **Reverse (find)**: Given a target composition, find all known crystal structures that can be ion-substituted to create it, plus direct matches from Materials Project.

The substitution probability model is trained on the ICSD (Inorganic Crystal Structure Database) and captures empirical chemical rules about which ions commonly substitute for each other.

> [!TIP]
> After generating candidate structures, relax them with an MLIP and compute their [stability (E_hull)](../mat-stability/SKILL.md) to prioritize the most thermodynamically viable candidates.

## Instructions

### Mode 1: Forward — Propose substitutions from a structure

1. **Prepare a source structure** (CIF or POSCAR). Ensure it is an ordered structure.

2. **Run the forward proposal script**:
   ```bash
   ${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/propose_substitutions.py \
       --structure source.cif \
       --threshold 0.001 \
       --output_dir proposed_substitutions/
   ```

   The script will:
   - Auto-decorate the structure with oxidation states (if not already present)
   - Enumerate all charge-balanced ionic substitutions above the threshold
   - Handle single-ion, double-ion, and multi-ion swaps
   - Save each substituted structure as a CIF file
   - Generate a `substitution_manifest.json` with substitution maps and probabilities

3. **Review and filter results**: Higher probability → more likely to be stable. Relax top candidates with an MLIP.

### Mode 2: Reverse — Find structures for a target composition

1. **Run the reverse search script**:
   ```bash
   ${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/find_structures_for_composition.py \
       --composition LiCl \
       --threshold 0.001 \
       --output_dir structures_for_LiCl/
   ```

   The script will:
   - **Step A**: Query Materials Project for existing structures with the target formula
   - **Step B**: Use `SubstitutionPredictor` to find precursor compositions whose ions map to the target
   - **Step C**: Fetch precursor structures from MP and apply the substitutions
   - Save all candidate CIF files and a `structure_manifest.json` with full provenance

2. **Interpret results**: Each candidate includes:
   - Source: `"materials_project"` (direct match) or `"substitution"` (derived)
   - Substitution map: e.g., `{Na+→Li+}` and probability
   - Precursor MP material ID for traceability

### Mode 3: Manual Targeted Substitution via MCP

If you already know the exact substitution you want to make on a specific structure, you can immediately generate the new structure using the base MCP server's `modify_structure` tool:

- **`modify_structure` tool**: Maps an existing element to a new element or fraction.
  - Example 1 (Full replacement): `substitution_dict_json='{"Na": "Li"}'` (Replaces all Na with Li)
  - Example 2 (Partial/Alloying): `substitution_dict_json='{"Na": {"Li": 0.5, "Na": 0.5}}'` (Creates a 50/50 random mixture)

## Examples

### Example 1: Discover new Li-ion cathode from NaCoO₂
```bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/propose_substitutions.py \
    --structure NaCoO2.cif \
    --threshold 0.001 \
    --output_dir NaCoO2_substitutions/
```
Expected output includes: LiCoO₂, KCoO₂, NaNiO₂, NaMnO₂, LiNiO₂, etc.

### Example 2: Find all crystal structures for LiCl
```bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/find_structures_for_composition.py \
    --composition LiCl \
    --output_dir LiCl_structures/
```
Expected output includes: LiCl from MP + NaCl(Na→Li), KCl(K→Li), NaBr(Na→Li, Br→Cl), etc.

## Constraints

- **Oxidation States**: The probability model requires oxidation-state-decorated structures. The scripts auto-decorate using pymatgen's `AutoOxiStateDecorationTransformation`, but exotic compositions may fail.
- **Charge Balance**: Only charge-balanced substitutions are returned. This is enforced automatically.
- **Threshold**: Default 0.001. Lower values (e.g., 0.0001) find more candidates but include less probable substitutions. Higher values (e.g., 0.01) give fewer, more confident results.
- **MP API Key**: The reverse script requires `MP_API_KEY` environment variable to query Materials Project.
- **Structure Count**: The number of species in the structure determines the combinatorial space. Structures with 2–3 unique species work best; structures with 5+ species may produce very large result sets.
- **Relaxation**: Generated structures are **not relaxed**. Always relax with an MLIP before drawing conclusions about stability.

## References

- Hautier, G., Fischer, C., Ehrlacher, V., Jain, A., & Ceder, G. (2011). Data Mined Ionic Substitutions for the Discovery of New Compounds. *Inorganic Chemistry*, 50(2), 656–663. [DOI: 10.1021/ic102031h](https://doi.org/10.1021/ic102031h)

---

**Author:** Bowen Deng
**Contact:** [GitHub @learningmatter-mit](https://github.com/learningmatter-mit)

From learningmatter-mit/AtomisticSkills, MIT.

More from learningmatter-mit/AtomisticSkills

Signals

Stars
183
Forks
31
Open issues
0
Last commit (this folder)
Oct 5, 2026 (23 days ago)
Last release
Oct 6, 2026 (22 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from learningmatter-mit

Cite this page

mat-ionic-substitution skill. Agent Mart. https://agentmart.dev/skills/learningmatter-mit-mat-ionic-substitution (last updated 2026-10-24)