/atomistic-skills:mat-grain-boundaryfrom Atomistic Skills
Calculates grain boundary energies for tilt/twist CSL boundaries using MLIPs, producing γ_GB vs. misorientation curves and identifying low-energy special boundaries.
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:matgl.load_modelis theload_modeltool of thematglserver (mcp__matgl__load_model, ormcp__plugin_atomistic-skills_matgl__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 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
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:
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).
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.
Perform a high-accuracy bulk relaxation to obtain $E_{bulk}$.
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.
Use pymatgen's GrainBoundaryGenerator to create CSL grain boundary supercells for a range of Σ values and rotation angles.
${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:
| Parameter | Description | Example |
|---|---|---|
--rotation-axis | Rotation axis as 3 integers | 0 0 1 (tilt) or 1 1 0 |
--max-sigma | Maximum Σ value to enumerate | 29 (generates Σ3, Σ5, Σ7...) |
--min-slab-size | Minimum thickness of each grain (Å) | 10.0 |
--output-dir | Directory for generated GB CIF files | gb_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.
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.
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=Falseis 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.
${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 boundarygb_energy_vs_angle.png/svg — plot of $\gamma_{GB}$ (J/m²) vs. misorientation angle (°)gb_summary_table.csv — CSV for further analysisInspect the output table and plot to identify:
Copper is a well-benchmarked system. MLIP values should be compared to DFT/MD literature.
# 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².
relax_cell=False for GB structures. The in-plane dimensions define the CSL geometry and must not change.--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.--vacuum 0.0. Unlike surface calculations, grain boundary supercells should have no vacuum — both grains are connected periodically.cpu. MLIP relaxations use the respective MLIP environment.GrainBoundaryGenerator documentation: linkAuthor: Yu Yao, Bowen Deng Contact: GitHub @AI4SciDisc
examples/Cu-001-tilt-TensorNet/Cu_bulk.cif (opens in a new tab)examples/Cu-001-tilt-TensorNet/Cu_sigma13_gb_relaxed.cif (opens in a new tab)examples/Cu-001-tilt-TensorNet/Cu_sigma25_gb_relaxed.cif (opens in a new tab)examples/Cu-001-tilt-TensorNet/Cu_sigma5_gb_relaxed.cif (opens in a new tab)examples/Cu-001-tilt-TensorNet/Cu_sigma5_gb_structure.png (opens in a new tab)examples/Cu-001-tilt-TensorNet/README.md (opens in a new tab)examples/Cu-001-tilt-TensorNet/gb_energy_results.json (opens in a new tab)examples/Cu-001-tilt-TensorNet/gb_energy_vs_angle.png (opens in a new tab)examples/Cu-001-tilt-TensorNet/gb_energy_vs_angle.svg (opens in a new tab)examples/Cu-001-tilt-TensorNet/gb_summary_table.csv (opens in a new tab)examples/Cu-001-tilt-TensorNet/plot_gb_structure.py (opens in a new tab)scripts/calculate_gb_energy.py (opens in a new tab)scripts/create_grain_boundary.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub learningmatter-mit/atomisticskills --plugin atomistic-skills133 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.Other plugins' skills for the same job