---
name: mat-calphad-property-diagram
description: Calculate temperature-dependent thermodynamic properties like Equilibrium Phase Fractions for a specific alloy composition using CALPHAD models.
metadata:
  category: [materials]
  venv: [cpu]
---

# mat-calphad-property-diagram

## Goal
To predict the equilibrium phase stability, phase fractions, and other extensive thermodynamic properties for a fixed multi-component alloy at different temperatures using PyCalphad. Very useful for modeling solidification, heat treatment paths, and precipitation sequences.

## Instructions

### 1. Identify Thermodynamic Database
You must obtain a legitimate `.tdb` (Thermodynamic Data Base) file for the chemical system.

### 2. Plot Equilibrium Phase Fractions
Calculate what phases are present, and their molar fractions, across a cooling/heating schedule for a fixed composition.

```bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/plot_phase_fractions.py path/to/database.tdb --elements Element1 Element2 --composition Element2 0.3 --t-range 300 1000 10 --output research_dir/phase_fractions.png
```

- `--composition`: The solute element and its molar fraction (e.g. `Zn 0.3` means 30 mol% Zn).
- `--t-range`: `START STOP STEP` in Kelvin. Ensure solving across liquidus and solidus.

## Examples

Evaluating phase fractions for an Al-40%Zn alloy as it cools:
```bash
${CLAUDE_SKILL_DIR}/../../venv/run cpu python ${CLAUDE_SKILL_DIR}/scripts/plot_phase_fractions.py ${CLAUDE_SKILL_DIR}/../mat-calphad-phase-diagram/examples/Al-Zn/alzn_mey.tdb --elements Al Zn --composition Zn 0.4 --t-range 300 900 10 --output phase_fractions.png
```

## Constraints
- **Environments**: Scripts require the `cpu` environment.
- Only plots equilibrium step (lever-rule). For non-equilibrium fast solidification (Scheil), custom scripting is required.

## References
- Richard Otis and Zi-Kui Liu. "pycalphad: CALPHAD-based Computational Thermodynamics in Python." *Journal of Open Research Software* (2017).

---

**Author:** Bowen Deng
**Contact:** [GitHub @learningmatter-mit](https://github.com/learningmatter-mit)
