pycalphad
БесплатноБез исполняемых скриптовНе проверенExpert guidance for pycalphad - computational thermodynamics library implementing the CALPHAD method for calculating phase diagrams, phase equilibria, and…
Об этом скилле
pycalphad - Computational Thermodynamics in Python
Overview
pycalphad is a Python library for computational thermodynamics within the CALPHAD (CALculation of PHAse Diagrams) framework. It enables users to design thermodynamic models, compute phase diagrams, calculate phase equilibria, and predict thermodynamic properties for multicomponent materials systems.
Core capabilities:
- Read and process Thermo-Calc database (TDB) files
- Calculate binary, ternary, and multicomponent phase diagrams
- Perform Gibbs energy minimization for phase equilibrium
- Compute thermodynamic properties (activity, chemical potentials, heat capacity)
- Model ordered phases and systems with charged species
- Calculate driving forces and metastability
Target users: Researchers and practitioners in materials science, metallurgy, and computational thermodynamics who want to perform CALPHAD calculations programmatically.
When to Use This Skill
Use pycalphad when:
- Calculating phase diagrams (binary, ternary, or multicomponent systems)
- Determining phase equilibria at specific temperature/composition/pressure conditions
- Computing thermodynamic properties from CALPHAD databases
- Analyzing metastability and driving forces for phase transformations
- Modeling systems with ordered phases or charged species
- Automating thermodynamic calculations for materials design
- Creating custom thermodynamic models or property frameworks
- Visualizing phase stability regions and property maps
Don't use when:
- You need first-principles calculations (use VASP, Quantum ESPRESSO, GPAW instead)
- You need molecular dynamics simulations (use ASE, LAMMPS instead)
- Working with kinetic models (pycalphad is for equilibrium thermodynamics)
Core Concepts
1. Database (TDB Files)
Thermodynamic databases in Thermo-Calc format containing:
- Phase definitions and constituents
- Gibbs energy models for each phase
- Model parameters fitted to experimental data
- Temperature, composition, and pressure ranges
2. Components and Species
- Components: Independent chemical elements (e.g., Al, Fe, Ni)
- Species: Charged or molecular entities in ionic systems
3. Phases
Distinct thermodynamic phases with specific crystal structures and energy models:
- Liquid, FCC, BCC, HCP, intermetallic compounds, etc.
- Each phase has a sublattice model defining site occupancy
4. State Variables
Conditions that define the system state:
- Temperature (T)
- Pressure (P)
- Composition (mole fractions: X_i, Y_i, etc.)
- Chemical potential (MU)
5. Calculate vs Equilibrium
- calculate(): Evaluate properties at specified conditions (no equilibrium minimization)
- equilibrium(): Find stable phase assemblage by minimizing Gibbs energy
Quick Reference
| Task | Function | Key Parameters |
|---|---|---|
| Load database | Database('database.tdb') |
TDB file path |
| Binary phase diagram | binplot(db, comps, phases, conditions) |
components, phases, T/X ranges |
| Equilibrium calculation | equilibrium(db, comps, phases, conditions) |
P, T, composition |
| Property calculation | calculate(db, comps, phases, conditions) |
P, T, composition, output |
| Ternary diagram | Use equilibrium() with 3 components |
T, P, composition grid |
| Activity calculation | Access from equilibrium dataset | ACR_* variables |
| Driving force | equilibrium() with metastable phases |
Compare energies |
Installation
# via pip
pip install pycalphad
# via conda
conda install -c conda-forge pycalphad
# development version
pip install git+https://github.com/pycalphad/pycalphad.git
Dependencies: Python 3.9+, numpy, scipy, xarray, sympy, matplotlib
Common Workflows
1. Binary Phase Diagram
from pycalphad import Database, binplot
import matplotlib.pyplot as plt
# Load thermodynamic database
db = Database('alzn_mey.tdb')
# Define components and phases
comps = ['AL', 'ZN', 'VA'] # VA = vacancy for gas phase
phases = ['LIQUID', 'FCC_A1', 'HCP_A3']
# Plot isobaric (constant pressure) binary diagram
fig = plt.figure(figsize=(8, 6))
binplot(db, comps, phases,
conditions={'P': 101325, 'T': (300, 1000, 10), 'X(ZN)': (0, 1, 0.01)})
plt.xlabel('X(ZN)')
plt.ylabel('Temperature (K)')
plt.title('Al-Zn Binary Phase Diagram')
plt.savefig('al-zn-diagram.png')
2. Equilibrium Calculation at Fixed Conditions
from pycalphad import Database, equilibrium, variables as v
import numpy as np
# Load database
db = Database('nist_ni_al.tdb')
# Define system
comps = ['NI', 'AL', 'VA']
phases = ['LIQUID', 'FCC_L12', 'BCC_B2']
# Calculate equilibrium at 1500K, 1 atm, 50 at% Al
result = equilibrium(db, comps, phases,
{v.T: 1500, v.P: 101325, v.X('AL'): 0.5})
# Access results
print("Stable phases:", result.Phase.values.squeeze())
print("Phase fractions:", result.NP.values.squeeze())
print("Compositions:", result.X.values.squeeze())
print("Gibbs ener
Установить pycalphad в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
*Вложенные файлы
FAQ
Что делает скилл pycalphad?
Expert guidance for pycalphad - computational thermodynamics library implementing the CALPHAD method for calculating phase diagrams, phase equilibria, and thermodynamic properties of multicomponent materials systems using thermodynamic databases (TDB files)
Как установить скилл pycalphad?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pycalphad запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic