Agent skill

Mat Defect Energy

by learningmatter-mit in learningmatter-mit/AtomisticSkills

Calculate point-defect formation energies (vacancies, substitutions, interstitials) using MLIPs.

MITAuto-check passed

Install Mat Defect Energy

skills CLI
$ npx skills add learningmatter-mit/AtomisticSkills --skill mat-defect-energy -a claude-code

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

GitHub CLI
$ gh skill install learningmatter-mit/AtomisticSkills mat-defect-energy --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-defect-energy .claude/skills/mat-defect-energy && 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-defect-energy
GitHub stars
175
Token cost
~1.7k tokens
SKILL.md length
555 words
Files
8 (incl. scripts)
Skills in repo
129
Repo updated
First seen
Licence
MIT

At a glance

Calculate point-defect formation energies (vacancies, substitutions, interstitials) using MLIPs.

  • Works in 6 steps: Select Level of Theory → Obtain Bulk Structure → Relax Bulk Structure → …
  • SKILL.md covers Goal, Instructions, Examples and Constraints
  • Runs Python scripts from its folder

What it does

Mat Defect Energy is an agent skill from learningmatter-mit/AtomisticSkills. Calculate point-defect formation energies (vacancies, substitutions, interstitials) using MLIPs.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 10 other files, including scripts (for example `examples/MgO_vacancy/README.md`, `examples/MgO_vacancy/defect_energies.json` and `scripts/calculate_defect_energy.py`).

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.

Example prompts

  • “/mat-defect-energy”

Requirements

  • Python 3

Workflow steps

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

  1. Select Level of Theory
  2. Obtain Bulk Structure
  3. Relax Bulk Structure
  4. Generate Defect Supercells
  5. Relax Defect Supercells
  6. Calculate Formation Energies

What it can do on your machine

Read from SKILL.md and the folder at commit 7f2d86d. 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 2 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):

    • github.com

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

  • Credentials

    Names no API keys, tokens, secrets or passwords.

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

Context cost

Mat Defect Energy loads about 1.7k tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 555 words of instructions outside code blocks.

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

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 7f2d86d, republished under its MIT licence (© learningmatter-mit). 555 words, ~1,685 tokens.

Download SKILL.mdSave it as .claude/skills/mat-defect-energy/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
mat-defect-energy
description
Calculate point-defect formation energies (vacancies, substitutions, interstitials) using MLIPs.
metadata.category
materials
metadata.venv
cpu, mlip

Point-Defect Formation Energy (MLIP)

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

