Skip to content

CALPHAD equilibria, which answer a question the hull cannot - #16

Merged
Starlitnightly merged 2 commits into
mainfrom
optional-extras-and-calphad
Aug 4, 2026
Merged

CALPHAD equilibria, which answer a question the hull cannot#16
Starlitnightly merged 2 commits into
mainfrom
optional-extras-and-calphad

Conversation

@Starlitnightly

Copy link
Copy Markdown
Contributor

mv.thermo.calphad reads an assessed thermodynamic database and reports which phases coexist at a temperature, and in what fraction.

That is a different question from mv.thermo.hull, not a better answer to the same one. The hull is computed here at 0 K from energies this library produced and extends to compositions nobody has assessed; CALPHAD reads parameters fitted to measured phase boundaries and covers liquids, solution phases and temperature. Neither supersedes the other.

Checked against a measured number

The Pb-Sn eutectic is 456 K. At the eutectic composition:

450 K 455 K
eutectic FCC_A1 + BCT_A5 LIQUID
Pb-rich FCC_A1 FCC_A1
Sn-rich FCC_A1 + BCT_A5 LIQUID + BCT_A5

Two solids below, one liquid above — the two temperatures straddle it. The off-eutectic compositions melt over a range instead, which is what an alloy away from the eutectic does.

Two things the notes say plainly

The database is the whole calculation. matverse ships none — assessed databases are years of work and mostly licensed — so you supply one and uns["calphad"] records which. Two assessments of the same system will disagree, and that spread is the error bar, not the precision of the numbers.

An unassessed element is skipped and counted, never projected. Dropping the copper from PbSnCu and renormalising answers a question about a different alloy.

Packaging

pycalphad is pinned below 0.11: 0.11 builds against scipy 1.18, which ships no manylinux_2_17 wheel. An older glibc cannot get there, and the failure surfaces as a scipy build error deep inside pycalphad's build environment, where a runtime constraint does not reach.

Also

test_mudata_assembly_is_optional_and_works asserted only that assembly works. Where mudata was absent it raised rather than skipping, so it failed on exactly the installation it was named after, and the "optional" half was never checked. CI never saw it because the multi extra is always installed there.

Verification

966 pass on py3.12, 850 on py3.10. Contract-verified rate stays 165/165. All 16 notebooks execute — the table above is printed by the notebook, not transcribed. Docs build.


Not in this PR: mv.prop.kappa_bte (phono3py) is written and passing its own checks, but five nominally identical runs gave κ of 26.1, 34.3, 48.3, 50.5 and 122.0 W/m/K for silicon — a factor of five. The potentials are deterministic to 2e-7 eV/Å, so the variation is downstream of the forces and is still being traced. A thermal conductivity that returns a different answer each run is worse than none.

🤖 Generated with Claude Code

https://claude.ai/code/session_016wh5NzNE9Wn49nuUm7zg2a

Zehua Zeng and others added 2 commits August 4, 2026 07:34
test_mudata_assembly_is_optional_and_works asserted only that assembly works.
Where mudata was absent it raised rather than skipping, so it failed on exactly
the installation it was named after, and the 'optional' half was never checked
at all. CI never saw it because the multi extra is always installed there; it
turned up on a scratch environment built with a narrower set of extras.

It now checks both branches: with mudata present the object assembles, and
without it the call raises an ImportError that names the package.
mv.thermo.calphad reads an assessed thermodynamic database and reports which
phases coexist at a temperature, and in what fraction. That is a different
question from mv.thermo.hull, not a better answer to the same one: the hull is
computed here at 0 K from energies this library produced and extends to
compositions nobody has assessed, while CALPHAD reads parameters fitted to
measured phase boundaries and covers liquids, solution phases and temperature.

Checked against a measured number rather than against itself. The Pb-Sn
eutectic is 456 K, and at the eutectic composition this gives two solid phases
at 450 K and a single liquid at 455 K. Off-eutectic compositions melt over a
range instead - LIQUID + BCT_A5 - which is what an alloy away from the eutectic
does.

Two things the notes say plainly because they decide whether a number means
anything. The database is the whole calculation, matverse ships none, and two
assessments of the same system will disagree - that spread is the error bar,
not the precision of the numbers. And a material containing an element the
database does not assess is skipped and counted, never projected onto the
elements that remain: dropping the copper from PbSnCu and renormalising answers
a question about a different alloy.

pycalphad is pinned below 0.11 because 0.11 builds against scipy 1.18, which
ships no manylinux_2_17 wheel; an older glibc cannot get there, and the failure
is a scipy build error deep inside pycalphad's build environment where a
runtime constraint does not reach.

Also fixes test_mudata_assembly_is_optional_and_works, which asserted only that
assembly works. Where mudata was absent it raised rather than skipping, so it
failed on exactly the installation it was named after and the 'optional' half
was never checked. CI never saw it because the multi extra is always installed
there.

966 tests pass on py3.12, 850 on py3.10. Contract-verified rate stays 165/165,
all 16 notebooks execute, docs build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wh5NzNE9Wn49nuUm7zg2a
@Starlitnightly
Starlitnightly merged commit 9908a59 into main Aug 4, 2026
6 checks passed
@Starlitnightly
Starlitnightly deleted the optional-extras-and-calphad branch August 4, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant