Thermodynamic stability (stability)#
Calculation of spinodal and binodal
Classes:
Modified root result |
|
|
Base class for stability |
|
Methods for calculation locations of spinodal |
|
Routines to calculate binodal. |
Functions:
|
Locate spinodal point for a given pair of phases. |
- lnpy.stability.get_spinodal(collection, build_phases, idx, idx_nebr=None, efac=1.0, dlnz=0.5, dfac=1.0, vmin=0.0, vmax=100000.0, ntry=20, step=None, nmax=20, ref=None, build_kws=None, close_kws=None, solve_kws=None)[source]#
Locate spinodal point for a given pair of phases.
- Parameters:
ref (
lnPiMasked)collection (
lnPiCollection) – initial estimates to work from. Function assumes collection is in lnz sorted orderidx, idx_nebr (
int) – from/to phase idlnz_in (
list) – list with value of static chem pot, and None for variable. e.g., lnz_in=[None,0.0] implies lnz[0] is variable, and lnz[1]=0.0efac (
float, optional) – cutoff value for spinodaldlnz (
float, optional) – factor to kick back if collection doesn’t already have left and right boundsvmin (
float, optional) – Value denotingvmin, i.e., value of free energy difference phase does not exist.vmax (
float, optional) – value indicating no transition, but phase idx is present.ntry (
int, default20) – number of times to try kicking forward/backwards to find bracketstep (
intorNone, defaultNone) – if +1, step forward if -1, step backward if None, try to determine stepnmax (
int, default20) – max number of steps to refine bracketbuild_phases (
callable(), optional) – Function to create Phases. Default is that from get_default_phasecreatorbuild_kws (
dict, optional) – extra arguments tobuild_phasesclose_kws (
dict, optional) – arguments tonumpy.allclose()solve_kws (
dict, optional) – extra arguments toscipy.optimize.brentq()
- Returns:
out (
lnPiCollectionobject at spinodal point)r (
object) – Info object
- class lnpy.stability.StabilityBase(collection)[source]#
Bases:
objectBase class for stability
- Parameters:
collection (
lnPiCollection) – Used to bracket the location limit of stability
Attributes:
Accessor to parent
lnPiCollectionobjectAccess to the underlying data
View (
lnpy.lnpiseries.lnPiCollection) of stabilityMethods:
append_to_parent([sort, copy_stability])New collection with spinodal data appended to parent.
- property parent#
Accessor to parent
lnPiCollectionobject
- property items#
Access to the underlying data
- access[source]#
View (
lnpy.lnpiseries.lnPiCollection) of stability
- class lnpy.stability.Spinodals(collection)[source]#
Bases:
StabilityBaseMethods for calculation locations of spinodal
Methods:
__call__(phase_ids, build_phases, *[, ...])- __call__(phase_ids, build_phases, *, inplace=True, ref=None, build_kws=None, force=False, as_dict=True, unstack=None, raise_unconverged=True, **kwargs)[source]#
- Parameters:
phase_ids (
int, or sequence) – Phase ids to calculate spinodal for. If int, then find spinodals for phases range(phase_ids).build_phases (
callable()) – Factory function to build phases. This should most likely be an instance oflnpy.segment.BuildPhasesBaseref (
lnPiMasked, optional)build_kws (
dict, optional) – optional arguments to build_phasesinplace (
bool, defaultTrue) – if True, add spinodal inplace, otherwise return spinodal objectforce (
bool, optional) – if True, force recalculation of spinodal if already set inplace. Otherwise return already calculated valuesas_dict (
bool, defaultTrue) – if True, return dict of form {phase_id[0] : phases object, …}.unstack (
bool, optional) – if passed, create lnPiCollection objects with this unstack value. If not passed, use unstack parameter from parent objectraise_unconverged (
bool, defaultTrue) – If True, raise error if calculation does not converge.**kwargs – Extra argument to
get_spinodal()function
- Returns:
out (
dictorlnPiCollection, optional) – if inplace, return self. if not inplace, and as dict, return dict, else returnlnpy.lnpiseries.lnPiCollectionwith phase_id in index
- class lnpy.stability.Binodals(collection)[source]#
Bases:
StabilityBaseRoutines to calculate binodal.
Methods:
__call__(phase_ids, build_phases, *[, ...])- __call__(phase_ids, build_phases, *, inplace=True, spinodals=None, ref=None, build_kws=None, force=False, as_dict=True, unstack=None, raise_unconverged=True, **kwargs)[source]#
- Parameters:
phase_ids (
int, or sequence) – Phase ids to calculate binodal for. If int, then find binodal for phases range(phase_ids).build_phases (
callable()) – Factory function to build phasesinplace (
bool, defaultTrue) – if True, add binodal inplace, otherwise return spinodal objectspinodals (optional) – if not passes, then use parent.spinodal Used for bounding binodal
ref (
lnPiMasked, optional)build_kws (
dict, optional) – optional arguments to build_phasesforce (
bool, optional) – if True, force recalculation of spinodal if already set inplace. Otherwise return already calculated valuesas_dict (
bool, defaultTrue) – if True, return dict of form {phase_id[0] : phases object, …}unstack (
bool, optional) – if passed, create lnPiCollection objects with this unstack value. If not passed, use unstack parameter from parent objectraise_unconverged (
bool, defaultTrue) – If True, raise error if calculation does not converge.**kwargs – Extra argument to
get_spinodal()function
- Returns:
out (
object) – if inplace, return self if not inplace, and as dict, return dict, else return lnPiCollection with phase_id in index