pymatgen

Manipulate and analyze crystal structures and electronic-structure outputs with pymatgen.

783|65|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/LeonChaoX/qinyan-academic-skills --skill pymatgen-leonchaox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pymatgen
Source: https://github.com/LeonChaoX/qinyan-academic-skills/tree/main/skills/10-%E6%9D%90%E6%96%99%E7%A7%91%E5%AD%A6%E4%B8%8E%E7%89%A9%E7%90%86%E8%AE%A1%E7%AE%97/pymatgen
Command: npx skills add https://github.com/LeonChaoX/qinyan-academic-skills --skill pymatgen-leonchaox

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill removes friction in computational materials research by helping you load, transform, analyze, and convert crystal structures and electronic-structure data without manually stitching together multiple tools.

Core Features & Use Cases

  • Structure creation, transformation, and conversion: Read/write common formats (e.g., CIF, POSCAR, XYZ), build supercells, substitute elements, and prepare structures for simulations.
  • Materials-focused analysis: Compute symmetry (space group), coordination environments, phase diagrams (energy above hull), electronic structure summaries (band gap, DOS), and surface/interface models (slabs, adsorption sites).
  • Materials Project integration: Query and retrieve computed structures and use them directly in phase diagram workflows via MP-API.

Quick Start

Use the pymatgen skill to analyze a POSCAR by reading it, reporting its reduced formula and space group, and exporting it to CIF.

Frequently Asked Questions about pymatgen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a POSCAR file to CIF format for crystal structure analysis?

You can convert a POSCAR file to CIF format by reading the structure with the pymatgen API and exporting it. This enables deterministic structure processing and format conversion for computational materials workflows.

How do I construct a phase diagram and compute energy above hull from Materials Project data?

Constructing a phase diagram and computing energy above hull is done by querying computed structures with MP-API via pymatgen. This retrieves and directly integrates Materials Project data into phase diagram workflows.

Can I analyze band gap and density of states from electronic structure outputs?

Yes, band gap and density of states analysis is supported through electronic structure plotting and summary functionalities. The pymatgen API processes electronic-structure outputs to extract these material properties.

What's the best way to compute space group and coordination environments for a crystal structure?

Computing space group and coordination environments is handled by the symmetry and coordination analysis features in pymatgen. This provides detailed structural characterization for materials science projects.

Does this require mp-api to query computed structures from the Materials Project?

Querying computed structures from the Materials Project optionally requires the mp-api package. The core file conversion and structure manipulation functionalities rely on the pymatgen API.

Can I build supercells and model surface adsorption sites for crystal structures?

Yes, building supercells and modeling surface adsorption sites are supported structure transformation features. The pymatgen API enables creating slabs and interface models for surface and adsorption simulations.