[!NOTE] Steps written server.tool are MCP tool calls: base.search_materials_project_by_formula is the search_materials_project_by_formula tool of the base server (mcp__base__search_materials_project_by_formula, or mcp__plugin_atomistic-skills_base__search_materials_project_by_formula 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 cpu python -m src.mcp_server.cli base search_materials_project_by_formula key=value
${CLAUDE_SKILL_DIR}/../../venv/run mlip python -m src.mcp_server.cli mace load_model key=value relax_structure key=value

Goal

To calculate the formation energy ($E_f$) of neutral point defects (vacancies, substitutions, and interstitials) using Machine Learning Interatomic Potentials (MLIPs). Formation energy is defined as:

$$E_f = E_\mathrm{defect} - \frac{n_\mathrm{defect}}{n_\mathrm{bulk}} E_\mathrm{bulk} + \sum_i \Delta n_i \mu_i$$

where $E_\mathrm{defect}$ and $E_\mathrm{bulk}$ are the total energies of the defective and pristine supercells, $n$ is the number of atoms, $\Delta n_i$ is the change in number of species $i$, and $\mu_i$ is the chemical potential of species $i$.

Instructions

1. Select Level of Theory

Choose an MLIP model. See ml-foundation-potentials for guidance.

  • Recommended: r2SCAN-level potentials for inorganic defects (e.g., MACE-MH-1 with matpes_r2scan head).
  • Use the same model for bulk and defect calculations.
2. Obtain Bulk Structure

Start with a relaxed bulk primitive cell. You can retrieve one from Materials Project:

bash
base.search_materials_project_by_formula(formula="MgO", save_to_file="MgO.cif")
3. Relax Bulk Structure

Relax the bulk unit cell to get the reference energy:

bash
mace.load_model(model_name="MACE-MH-1", task_name="matpes_r2scan")
mace.relax_structure(
    structure_data="MgO.cif",
    relax_cell=True,
    fmax=0.01,
    output_dir="bulk_relaxation/"
)

Record the final energy per atom from the output.

4. Generate Defect Supercells

Use the defect generation script with pymatgen-analysis-defects:

bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/generate_defects.py \
    --bulk bulk_relaxation/relaxed_structure.cif \
    --supercell_size 2 2 2 \
    --defect_type vacancy \
    --output defect_structures/

Options for --defect_type:

  • vacancy — removes each symmetry-unique atom
  • substitution — replaces atoms with --substitute_element at each unique site
  • interstitial — inserts --interstitial_element at Voronoi interstitial sites
  • all — generates all vacancy types
5. Relax Defect Supercells

Relax without cell relaxation (fixed supercell volume). This applies to the defect supercells only -- the bulk cell in step 3 and the elemental references in step 6 are both relaxed with relax_cell=True:

bash
mace.relax_structure(
    structure_data="defect_structures/",
    relax_cell=False,  # Fixed cell for defect calculations
    fmax=0.02,
    output_dir="defect_relaxations/"
)
Show full SKILL.md (256 more words)Show less
6. Calculate Formation Energies

Compute defect formation energies:

bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_defect_energy.py \
    --bulk_dir bulk_relaxation/ \
    --defect_dir defect_relaxations/ \
    --supercell_size 2 2 2 \
    --output defect_energies.json

The script automatically:

  • Parses bulk and defect relaxation results
  • Determines removed/added species and computes $\Delta n_i$
  • Uses elemental energies from mat-elemental-energies as default chemical potentials (metal-rich limit)
  • Reports formation energies in eV

If you derive $\mu_i$ yourself instead of reading the library, relax the elemental reference cell and coordinates (relax_cell=True) with the same potential. A chemical potential is only meaningful at the reference phase's own minimum for that potential: evaluating an MP structure at its DFT geometry leaves it above the potential's minimum and that error passes straight into every formation energy. For O with TensorNet-PES-MatPES-PBE-2025.2, positions-only relaxation of mp-12957 gives -4.968 eV/atom versus -5.118 fully relaxed -- a 0.15 eV/atom error.

Examples

Oxygen Vacancy in MgO
bash
# 1. Get MgO structure
base.search_materials_project_by_formula(formula="MgO")

# 2. Relax bulk
mace.load_model(model_name="MACE-MH-1", task_name="matpes_r2scan")
mace.relax_structure(structure_data="MgO.cif", relax_cell=True, fmax=0.01, output_dir="bulk/")

# 3. Generate O vacancy supercells
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/generate_defects.py \
    --bulk bulk/relaxed_structure.cif --supercell_size 3 3 3 --defect_type vacancy --output vacancies/

# 4. Relax defect structures
mace.relax_structure(structure_data="vacancies/", relax_cell=False, fmax=0.02, output_dir="vac_relax/")

# 5. Compute formation energies
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_defect_energy.py \
    --bulk_dir bulk/ --defect_dir vac_relax/ --supercell_size 3 3 3 --output vac_energies.json

Expected: O vacancy formation energy ~6–8 eV (DFT reference: ~7.2 eV for neutral O vacancy in MgO).

Constraints

  • Neutral defects only: This skill does NOT handle charged defects. For charged defects with finite-size corrections, use mat-defect-energy-dft.
  • Fixed cell: Do NOT relax the unit cell during defect relaxation — the supercell must remain fixed to be commensurate with the bulk reference. This constraint is scoped to the defect supercell: the bulk cell and the elemental chemical-potential references are both fully relaxed (cell and coordinates).
  • Supercell size: Use at least 3×3×3 for cubic systems to minimize periodic image interactions. Formation energies converge with supercell size.
  • Chemical potential: Default uses metal-rich limit (elemental energies). For environment-specific stability, manually provide chemical potentials.
  • Environments: Defect generation and energy calculation scripts require cpu.

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 7 other files (scripts) in skills/mat-defect-energy of learningmatter-mit/AtomisticSkills.

  • SKILL.md
  • examples/MgO_vacancy/README.md
  • examples/MgO_vacancy/defect_energies.json
  • examples/MgO_vacancy/pristine_supercell.cif
  • examples/MgO_vacancy/vac_Mg_0.cif
  • examples/MgO_vacancy/vac_O_1.cif
  • scripts/calculate_defect_energy.py
  • scripts/generate_defects.py

Open the folder on GitHubat commit 7f2d86d

Compare with similar skills

Mat Defect Energy 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 Defect Energy compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mat Defect Energy this skilllearningmatter-mit/AtomisticSkills175—~1.7kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k62 repos~2.3kAutomated safety check: PassApache-2.0
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
MCP Integration for Pluginsanthropics/claude-plugins-official37k11 repos~3.1kAutomated safety check: PassApache-2.0
Figma use_figma Plugin API Ruleswarpdotdev/warp65k4 repos~4.4kAutomated safety check: PassAGPL-3.0
Stitch to Remotion Walkthrough Videosgoogle-labs-code/stitch-skills8.4k6 repos~3.2kAutomated safety check: NotesApache-2.0

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 62 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    37k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Required groundwork before any use_figma call: the rules and reference files for running JavaScript in a Figma file through the Plugin API without common failures.

    65k GitHub starsUsed in 4 repos~4.4k tokens
    Frontend & DesignAuto-check passed
  • Stitch to Remotion Walkthrough Videos

    google-labs-code/stitch-skills

    Official

    Builds walkthrough videos from Stitch design projects using Remotion, with transitions, zoom effects and text overlays on each screen.

    8.4k GitHub starsUsed in 6 repos~3.2k tokens
    Media & CreativeAuto-check: notes
  • MCP Development

    coollabsio/coolify

    A skill your agent uses for Laravel MCP development. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 1 repo~949 tokens
    Frontend & DesignAuto-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.

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

    175 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).

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

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

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

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

Questions about Mat Defect Energy

What does Mat Defect Energy do?

Calculate point-defect formation energies (vacancies, substitutions, interstitials) using MLIPs. Mat Defect Energy is an agent skill from learningmatter-mit/AtomisticSkills. Calculate point-defect formation energies (vacancies, substitutions, interstitials) using MLIPs.

How do I install Mat Defect Energy in Claude Code?

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

How do I install Mat Defect Energy in Codex?

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

Can I use Mat Defect Energy 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-defect-energy -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-defect-energy, .gemini/skills/mat-defect-energy, .github/skills/mat-defect-energy and .opencode/skills/mat-defect-energy in your project.

What does Mat Defect Energy need to run?

Going by SKILL.md and its folder, Mat Defect Energy needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Mat Defect Energy access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Mat Defect Energy 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 Defect Energy use?

Mat Defect Energy 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 Defect Energy use?

About 1.7k tokens (SKILL.md is roughly 6.7k 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 Defect Energy?

Skills that share tags, products or a category with Mat Defect Energy: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), MCP Integration for Plugins (anthropics/claude-plugins-official, 37k stars) and Figma use_figma Plugin API Rules (warpdotdev/warp, 65k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mat Defect Energy?

learningmatter-mit (a GitHub organization) maintains it in learningmatter-mit/AtomisticSkills, which has 175 GitHub stars. The repository holds 129 skills in this directory. The repository was last updated on October 6, 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.