A library to calculate alloy thermodynamic equilibria and plot phase diagrams in the (semi-)grand ensemble.
Project description
landau.py
A library to calculate thermodynamic equilibria and plot phase diagrams of binary alloys in the (semi-)grand ensemble.
You supply a free energy model for each phase — analytic toy models, CALPHAD-style parametrizations, or interpolations of computed free energy data — and landau finds the stable phases, refines the phase boundaries and draws the diagram.
Installation
pip install landau
Quickstart
Phases are defined by their free energies. Two ideal solutions — a solid and a liquid — already give a full binary phase diagram:
import numpy as np
from landau import LinePhase, IdealSolution, plot_phase_diagram
from landau.calculate import calc_phase_diagram
from landau.phases import kB
solid = IdealSolution("solid",
LinePhase("A", fixed_concentration=0, line_energy=-2.0, line_entropy=1.0 * kB),
LinePhase("B", fixed_concentration=1, line_energy=-3.0, line_entropy=1.5 * kB))
liquid = IdealSolution("liquid",
LinePhase("A(l)", fixed_concentration=0, line_energy=-1.9, line_entropy=2.5 * kB),
LinePhase("B(l)", fixed_concentration=1, line_energy=-2.9, line_entropy=2.2 * kB))
df = calc_phase_diagram([solid, liquid], Ts=np.linspace(400, 1800, 100), mu=100)
plot_phase_diagram(df)
calc_phase_diagram returns a plain pandas dataframe of (T, mu, phase, c, phi)
samples that the plotting functions consume, so intermediate results stay easy
to inspect and post-process.
Real Systems
The same interface works with computed free energies. This Mg–Ca phase diagram is calculated from free energies of an Atomic Cluster Expansion potential, obtained by thermodynamic integration with calphy:
The Mg–Ca worked example goes from raw free energy samples to this diagram.
Looking Under the Hood
plot_excess_free_energy shows the free energy curves behind a diagram,
including metastable phases and the common tangent constructions that
determine the stable regions:
More Examples
The documentation walks through the full API, including the basic concepts, congruent and non-congruent melting, stoichiometric line compounds and point defects.
Citation
This code is part of a publication, please cite it accordingly if you use this package in your work
@article{poul2025automated,
title = {Automated generation of structure datasets for machine learning potentials and alloys},
journal = {npj Computational Materials},
author = {Poul, Marvin and Huber, Liam and Neugebauer, J{\"o}rg},
volume = {11},
number = {1},
pages = {174},
year = {2025},
doi = {10.1038/s41524-025-01669-4},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file landau-1.9.0.tar.gz.
File metadata
- Download URL: landau-1.9.0.tar.gz
- Upload date:
- Size: 23.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43ca236fcabd9c9b1b069db54bf03b027c23ae2fdc25e08f99f7914205329efe
|
|
| MD5 |
33ab2682b12086ab42fbc3eb1bdb29a7
|
|
| BLAKE2b-256 |
c8d9cd5fe9fc0a8018c7fd1e9f8bf7a5a769a8bf7bb46e3b97928ed3d06be21f
|
Provenance
The following attestation bundles were made for landau-1.9.0.tar.gz:
Publisher:
pypi-publish.yml on eisenforschung/landau
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
landau-1.9.0.tar.gz -
Subject digest:
43ca236fcabd9c9b1b069db54bf03b027c23ae2fdc25e08f99f7914205329efe - Sigstore transparency entry: 1917026549
- Sigstore integration time:
-
Permalink:
eisenforschung/landau@3f5a887a8df035f0aa634326deb386ad67edc12b -
Branch / Tag:
refs/tags/1.9.0 - Owner: https://github.com/eisenforschung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@3f5a887a8df035f0aa634326deb386ad67edc12b -
Trigger Event:
release
-
Statement type: