pycalphad package¶
Submodules¶
pycalphad.constraints module¶
The constraints module contains definitions for equilibrium constraints and their Jacobian.
-
pycalphad.constraints.mole_fraction(phase, active_comps, species)[source]¶ Return a SymPy object representing the mole fraction as a function of site fractions.
Parameters: - phase (Phase) – Phase object corresponding to the phase of interest.
- active_comps (list of str) – Names of components to consider.
- species (str) – Names of species to consider.
Returns: Return type: SymPy object representing the mole fraction.
Examples
>>> dbf = Database('alfe_sei.TDB') >>> mole_fraction(dbf.phases['FCC_A1'], ['AL', 'FE', 'VA'], 'AL')
pycalphad.log module¶
The log module handles setup for logging errors, debug messages and warnings.
pycalphad.model module¶
The Model module provides support for using a Database to perform calculations under specified conditions.
-
exception
pycalphad.model.DofError[source]¶ Bases:
ExceptionError due to missing degrees of freedom.
-
class
pycalphad.model.Model(dbe, comps, phase, parameters=None)[source]¶ Bases:
objectModels use an abstract representation of the function for calculation of values under specified conditions.
Parameters: - dbf (Database) – Database containing the relevant parameters.
- comps (list) – Names of components to consider in the calculation.
- phase (list) – Name of phase model to build.
- parameters (dict) – Optional dictionary of parameters to be substituted in the model. This will overwrite parameters specified in the database
-
None yet.
Examples
None yet.
-
CPM¶
-
GM¶
-
HM¶
-
MIX_GM¶
-
MIX_HM¶
-
MIX_SM¶
-
SM¶
-
ast¶ Return the full abstract syntax tree of the model.
-
atomic_ordering_energy(dbe, disordered_phase_name, ordered_phase_name)[source]¶ Return the atomic ordering contribution in symbolic form. Description follows Servant and Ansara, Calphad, 2001.
-
build_phase(dbe, phase_name, symbols, param_search)[source]¶ Apply phase’s model hints to build a master SymPy object.
-
energy¶
-
enthalpy¶
-
entropy¶
-
excess_mixing_energy(phase, param_search)[source]¶ Build the binary, ternary and higher order interaction term Here we use Redlich-Kister polynomial basis by default Here we use the Muggianu ternary extension by default Replace y_i -> y_i + (1 - sum(y involved in parameter)) / m, where m is the arity of the interaction parameter
-
heat_capacity¶
-
magnetic_energy(phase, param_search)[source]¶ Return the energy from magnetic ordering in symbolic form. The implemented model is the Inden-Hillert-Jarl formulation. The approach follows from the background section of W. Xiong, 2011.
-
mixing_energy¶
-
mixing_enthalpy¶
-
mixing_entropy¶
-
static
mole_fraction(species_name, phase_name, constituent_array, site_ratios)[source]¶ Return an abstract syntax tree of the mole fraction of the given species as a function of its constituent site fractions.
Note that this will treat vacancies the same as any other component, i.e., this will not give the correct _overall_ composition for sublattices containing vacancies with other components by normalizing by a factor of 1 - y_{VA}. This is because we use this routine in the order-disorder model to calculate the disordered site fractions from the ordered site fractions, so we need _all_ site fractions, including VA, to sum to unity.
-
redlich_kister_sum(phase, param_search, param_query)[source]¶ Construct parameter in Redlich-Kister polynomial basis, using the Muggianu ternary parameter extension.
-
reference_energy(phase, param_search)[source]¶ Returns the weighted average of the endmember energies in symbolic form.
-
variables¶ Return state variables in the model.
pycalphad.residuals module¶
The residuals module contains routines for calculating residuals of experimental data for regression of thermodynamic models.
-
pycalphad.residuals.fit_model(guess, data, dbf, comps, phases, **kwargs)[source]¶ Fit model parameters to input data based on an initial guess for parameters.
Parameters: - guess (dict) – Parameter names to fit with initial guesses.
- data (list of DataFrames) – Input data to fit.
- dbf (Database) – Thermodynamic database containing the relevant parameters.
- comps (list) – Names of components to consider in the calculation.
- phases (list) – Names of phases to consider in the calculation.
Returns: (Dictionary of fit key
Return type: values), (lmfit minimize result)
Examples
None yet.
pycalphad.variables module¶
Classes and constants for representing thermodynamic variables.
-
class
pycalphad.variables.ChemicalPotential[source]¶ Bases:
pycalphad.variables.StateVariableChemical potentials are symbols with built-in assumptions of being real.
-
default_assumptions= {}¶
-
-
class
pycalphad.variables.Composition[source]¶ Bases:
pycalphad.variables.StateVariableCompositions are symbols with built-in assumptions of being real and nonnegative.
-
default_assumptions= {}¶
-
-
pycalphad.variables.MU¶ alias of
ChemicalPotential
-
class
pycalphad.variables.PhaseFraction[source]¶ Bases:
pycalphad.variables.StateVariablePhase fractions are symbols with built-in assumptions of being real and nonnegative. The constructor handles formatting of the name.
-
default_assumptions= {}¶
-
-
class
pycalphad.variables.SiteFraction[source]¶ Bases:
pycalphad.variables.StateVariableSite fractions are symbols with built-in assumptions of being real and nonnegative. The constructor handles formatting of the name.
-
default_assumptions= {}¶
-
-
class
pycalphad.variables.StateVariable[source]¶ Bases:
sympy.core.symbol.SymbolState variables are symbols with built-in assumptions of being real.
-
default_assumptions= {}¶
-
-
pycalphad.variables.X¶ alias of
Composition
-
pycalphad.variables.Y¶ alias of
SiteFraction
-
pycalphad.variables.site_fraction¶ alias of
SiteFraction