技能 pymatgen
🔬

pymatgen

安全 ⚡ 包含腳本📁 檔案系統存取🌐 網路存取🔑 環境變數

分析晶体结构和材料属性

也可從以下取得: K-Dense-AI

计算材料科学需要分析晶体结构、相图和电子性质。该技能提供对 pymatgen 库功能的全面访问,包括结构文件转换、对称性分析以及 Materials Project 数据库集成。

支援: Claude Codex Code(CC)
🥉 75 青銅
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「pymatgen」。 读取 structure.cif 并分析其属性

預期結果:

  • Formula: Fe2O3 (reduced: Fe2O3)
  • Lattice: a=5.035 A, b=5.035 A, c=13.725 A
  • Space group: R-3c (#167)
  • Crystal system: trigonal
  • Density: 5.26 g/cm3
  • Number of sites: 10

正在使用「pymatgen」。 在 Materials Project 中搜索 Li-Fe-O 化合物

預期結果:

  • Found 12 materials in Li-Fe-O system
  • LiFeO2: stable (energy above hull: 0.0 eV/atom)
  • LiFe5O8: metastable (energy above hull: 0.032 eV/atom)
  • LiFe3O5: metastable (energy above hull: 0.051 eV/atom)

正在使用「pymatgen」。 为 Al-O 体系生成相图

預期結果:

  • Phase diagram generated for Al-O system
  • Stable compounds: Al2O3, AlO, Al3O2
  • Al2O3 is the most stable oxide at standard conditions
  • Plot saved to al_o_phase_diagram.png

安全審計

安全
v5 • 1/17/2026

This skill contains documentation and reference materials for the pymatgen library plus three utility scripts. All static findings are FALSE POSITIVES: backticks are documentation formatting, cryptographic mentions are computational chemistry methods (B3LYP), API key access is legitimate Materials Project authentication, and network access is limited to official Materials Project API. No malicious code patterns, obfuscation, or data exfiltration detected.

10
已掃描檔案
4,084
分析行數
4
發現項
5
審計總數
審計者: claude 查看審計歷史 →

品質評分

68
架構
100
可維護性
85
內容
22
社群
100
安全
78
規範符合性

你能建構什麼

晶体结构分析

分析晶体结构的对称性、空间群和配位环境

相图构建

从 Materials Project 数据构建和可视化相图

电子结构分析

分析能带结构、态密度和电子性质

試試這些提示

读取结构文件
从文件 {filename} 读取结构并显示其成分、晶格参数和空间群。
转换格式
将 {input_file} 从 CIF 格式转换为 POSCAR 格式并保存为 POSCAR_output。
分析稳定性
使用相图分析检查 {composition} 在 {chemical_system} 体系中的热力学稳定性。
查询 Materials Project
在 Materials Project 中搜索化学式为 {formula} 且带隙在 {min_gap} 到 {max_gap} eV 之间的材料。

最佳實務

  • 对大多数晶体结构格式使用 Structure.from_file() 进行自动格式检测
  • 访问 Materials Project API 时始终使用 MPRester() 的上下文管理器
  • 读取结构后通过检查原子重叠或不合理的键长来验证结构

避免

  • 在脚本中硬编码 API 密钥而不是使用环境变量
  • 在自动检测失败时读取结构而不检查文件格式
  • 在高通量计算之前跳过对称性分析

常見問題

支持哪些文件格式?
Pymatgen 支持100多种格式,包括 CIF、POSCAR、XYZ、PDB、JSON、YAML,以及 VASP、Gaussian、Quantum ESPRESSO、LAMMPS 和其他代码的输出格式。
如何获取 Materials Project API 密钥?
在 next-gen.materialsproject.org 创建账户,导航到您的仪表板,生成 API 密钥,并将其设置为 MP_API_KEY 环境变量。
该技能可以运行 VASP 或 Gaussian 计算吗?
不能。该技能提供工具来准备输入文件和分析计算代码的输出,但不执行计算本身。
使用 Materials Project API 时我的数据安全吗?
API 调用从 Materials Project 检索公共数据。您在本地分析的结构数据不会被传输。只有 API 密钥会被发送以验证请求。
为什么我的结构对称性分析失败?
结构对称性分析可能由于数值精度问题而失败。尝试使用 SpacegroupAnalyzer(struct, symprec=0.1) 或更高值来增加容差。
与其他材料科学工具相比如何?
Pymatgen 是 Materials Project 的底层库。与 ASE 或 spheroview 不同,它提供全面的分析工具并与最大的计算材料数据库集成。