Agent skill

Mat Grain Boundary

by learningmatter-mit in learningmatter-mit/AtomisticSkills

Calculate grain boundary energies for tilt/twist grain boundaries (Σ-CSL boundaries) using MLIPs; output γGB vs.

MITAuto-check passed

Install Mat Grain Boundary

skills CLI
$ npx skills add learningmatter-mit/AtomisticSkills --skill mat-grain-boundary -a claude-code

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

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

At a glance

Calculate grain boundary energies for tilt/twist grain boundaries (Σ-CSL boundaries) using MLIPs; output γGB vs.

  • Works in 6 steps: Select Foundation Potential → Relax Bulk Reference → Generate Grain Boundary Structures → …
  • SKILL.md covers Goal, Instructions, Examples and Constraints, plus 1 more section
  • Runs Python scripts from its folder

What it does

Mat Grain Boundary is an agent skill from learningmatter-mit/AtomisticSkills. Calculate grain boundary energies for tilt/twist grain boundaries (Σ-CSL boundaries) using MLIPs; output γGB vs. misorientation angle curves and identify low-energy special boundaries.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 16 other files, including scripts (for example `examples/Cu-001-tilt-TensorNet/README.md`, `examples/Cu-001-tilt-TensorNet/gb_energy_results.json` and `examples/Cu-001-tilt-TensorNet/plot_gb_structure.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-grain-boundary”

Requirements

  • Python 3

Workflow steps

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

  1. Select Foundation Potential
  2. Relax Bulk Reference
  3. Generate Grain Boundary Structures
  4. Relax Grain Boundary Structures
  5. Calculate Grain Boundary Energies
  6. Identify Low-Energy Boundaries

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):

    • pymatgen.org
    • 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 Grain Boundary loads about 2k tokens when it runs. Until then it costs about 51 tokens; SKILL.md has 727 words of instructions outside code blocks.

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

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). 727 words, ~2,005 tokens.

Download SKILL.mdSave it as .claude/skills/mat-grain-boundary/SKILL.md (or your agent's skills folder). This skill also uses 13 other files; get the full folder from GitHub.
name
mat-grain-boundary
description
Calculate grain boundary energies for tilt/twist grain boundaries (Σ-CSL boundaries) using MLIPs; output γ_GB vs. misorientation angle curves and identify low-energy special boundaries.
metadata.category
materials
metadata.venv
cpu, mlip

Grain Boundary Energy Calculation

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

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

Goal

To compute the specific grain boundary energy ($\gamma_{GB}$, J/m²) for a series of coincidence site lattice (CSL) grain boundaries using Machine Learning Interatomic Potentials. This enables:

  • Identification of low-energy special grain boundaries (Σ3, Σ5, Σ7, ...)
  • Anisotropy analysis of GB energy as a function of misorientation angle
  • Input data for polycrystalline simulations (phase-field, kinetic Monte Carlo)

The grain boundary energy is defined as:

$$\gamma_{GB} = \frac{E_{GB} - N \cdot E_{bulk}}{2 A}$$

where $E_{GB}$ is the total energy of the GB supercell, $N$ is the number of atoms, $E_{bulk}$ is the DFT/MLIP energy per atom of the relaxed bulk, and $A$ is the interfacial area (one GB, periodic cell contains two identical GBs hence the factor of 2).

Instructions

1. Select Foundation Potential

GB calculations benefit from accurate interatomic forces. Prefer r2SCAN-level models for energy accuracy:

  • MACE-MH-1 with matpes_r2scan head (recommended)
  • CHGNet-PES-MatPES-r2SCAN-1M-2026.9 (MatGL)
  • TensorNet-MatPES-r2SCAN-v2025.1-PES (MatGL, faster)

Refer to ml-foundation-potentials.

2. Relax Bulk Reference

Perform a high-accuracy bulk relaxation to obtain $E_{bulk}$.

bash
matgl.load_model(model_name="CHGNet-PES-MatPES-r2SCAN-1M-2026.9")
matgl.relax_structure(
    structure_data="bulk.cif",
    relax_cell=True,
    fmax=0.005,
    output_dir="bulk_relaxation/"
)

Record the final energy per atom ($E_{bulk}$) from the relaxation output JSON.

3. Generate Grain Boundary Structures

Use pymatgen's GrainBoundaryGenerator to create CSL grain boundary supercells for a range of Σ values and rotation angles.

bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/create_grain_boundary.py \
    --bulk bulk_relaxation/relaxed_structure.cif \
    --rotation-axis 0 0 1 \
    --max-sigma 29 \
    --min-slab-size 10.0 \
    --vacuum 0.0 \
    --output-dir gb_structures/

Key parameters:

ParameterDescriptionExample
--rotation-axisRotation axis as 3 integers0 0 1 (tilt) or 1 1 0
--max-sigmaMaximum Σ value to enumerate29 (generates Σ3, Σ5, Σ7...)
--min-slab-sizeMinimum thickness of each grain (Å)10.0
--output-dirDirectory for generated GB CIF filesgb_structures/

The script writes one CIF per unique GB, with filename format sigma{Σ}_{angle:.1f}deg_{hkl}.cif.

[!TIP] For a first survey use --max-sigma 13 (gives Σ1, Σ3, Σ5, Σ7, Σ9, Σ11, Σ13). Increase to 29 for more complete misorientation curves.

4. Relax Grain Boundary Structures

Relax all generated GB structures. Do NOT relax the cell in directions parallel to the GB plane — use relax_cell=False to fix the in-plane lattice vectors and only relax atomic positions.

bash
matgl.load_model(model_name="CHGNet-PES-MatPES-r2SCAN-1M-2026.9")
matgl.relax_structure(
    structure_data="gb_structures/",
    relax_cell=False,
    fmax=0.02,
    output_dir="gb_relaxations/"
)

[!IMPORTANT] relax_cell=False is required. The in-plane lattice vectors of the GB supercell are fixed by the CSL geometry and must remain constant to preserve the grain boundary orientation.

5. Calculate Grain Boundary Energies
bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_gb_energy.py \
    --bulk-energy-per-atom -4.567 \
    --gb-relaxation-dir gb_relaxations/ \
    --output-dir gb_results/

The script reads the JSON output from each relaxation, applies the GB energy formula, and generates:

  • gb_energy_results.json — Σ, angle, area, $\gamma_{GB}$, and provenance per boundary
  • gb_energy_vs_angle.png/svg — plot of $\gamma_{GB}$ (J/m²) vs. misorientation angle (°)
  • gb_summary_table.csv — CSV for further analysis
Show full SKILL.md (271 more words)Show less
6. Identify Low-Energy Boundaries

Inspect the output table and plot to identify:

  • Cusps: sharp dips in $\gamma_{GB}$ vs. angle correspond to special low-energy GBs (Σ3 ≈ twin boundary, Σ5, etc.)
  • Asymmetric tilt boundaries: generated alongside symmetric ones; compare energies
  • Coincidence index correlation: low-Σ GBs typically have the lowest energies

Examples

Example: Copper [001] Tilt Grain Boundaries

Copper is a well-benchmarked system. MLIP values should be compared to DFT/MD literature.

bash
# 1. Query and relax bulk Cu
base.search_materials_project_by_formula(formula="Cu", save_to_file="Cu_bulk.cif")
matgl.load_model(model_name="TensorNet-MatPES-r2SCAN-v2025.1-PES")
matgl.relax_structure(structure_data="Cu_bulk.cif", relax_cell=True, fmax=0.005, output_dir="Cu_bulk_relax/")

# 2. Generate [001] tilt GBs up to Σ13
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/create_grain_boundary.py \
    --bulk Cu_bulk_relax/relaxed_structure.cif \
    --rotation-axis 0 0 1 --max-sigma 13 --output-dir Cu_gb_structures/

# 3. Relax GB structures
matgl.relax_structure(structure_data="Cu_gb_structures/", relax_cell=False, fmax=0.02, output_dir="Cu_gb_relax/")

# 4. Calculate GB energies (E_bulk ≈ -3.73 eV/atom for Cu with TensorNet)
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/calculate_gb_energy.py \
    --bulk-energy-per-atom -3.73 \
    --gb-relaxation-dir Cu_gb_relax/ \
    --output-dir Cu_gb_results/

Literature comparison: For Cu [001] tilt boundaries, the Σ5 (36.9°) boundary has $\gamma_{GB}$ ≈ 0.8–1.0 J/m² from MD simulations. The Σ3 (twin) boundary has $\gamma_{GB}$ < 0.05 J/m².

Constraints

  • Cell relaxation: Always use relax_cell=False for GB structures. The in-plane dimensions define the CSL geometry and must not change.
  • Slab thickness: Use --min-slab-size ≥ 10 Å to ensure bulk-like behaviour at the centre of each grain. Thin grains cause artificial interaction between the two GBs in the periodic cell.
  • Same MLIP for bulk and GB: Use the identical model and settings for both bulk relaxation (Step 2) and GB relaxation (Step 4) to ensure energy cancellation in the GB energy formula.
  • Vacuum: Set --vacuum 0.0. Unlike surface calculations, grain boundary supercells should have no vacuum — both grains are connected periodically.
  • Environment: All scripts run in cpu. MLIP relaxations use the respective MLIP environment.

References

  • Zhao et al., "Automated generation and analysis of grain boundary structures using machine learning potentials", npj Comput. Mater., 2021.
  • Holm & Foiles, "How Grain Boundary Properties Are Influenced by the Character of the Boundary", Science, 2010.
  • Tschopp & McDowell, "Asymmetric Tilt Grain Boundary Structure and Energy in Copper and Aluminium", Phil. Mag., 2007.
  • Pymatgen GrainBoundaryGenerator documentation: link

Author: Yu Yao, Bowen Deng Contact: GitHub @AI4SciDisc

© 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 13 other files (scripts) in skills/mat-grain-boundary of learningmatter-mit/AtomisticSkills.

  • SKILL.md
  • examples/Cu-001-tilt-TensorNet/Cu_bulk.cif
  • examples/Cu-001-tilt-TensorNet/Cu_sigma13_gb_relaxed.cif
  • examples/Cu-001-tilt-TensorNet/Cu_sigma25_gb_relaxed.cif
  • examples/Cu-001-tilt-TensorNet/Cu_sigma5_gb_relaxed.cif
  • examples/Cu-001-tilt-TensorNet/Cu_sigma5_gb_structure.png
  • examples/Cu-001-tilt-TensorNet/README.md
  • examples/Cu-001-tilt-TensorNet/gb_energy_results.json
  • examples/Cu-001-tilt-TensorNet/gb_energy_vs_angle.png
  • examples/Cu-001-tilt-TensorNet/gb_energy_vs_angle.svg
  • examples/Cu-001-tilt-TensorNet/gb_summary_table.csv
  • examples/Cu-001-tilt-TensorNet/plot_gb_structure.py
  • scripts/calculate_gb_energy.py
  • scripts/create_grain_boundary.py

Open the folder on GitHubat commit 7f2d86d

Compare with similar skills

Mat Grain Boundary 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 Grain Boundary compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mat Grain Boundary this skilllearningmatter-mit/AtomisticSkills175—~2kAutomated 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 Grain Boundary

What does Mat Grain Boundary do?

Calculate grain boundary energies for tilt/twist grain boundaries (Σ-CSL boundaries) using MLIPs; output γGB vs. Mat Grain Boundary is an agent skill from learningmatter-mit/AtomisticSkills. Calculate grain boundary energies for tilt/twist grain boundaries (Σ-CSL boundaries) using MLIPs; output γGB vs.

How do I install Mat Grain Boundary in Claude Code?

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

How do I install Mat Grain Boundary in Codex?

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

Can I use Mat Grain Boundary 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-grain-boundary -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-grain-boundary, .gemini/skills/mat-grain-boundary, .github/skills/mat-grain-boundary and .opencode/skills/mat-grain-boundary in your project.

What does Mat Grain Boundary need to run?

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

Does Mat Grain Boundary access the network?

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

Is Mat Grain Boundary 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 Grain Boundary use?

Mat Grain Boundary 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 Grain Boundary use?

About 2k tokens (SKILL.md is roughly 8k 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 Grain Boundary?

Skills that share tags, products or a category with Mat Grain Boundary: 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 Grain Boundary?

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.