landau.calculate¶
Calculates phase diagrams from sets of Phases.
- landau.calculate.calc_phase_diagram(phases, Ts, mu, refine=True, keep_unstable=False)[source]¶
Calculate phase diagram at given sampling points.
- Parameters:
phases (
Iterable[Phase])Ts (
Union[Iterable[float],float]) – sampling points in temperaturemu (
Union[Iterable[float],float,int]) – sampling points in chemical potential; if a non-zero int, guess sampling points with guess_mu_range at max(Ts) (passmu=0.0for a fixed-mu temperature-only diagram)refine (
Union[bool,Sequence[Refiner]]) – add additional sampling points at exact phase transitions.Truepicks defaults based on which ofT/muare sampled,Falseskips refinement, and an explicit sequence ofRefinerinstances applies just those.keep_unstable (
bool) – ifTrue, keep entries of all phases at all sampling points, otherwise only keep entries of stable phases
- Returns:
dataframe of phase points; the
locuscolumn classifies each row as aLocusvalue ("interior","boundary","triple"or"congruent"); withkeep_unstable=Truethedphicolumn isphiminus the lowestphiamong the rows at the same(T, mu), i.e. how far a phase sits above the stable one (0for stable rows,NaNon the syntheticmu = +-infedges; refined rows are zero up to the refiners’ numerical tolerance). Thef_excesscolumn isfrelative to the chord between the lowest free energies of the pure components at each row’sT; it is left out when the phases do not reach bothc = 0andc = 1.
- landau.calculate.cluster_T_c(dd, *, distance_threshold)[source]¶
Cluster points by (T, c) coordinates; used by cluster_phase.
- Parameters:
dd – DataFrame with columns ‘T’ and ‘c’.
distance_threshold – Required. Agglomerative clustering cut-off in normalised (T, c) space. Smaller values split more aggressively; larger values merge more. Values of roughly 0.01-0.3 keep the test fixtures’ disconnected same-phase fields apart (see
tests/regression/test_issue_456.py), while over-splitting of connected fields starts between 0.05 and 0.1. The user-facing default lives oncluster_phase()andget_polygons().
- Return type:
Series
- landau.calculate.cluster_T_c_mu(dd, *, distance_threshold)[source]¶
Cluster points by (T, c, mu); rows with mu=±inf get their own distinct labels.
Used by get_transitions. The mu=±inf rows are border edges from _border_edges and must not be fed to AgglomerativeClustering.
- Parameters:
dd – DataFrame with columns ‘T’, ‘c’, and ‘mu’.
distance_threshold – Agglomerative clustering cut-off in normalised (T, c, mu) space. See
cluster_T_c()for tuning guidance.
- Return type:
Series
- landau.calculate.get_transitions(df)[source]¶
Identify “continuous” two-phase transition lines in mu/T space, i.e. transitions between the same two phases and along which mu/T are continuous.
Useful for plotting below, but potentially also to augment the existing refining routines and acquire additional Free energies from calphy/etc. to improve the diagram.