pymatgen
Lets your agent analyze and convert data about material structures. It's useful for scientists working with materials physics and chemistry.
What it does
This tool helps analyze and organize data about materials. It can check information, change formats, and understand the properties of structures and chemical compounds.
When to use it
- ✓When you have material data and want to ensure it's correct.
- ✓When needing to convert data from one format to another.
- ✓To understand the structure and properties of a material.
Example of what to ask your AI
“Analyze this material structure file and tell me its properties.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool uses a set of rules and functions to read, verify, and manipulate material information. It ensures each step is recorded to maintain accuracy.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add K-Dense-AI/scientific-agent-skills --skill pymatgenOr download just the file:
curl -L https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/main/skills/pymatgen/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
pymatgen
Use pymatgen for explicit, provenance-preserving work with compositions, molecules, periodic structures, computed entries, symmetry, phase diagrams, electronic structures, and electronic-structure-code files. Treat every parse, conversion, symmetry assignment, transformation, and database result as method- and parameter-dependent.
The MIT frontmatter license covers this skill. pymatgen and
pymatgen-core are MIT; mp-api declares BSD-3-Clause-LBNL. Materials Project
data is generally CC BY 4.0, while contributed data remains owned by its
contributors. Check the exact artifact and data terms before redistribution.
Verified snapshot (2026-09-30)
pymatgen==2026.9.24is the latest stable wrapper release (uploaded 2026-09-23). Package metadata requires Python 3.11+ and directly requirespymatgen-core>=2026.9.23.pymatgen-core==2026.9.23is the latest stable core release (2026-09-23). It now contains core objects, symmetry/lattice operations, and the I/O layer, all under the existingpymatgen.*namespace.mp-api==0.46.5is the latest stable Materials Project client (2026-08-18), requires Python 3.11+, and depends onpymatgen>2024.2.20.- The current API site is built from 2026.9.23 core documentation. Pinning both
distributions prevents
pymatgen==2026.9.24from silently resolving to a different future core. - Pymatgen uses date-based versions. PyPI renders the date with dots; do not infer semantic-version compatibility from the numbers.
The local CLI suite and synthetic examples were executed on this snapshot. File-dependent VASP/Q-Chem parses and authenticated API examples below are illustrative: their signatures and current SDK source were checked, but no licensed calculation or authenticated service retrieval was performed.
Create a project lock for reproducibility:
uv init --python 3.11
uv add "pymatgen==2026.9.24" "pymatgen-core==2026.9.23" "mp-api==0.46.5"
uv lock
uv sync --frozen
For a disposable reviewed environment:
uv venv --python 3.11 .venv-pymatgen
uv pip install --python .venv-pymatgen/bin/python \
"pymatgen==2026.9.24" "pymatgen-core==2026.9.23" "mp-api==0.46.5"
Direct pins do not freeze all transitive wheels. Preserve uv.lock, platform,
Python version, package versions, and artifact hashes.
Required workflow
- State whether the object is a non-periodic
Moleculeor periodicStructure; record lattice and periodic boundary conditions. - State units. Pymatgen commonly uses Å, degrees, eV, eV/atom, amu, and g/cm³, but each API's documented contract is authoritative.
- State coordinate mode.
Structurecoordinates are fractional unlesscoords_are_cartesian=True;Moleculecoordinates are Cartesian. - Inspect every parser warning. For CIF, preserve occupancy, site-merging, stoichiometry, and correction warnings; do not silently accept fixes.
- Report disorder/partial occupancies and oxidation-state decoration. Never guess oxidation states implicitly.
- Run validation before symmetry, neighbor, transformation, conversion, or thermodynamic analysis.
- Sweep symmetry tolerances and report
symprecin Å andangle_tolerancein degrees with every assignment. - Treat transformations as new artifacts. Preserve the input, parameters, software versions, warnings, and parent/child checksums.
- Before conversion, identify representation loss. Write only to a new path and round-trip-check scientifically relevant properties.
- Build phase diagrams only from compatible total energies and correction schemes. A computed hull is conditional on the supplied entry set.
- Keep all database access off by default. Disclose endpoint, filters, fields, result limit, cache behavior, output, license, and citation before an explicit execution step.
- Preserve an artifact manifest. Never use pickle or load an untrusted general object graph; use schema-validated JSON and explicit constructors.
Core objects
Use the public convenience imports:
from pymatgen.core import Composition, Element, Lattice, Molecule, Structure
composition = Composition("LiFePO4", strict=True)
iron = Element("Fe")
lattice = Lattice.cubic(5.64) # Å
structure = Structure(
lattice,
["Na", "Cl"],
[[0, 0, 0], [0.5, 0.5, 0.5]],
coords_are_cartesian=False,
validate_proximity=True,
)
molecule = Molecule(
["O", "H", "H"],
…
FAQ
What are 'structures' and 'compounds' in this context?
Structures refer to the atomic arrangement of materials, how they are organized in space. Compounds are the combinations of chemical elements that make up these materials.
Why is it important to record every step?
Recording every step (provenance) ensures you know exactly how results were obtained, allowing others to verify or reproduce your work with confidence.
Can I use this for non-crystalline materials?
Yes, the tool can handle both periodic structures (like crystals) and non-periodic molecules.
Details
Original description by the author
Analyzes, validates, converts, and transforms materials structures and computed materials data with pymatgen. Use for local phase diagrams, symmetry sensitivity, electronic-structure I/O, and bounded Materials Project queries.
Popularity
- GitHub stars
- 51k
- Ranking position
- #1950
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
13c-metabolic-flux
Estimates metabolic fluxes using carbon-13 isotope tracing data. It is useful for analyzing cellular metabolism and biochemical pathways.
K-Dense-AI/scientific-agent-skills
adaptyv
Designs protein characterization experiments using the Adaptyv API. It helps estimate costs, submit sequences, and monitor lab results.
K-Dense-AI/scientific-agent-skills
aeon
Performs machine learning tasks on time series data. It is useful for classifying, forecasting, detecting anomalies, and finding patterns in sequential data.
K-Dense-AI/scientific-agent-skills
alphagenome
Looks up precomputed genomic effects for genetic variants. It provides scores and explanations to understand the impact of variants on the genome.
K-Dense-AI/scientific-agent-skills
Similar skills
pytorch-patterns
Helps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
affaan-m/ECC
evm-token-decimals
Helps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
affaan-m/ECC
knowledge-agent
Creates and queries knowledge bases using AI. It allows asking questions about past work or compiling expertise on a topic.
thedotmack/claude-mem