Analyzes and manipulates materials with pymatgen: crystal structures, phase diagrams, electronic structure, surfaces, and Materials Project data access. Handles CIF/POSCAR/XYZ conversion, symmetry analysis, VASP/Gaussian/QE output.
Ships in alterlab-domain-specific. 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.
Pymatgen is a comprehensive Python library for materials analysis that powers the Materials Project. Create, analyze, and manipulate crystal structures and molecules; compute phase diagrams and thermodynamic properties; analyze electronic structure (band structures, DOS); generate surfaces and interfaces; and access the Materials Project database. Supports 100+ file formats from various computational codes.
Use when:
| Scenario | Use Instead |
|---|---|
| Small organic molecules — SMILES, fingerprints, descriptors, substructure search | alterlab-rdkit |
| Running DFT / conformer searches / pKa in a managed cloud quantum-chemistry service | alterlab-rowan |
| Classical molecular dynamics of proteins or ligands (OpenMM, trajectories) | alterlab-molecular-dynamics |
| Variational quantum circuits for molecular ground states (VQE) | alterlab-pennylane |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-rdkit) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Run install-free — one uv run command, no virtualenv and no uv pip install (which fails
outside an activated virtualenv). pymatgen needs Python >= 3.11 and uv's default here can be
3.9, so pin the interpreter. The bundled scripts run the same way:
uv run --python ">=3.11" --with pymatgen python your_script.py
uv run --python ">=3.11" --with pymatgen python scripts/phase_diagram_generator.py Li-Fe-O --analyze LiFeO2 # keyless
uv run --python ">=3.11" --with pymatgen --with mp-api python your_script.py # + optional MP API client
Add a single analysis dependency with another --with (--with phonopy, --with seekpath,
--with ase) rather than the pymatgen[optional] extra, which now pulls matgl and a full
PyTorch/CUDA stack. Inside an activated virtualenv uv pip install pymatgen works too.
from pymatgen.core import Structure, Lattice
struct = Structure.from_file("POSCAR") # auto format detection
struct.to(filename="structure.cif") # write any format
print(struct.composition.reduced_formula)
print(struct.get_space_group_info())
print(f"{struct.density:.2f} g/cm³")
Keyless by default. Everything above — reading, converting, and analysing structures you provide (CIF/POSCAR/XYZ), symmetry and space groups, slab generation, phase stability, and parsing VASP/Gaussian/QE output — is local and needs no account. To fetch structures and their stability from Materials Project without a key, use the keyless OPTIMADE endpoint (see "Materials Project access" below). Only the richer MP API (full computed entries and convex-hull plots) needs a key:
export MP_API_KEY="your_api_key_here" # OPTIONAL — only for the richer mp-api client
Each capability has a copy-paste code block in references/core_examples.md and deeper
module docs in the references listed below.
core_classes.mdfrom_file()/to() plus scripts/structure_converter.py
for single/batch. → io_formats.mdSpacegroupAnalyzer, CrystalNN, plus
scripts/structure_analyzer.py. → analysis_modules.mdPhaseDiagram, energy-above-hull, decomposition,
plus scripts/phase_diagram_generator.py. → analysis_modules.md, transformations_workflows.mdVasprun, band gaps,
metallicity. → analysis_modules.md, io_formats.mdSlabGenerator, WulffShape, AdsorbateSiteFinder.
→ analysis_modules.md, transformations_workflows.mdhttps://optimade.materialsproject.org/v1/structures, no API key) for structures and
precomputed stability (_mp_stability: energy above hull, formation energy); the
optimade Python client (OptimadeClient, with its [http-client] extra) or plain
urllib both work, and optimade.adapters.Structure converts a result to a pymatgen
Structure. Optional: MPRester (the mp-api client, needs MP_API_KEY) for the
full computed entries, richer property filters, and convex-hull plots.
→ materials_project_api.mdMPRelaxSet, MPStaticSet,
MPNonSCFSet), Gaussian, Quantum ESPRESSO. → io_formats.md, transformations_workflows.mdanalysis_modules.mdMulti-step worked examples (high-throughput generation, band-structure pipeline, surface
energy): references/common_workflows_code.md.
scripts/)The scripts import pymatgen, so run each as uv run --python ">=3.11" --with pymatgen python scripts/<name>.py ... (bare python scripts/..., as written below, works only where
pymatgen is already installed).
structure_converter.py: convert between structure file formats (batch + auto
detection). Usage: python scripts/structure_converter.py POSCAR structure.cifstructure_analyzer.py: symmetry, coordination, lattice parameters, distance
matrix. Usage: python scripts/structure_analyzer.py structure.cif --symmetry --neighborsphase_diagram_generator.py: phase-stability report. Keyless by default —
python scripts/phase_diagram_generator.py Li-Fe-O --analyze "LiFeO2" pulls precomputed
stability from the MP OPTIMADE endpoint (no key) and reports whether the composition is
on the convex hull. Add --source mp (needs MP_API_KEY) for the full PhaseDiagram
with a convex-hull plot and decomposition products; without the key that path exits
non-zero and points back to the keyless default rather than silently switching backends.All scripts include detailed help, e.g. python scripts/structure_converter.py --help
references/)core_examples.md: copy-paste code for all nine core capabilitiescommon_workflows_code.md: multi-step worked workflow codecore_classes.md: Element, Structure, Lattice, Molecule, Composition classesio_formats.md: file-format support and code integration (VASP, Gaussian, etc.)analysis_modules.md: phase diagrams, surfaces, electronic structure, symmetrymaterials_project_api.md: complete Materials Project API guidetransformations_workflows.md: transformations framework and 10 common workflowsStructures: use auto format detection; prefer IStructure when immutable; reduce to
primitive cell with SpacegroupAnalyzer; validate for overlapping atoms / bad bond
lengths. File I/O: prefer from_file()/to(); specify format when detection fails;
use as_dict()/from_dict() for version-safe storage. MP API: always use the context
manager; batch queries; cache results; filter by property. Workflows: prefer input
sets over manual INCAR; verify convergence; track transformations for provenance.
Performance: use primitive cells; bound neighbor-search cutoffs; parallelize where
possible.
Lengths in Å, energies in eV, angles in degrees, magnetic moments in μB, time in fs.
Convert with pymatgen.core.units.
Integrates with ASE, Phonopy, BoltzTraP, Atomate/Fireworks, AiiDA, Zeo++, and OpenBabel.
uv run --python ">=3.11" --with pymatgen --with phonopy python ... (there is no [analysis] extra; [optional] pulls PyTorch/CUDA via matgl)scripts/phase_diagram_generator.py defaults to it); only the
mp-api client needs export MP_API_KEY="your_key_here"Structure.from_file("file.txt", fmt="cif")SpacegroupAnalyzer(struct, symprec=0.1)Docs: https://pymatgen.org/ · Materials Project: https://materialsproject.org/ · GitHub: https://github.com/materialsproject/pymatgen · Forum: https://matsci.org/ · Example notebooks: https://github.com/materialsvirtuallab/matgenb
Designed for pymatgen 2024.x and later (current 2026.9.x as of 2026-09; calendar
versioning). Since 2026 the pymatgen distribution is a thin package on top of
pymatgen-core; imports (pymatgen.core, pymatgen.io.vasp, …) are unchanged. For the
Materials Project API use the mp-api package (current 0.46.x; from mp_api.client import MPRester) rather than the legacy pymatgen.ext.matproj client. Requirements: Python ≥ 3.11,
pymatgen ≥ 2024.x, mp-api for Materials Project access.
Part of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)evals/fixtures/Pt_bulk.cif (opens in a new tab)references/analysis_modules.md (opens in a new tab)references/common_workflows_code.md (opens in a new tab)references/core_classes.md (opens in a new tab)references/core_examples.md (opens in a new tab)references/io_formats.md (opens in a new tab)references/materials_project_api.md (opens in a new tab)references/transformations_workflows.md (opens in a new tab)scripts/phase_diagram_generator.py (opens in a new tab)scripts/structure_analyzer.py (opens in a new tab)scripts/structure_converter.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-domain-specific:alterlab-pymatgenfrom alterlab-domain-specific
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-domain-specific18 skills in this plugin
/alterlab-adaptyvPrepares and validates Adaptyv Bio Foundry protein-testing submissions with no account — optimizes and pre-screens sequences locally (NetSolP/SoluProt heuristics, SolubleMPNN, ESM), assembles the experiment payload, and validates it offline against the Foundry's own type/method/sequence rules so it is ready and correct before it costs anything. Submitting to the Foundry, browsing the target catalog, tracking status and retrieving results run through the Foundry API with the user's own ADAPTYV_API_KEY (experiments cost money and take weeks). Use when designing proteins for wet-lab validation (binding/affinity, expression, thermostability, fluorescence), preparing or validating a Foundry submission, pre-screening sequences, or tracking an Adaptyv experiment. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite./alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite./alterlab-astropyProcesses astronomy and astrophysics data with the Astropy Python library — celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, and world coordinate systems (WCS). Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or general astronomical data analysis. Part of the AlterLab Academic Skills suite./alterlab-cirqBuilds, simulates, and runs quantum circuits with Cirq, Google Quantum AI's framework for NISQ hardware, noise-aware low-level circuit design, and noise characterization. Use when targeting Google Quantum AI processors or their Quantum Virtual Machine models (Willow, Sycamore-class Rainbow/Weber), IonQ/AQT/Pasqal via Cirq plugins, designing noise-aware NISQ circuits, or running characterization experiments (randomized benchmarking, XEB). For IBM Quantum hardware and Qiskit Runtime prefer alterlab-qiskit; for gradient-trained quantum ML and hybrid quantum-classical models prefer alterlab-pennylane; for open-system Lindblad/master-equation dynamics prefer alterlab-qutip. Part of the AlterLab Academic Skills suite./alterlab-digital-humanitiesApplies computational methods to humanities research — text mining and NLP (LDA/BERTopic topic modeling, sentiment, named entity recognition with spaCy/NLTK), corpus linguistics (concordance, collocation, keyness), digital archives (Dublin Core, TEI XML), GIS for history, network analysis, stylometry and authorship attribution, OCR (Tesseract, Kraken, Transkribus), and data visualization (Gephi, Palladio). Use when distant-reading a literary corpus, mapping historical events or trade networks, attributing disputed authorship, digitizing historical documents, or building digital scholarly editions. Part of the AlterLab Academic Skills suite./alterlab-fluidsimRuns computational fluid dynamics simulations with the FluidSim Python framework using pseudospectral FFT methods, with HPC support and output analysis. Use when simulating Navier-Stokes equations (2D/3D), shallow water equations, or stratified flows, or when analyzing turbulence, vortex dynamics, or geophysical flows. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job