본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트33k · #9005

pymatgen

하는 일

이 스킬은 에이전트에게 재료 과학을 위한 Python 라이브러리 pymatgen을 제공합니다. 결정 구조 파일을 읽고 쓰며 그 특성을 분석합니다. 재료 과학자와 계산 화학자를 위한 스킬입니다.

사용하는 경우

  • ✓CIF와 POSCAR 같은 형식 사이에서 결정 구조를 변환해야 할 때.
  • ✓재료의 대칭성, 공간군, 밴드 갭을 분석하고 싶을 때.
  • ✓Materials Project 데이터베이스의 계산된 재료를 조회해야 할 때.

스킬 링크

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/pymatgen/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/pymatgen/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 실리콘 CIF 파일을 불러와 공간군을 확인하고, VASP용 POSCAR 파일로 변환해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 pymatgen으로 구조를 불러오고, 요청한 분석을 실행한 뒤 결과나 변환된 파일을 씁니다. Materials Project도 조회할 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Pymatgen - Python Materials Genomics

Overview

Pymatgen is a comprehensive Python library for materials analysis that powers the Materials Project. Create, analyze, and manipulate crystal structures and molecules, compute phase diagrams and thermodynamic properties, analyze electronic structure (band structures, DOS), generate surfaces and interfaces, and access Materials Project's database of computed materials. Supports 100+ file formats from various computational codes.

When to Use This Skill

This skill should be used when:

  • Working with crystal structures or molecular systems in materials science
  • Converting between structure file formats (CIF, POSCAR, XYZ, etc.)
  • Analyzing symmetry, space groups, or coordination environments
  • Computing phase diagrams or assessing thermodynamic stability
  • Analyzing electronic structure data (band gaps, DOS, band structures)
  • Generating surfaces, slabs, or studying interfaces
  • Accessing the Materials Project database programmatically
  • Setting up high-throughput computational workflows
  • Analyzing diffusion, magnetism, or mechanical properties
  • Working with VASP, Gaussian, Quantum ESPRESSO, or other computational codes

Quick Start Guide

Installation

# Core pymatgen
uv pip install pymatgen

# With Materials Project API access
uv pip install pymatgen mp-api

# Optional dependencies for extended functionality
uv pip install pymatgen[analysis]  # Additional analysis tools
uv pip install pymatgen[vis]       # Visualization tools

Basic Structure Operations

from pymatgen.core import Structure, Lattice

# Read structure from file (automatic format detection)
struct = Structure.from_file("POSCAR")

# Create structure from scratch
lattice = Lattice.cubic(3.84)
struct = Structure(lattice, ["Si", "Si"], [[0,0,0], [0.25,0.25,0.25]])

# Write to different format
struct.to(filename="structure.cif")

# Basic properties
print(f"Formula: {struct.composition.reduced_formula}")
print(f"Space group: {struct.get_space_group_info()}")
print(f"Density: {struct.density:.2f} g/cm³")

Materials Project Integration

# Set up API key
export MP_API_KEY="your_api_key_here"
from mp_api.client import MPRester

with MPRester() as mpr:
    # Get structure by material ID
    struct = mpr.get_structure_by_material_id("mp-149")

    # Search for materials
    materials = mpr.materials.summary.search(
        formula="Fe2O3",
        energy_above_hull=(0, 0.05)
    )

Core Capabilities

1. Structure Creation and Manipulation

Create structures using various methods and perform transformations.

From files:

# Automatic format detection
struct = Structure.from_file("structure.cif")
struct = Structure.from_file("POSCAR")
mol = Molecule.from_file("molecule.xyz")

From scratch:

from pymatgen.core import Structure, Lattice

# Using lattice parameters
lattice = Lattice.from_parameters(a=3.84, b=3.84, c=3.84,
                                  alpha=120, beta=90, gamma=60)
coords = [[0, 0, 0], [0.75, 0.5, 0.75]]
struct = Structure(lattice, ["Si", "Si"], coords)

# From space group
struct = Structure.from_spacegroup(
    "Fm-3m",
    Lattice.cubic(3.5),
    ["Si"],
    [[0, 0, 0]]
)

Transformations:

from pymatgen.transformations.standard_transformations import (
    SupercellTransformation,
    SubstitutionTransformation,
    PrimitiveCellTransformation
)

# Create supercell
trans = SupercellTransformation([[2,0,0],[0,2,0],[0,0,2]])
supercell = trans.apply_transformation(struct)

# Substitute elements
trans = SubstitutionTransformation({"Fe": "Mn"})
new_struct = trans.apply_transformation(struct)

# Get primitive cell
trans = PrimitiveCellTransformation()
primitive = trans.apply_transformation(struct)

Reference: See references/core_classes.md for comprehensive documentation of Structure, Lattice, Molecule, and related classes.

2. File Format Conversion

Convert between 100+ file formats with automatic format detection.

Using convenience methods:

# Read any format
struct = Structure.from_file("input_file")

# Write to any format
struct.to(filename="output.cif")
struct.to(filename="POSCAR")
struct.to(filename="output.xyz")

Using the conversion script:

# Single file conversion
python scripts/structure_converter.py POSCAR structure.cif

# Batch conversion
python scripts/structure_converter.py *.cif --output-dir ./poscar_files --format pos
자주 묻는 질문

어떤 파일 형식을 지원하나요?

스킬은 계산 코드에서 나온 100가지가 넘는 형식(CIF, POSCAR 포함)을 지원한다고 설명합니다.

Materials Project와 함께 쓸 수 있나요?

네. 스킬은 API로 Materials Project 데이터베이스에 접근하는 것을 다룹니다.

어떤 코드와 작동하나요?

스킬은 VASP, Gaussian, Quantum ESPRESSO 등을 언급합니다.

상세 정보

작성자의 원본 설명

Materials science toolkit. Crystal structures (CIF, POSCAR), phase diagrams, band structure, DOS, Materials Project integration, format conversion, for computational materials science.

repo: davila7/claude-code-templates

인기도

GitHub 스타
33k
순위
#9005
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