sciagent-skill-creator
Scaffold a new SciAgent-Skills entry. Picks pipeline/toolkit/database/guide template, creates skills/{category}/{name}/SKILL.md with valid frontmatter, appends…
Python Materials Genomics library for structure analysis, thermodynamics, and electronic properties. Parse/create crystal structures (CIF, POSCAR), query Materials Project for DFT-computed properties, analyze phase and Pourbaix diagrams, compute XRD patterns, generate DFT inputs
$ npx -y skills add jaechang-hits/SciAgent-Skills --skill pymatgen --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/pymatgenContext preview
The summary Claude sees to decide when to auto-load this skill.
Python Materials Genomics library for structure analysis, thermodynamics, and electronic properties. Parse/create crystal structures (CIF, POSCAR), query Materials Project for DFT-computed properties, analyze phase and Pourbaix diagrams, compute XRD patterns, generate DFT inputs
name: "pymatgen" description: "Python Materials Genomics library for structure analysis, thermodynamics, and electronic properties. Parse/create crystal structures (CIF, POSCAR), query Materials Project for DFT-computed properties, analyze phase and Pourbaix diagrams, compute XRD patterns, generate DFT inputs for VASP, Quantum ESPRESSO, CP2K. Alternatives: ASE (MD/geometry), AFLOW (high-throughput), OVITO (visualization)." license: "MIT"
pymatgen is the standard Python library for materials science computation. Its core data model — `Structure` (periodic crystalline materials) and `Molecule` (non-periodic) — provides a unified representation for input/output across 30+ file formats (CIF, POSCAR/CONTCAR, XYZ, PDB, Gaussian, VASP). The library integrates with the Materials Project REST API (`mp_api`) to retrieve 150,000+ DFT-computed structures with band gaps, formation energies, and elastic constants. pymatgen is the foundation of the atomate2 and Custodian workflow frameworks for high-throughput DFT.
pip install pymatgen mp-api # Set API key export PMG_MAPI_KEY="your_api_key_here" # Or via pymatgen config python -c "from pymatgen.core import SETTINGS; SETTINGS['PMG_MAPI_KEY'] = 'your_key'"
from pymatgen.core import Structure, Lattice, Species
# Build silicon diamond cubic structure from scratch
a = 5.431 # Angstroms
lattice = Lattice.cubic(a)
silicon = Structure(
lattice=lattice,
species=["Si", "Si"],
coords=[[0, 0, 0], [0.25, 0.25, 0.25]],
)
print(f"Silicon: {silicon.formula}, {silicon.volume:.2f} ų")
print(f"Space group: {silicon.get_space_group_info()}")
# Silicon: Si2, 40.89 ų
# Space group: ('Fd-3m', 227)Core data structures for periodic crystals.
from pymatgen.core import Structure, Lattice, Element, Species
import numpy as np
# From lattice parameters
lattice = Lattice.from_parameters(a=4.05, b=4.05, c=4.05,
alpha=90, beta=90, gamma=90)
# Build FCC aluminum
al_fcc = Structure(lattice, ["Al", "Al", "Al", "Al"],
[[0, 0, 0], [0.5, 0.5, 0], [0.5, 0, 0.5], [0, 0.5, 0.5]])
print(f"Formula: {al_fcc.formula}")
print(f"Sites: {len(al_fcc)}")
print(f"Volume: {al_fcc.volume:.3f} ų")
print(f"Density: {al_fcc.density:.3f} g/cm³")
# Access sites
for site in al_fcc:
print(f" {site.species_string} at {site.frac_coords}")# Load from file
from pymatgen.core import Structure
# From CIF (most common exchange format)
struct = Structure.from_file("material.cif")
# From POSCAR (VASP format)
struct_vasp = Structure.from_file("POSCAR")
# Get neighbors within cutoff
site = struct[0]
neighbors = struct.get_neighbors(site, r=3.0)
print(f"Neighbors within 3 Å: {len(neighbors)}")
for nn in neighbors[:3]:
print(f" {nn.species_string}: {nn.nn_distance:.3f} Å")Retrieve DFT-computed properties for 150,000+ materials.
from mp_api.client import MPRester
import os
api_key = os.environ.get("PMG_MAPI_KEY", "your_key")
with MPRester(api_key) as mpr:
# Search by chemical system
docs = mpr.materials.summary.search(
chemsys=["Li-Fe-O"],
fields=["material_id", "formula_pretty", "energy_above_hull",
"band_gap", "is_stable"]
)
print(f"Li-Fe-O materials: {len(docs)}")
for d in docs[:5]:
print(f" {d.material_id}: {d.formula_pretty}, "
f"Eg={d.band_gap:.2f} eV, above_hull={d.energy_above_hull:.3f} eV/atom")# Get specific material by MP ID
with MPRester(api_key) as mpr:
doc = mpr.materials.summary.get_data_by_id(
"mp-149", # Silicon
fields=["structure", "band_gap", "formation_energy_per_atom",
"density", "is_stable", "symmetry"]
)
struct = doc.structure
print(f"Si mp-149: band_gap={doc.band_gap:.3f} eV, "
f"density={doc.density:.3f} g/cm³")
print(f"Space group: {doc.symmetry.symbol}")from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.core import Structure
struct = Structure.from_file("material.cif")
# Symmetry analysis
sga = SpacegroupAnalyzer(struct, symprec=0.1)
print(f"Space group: {sga.get_space_group_symbol()} ({sga.get_space_group_number()})")
print(f"Crystal system: {sga.get_crystal_system()}")
print(f"Point group: {sga.get_point_group_symbol()}")
# Get conventional / primitive cell
primitive = sga.get_primitive_standard_structure()
conventional = sga.get_conventional_standard_structure()
print(f"Primitive: {len(primitive)} sites | Conventional: {len(conventional)} sites")
# Wyckoff positions
sym_dataset = sga.get_symmetry_dataset()
print(f"Wyckoff letters: {set(sym_dataset['wyckoffs'])}")Thermodynamic stability and phase boundary analysis.
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter from mp_api.c
Turn your AI coding agent into a life sciences expert — 199 bioinformatics skills for Claude Code covering RNA-seq, single-cell analysis, genomics, proteomics, drug discovery, and more. Boosted BixBench from 65% to 92%. Open source.
Scaffold a new SciAgent-Skills entry. Picks pipeline/toolkit/database/guide template, creates skills/{category}/{name}/SKILL.md with valid frontmatter, appends…
Bayesian modeling with PyMC 5: priors, likelihood, NUTS/ADVI sampling, diagnostics (R-hat, ESS), LOO/WAIC comparison, prediction. Hierarchical, logistic, GP…
Time-to-event modeling with scikit-survival: Cox PH (elastic net), Random Survival Forests, Boosting, SVMs for censored data. C-index, Brier, time-dependent…
Guided statistical analysis: test choice, assumption checks, effect sizes, power, APA reporting. Pick tests, verify assumptions, or format results for…
Python statistical modeling: regression (OLS, WLS, GLM), discrete (Logit, Poisson, NegBin), time series (ARIMA, SARIMAX, VAR), with rigorous inference,…
DL cell/nucleus segmentation for fluorescence and brightfield microscopy. Pre-trained models (cyto3, nuclei, tissuenet) and a generalist flow-based algorithm…