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 int guess sampling points with guess_mu_range at max(Ts)refine (
bool) – add additional sampling points at exact phase transitionskeep_unstable (
bool) – only keep entries of stable phases, otherwise keep entries of all phases at all sampling points
- Returns:
dataframe of phase points
- 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 – Agglomerative clustering cut-off in normalised (T, c) space. Smaller values split more aggressively; larger values merge more. 0.5 was hand-tuned for 2D T-c diagrams — lower it (e.g. 0.2) when disconnected stable segments within one phase are incorrectly merged.
- 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.