科研 Skill

材料结构与成分核心分析

materials-structure-analysis

Covers core structure and composition analysis: reading/writing crystal structures, composition handling, symmetry analysis, phase diagrams. Use as a general-purpose structure-analysis toolkit.

发布者 Codar安全审核通过v0.1.0更新于 2026-11-18

SKILL.md

Materials Structure and Composition Analysis

Overview

This is the foundational data layer nearly every other skill in this repo builds on: representing compositions and crystal structures as objects, converting between file formats, determining symmetry, constructing phase diagrams from computed energies, reading/writing electronic-structure code files, and querying public materials databases. pymatgen is the standard tool for all of this — this skill covers its core workflows as complete, usable content, not a pointer elsewhere.

When to use this skill

Activate when the request involves:

  • Crystal structures, compositions, space groups, phase diagrams, convex hull, electronic structure files, Materials Project
  • Terms: pymatgen, Structure, Composition, SpacegroupAnalyzer, PhaseDiagram, POSCAR, band structure, DOS, mp-api
  • File formats: .cif, .poscar/CONTCAR, .xyz, VASP/Quantum Espresso structure/output files
  • "Parse this structure file," "determine the space group," "build a phase diagram," "query Materials Project"

Which reference to read

You have...Read
A question about symmetry, transformations, or structure manipulation beyond basic I/Oreferences/symmetry-and-transformations.md
A question about phase stability, convex hull, or phase diagramsreferences/phase-diagrams.md
A question about reading/writing DFT code files (VASP, Quantum Espresso) or band structure/DOSreferences/electronic-structure-io.md
A question about querying the Materials Project database specificallyreferences/materials-project-queries.md

For the DFT calculation itself (running VASP/QE, convergence, pseudopotentials), see computational-materials/references/dft.md — this skill covers the structure/data objects those calculations consume and produce, not running the calculation.

Core usage — structure and composition basics

Composition handling

from pymatgen.core import Composition

comp = Composition("Fe2O3")
print(comp.weight)                  # molecular weight
print(comp.get_atomic_fraction("Fe"))
print(comp.reduced_formula)          # normalized formula

Reading, writing, and inspecting structures

from pymatgen.core import Structure

structure = Structure.from_file("material.cif")     # also reads POSCAR, .xyz, and other formats by extension
print(structure.composition)
print(structure.lattice)
print(structure.density)

structure.to(filename="material.poscar", fmt="poscar")

Building a structure from scratch

from pymatgen.core import Structure, Lattice

lattice = Lattice.cubic(4.2)
structure = Structure(lattice, ["Na", "Cl"], [[0, 0, 0], [0.5, 0.5, 0.5]])

Structure matching (comparing two structures, e.g. before/after relaxation)

from pymatgen.analysis.structure_matcher import StructureMatcher

matcher = StructureMatcher()
are_equivalent = matcher.fit(structure_1, structure_2)   # accounts for symmetry-equivalent representations

Validation & Pitfalls

Canonical reference: Ong et al. (2013), "Python Materials Genomics (pymatgen): A robust, open-source python library for materials analysis," Computational Materials Science — the foundational pymatgen paper covering the scope this skill is built around.

  • File format auto-detection by extension can fail silently on nonstandard filenames — a correctly-formatted POSCAR file not named POSCAR/CONTCAR or lacking a recognized extension may parse incorrectly or raise an unclear error; when in doubt, specify the format explicitly rather than relying on auto-detection.
  • reduced_formula normalizes to integer ratios and can obscure the actual unit cell content — for a structure with an unusual number of formula units per cell (e.g. Z=4), the reduced formula doesn't tell you the actual cell composition; check structure.composition (unreduced) when cell content specifically matters, not just stoichiometric ratio.
  • StructureMatcher's default tolerances are reasonable for many cases but not universal — very similar-but-genuinely-distinct structures (e.g. polymorphs with subtle distortions) can be reported as matching, or vice versa, depending on tolerance settings; check and report the tolerances used for any claim resting on structure equivalence.
  • A structure parsed from a computational output file (e.g. a relaxed VASP structure) carries no information about calculation convergence or accuracy — treat a structure object as exactly what it is (a set of coordinates), not implicitly validated data; convergence/accuracy questions belong to computational-materials, not this layer.

示例提示词

帮我用pymatgen读取这个结构文件并做对称性分析和相图构建。

所属插件

材料表征、性能与材料信息学面向实验与数据驱动的材料研究:XRD/电镜/谱学/热分析/力学测试等表征,合成与加工,电化学与半导体表征,相场、CALPHAD 与连续介质力学,材料数据库、特征工程、贝叶斯优化与主动学习,选材与生命周期评价。

安装该插件会一并获得同领域的 42 个 Skill / MCP。

同插件的其他科研 Skill

常见问题

材料结构与成分核心分析能做什么?

Covers core structure and composition analysis: reading/writing crystal structures, composition handling, symmetry analysis, phase diagrams. Use as a general-purpose structure-analysis toolkit。

如何安装材料结构与成分核心分析?

在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「材料结构与成分核心分析」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。

材料结构与成分核心分析需要哪些权限?

该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。

材料结构与成分核心分析经过官方审核吗?

是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。