thermodynamics

Handle thermodynamic properties.

class thermodynamics.Thermodynamics(params, comps, phase, TK, GfV, logger)[source]

Bases: object

Provide methods to compute thermodynamic properties.

Methods that compute the Gibbs free energy and chemical potentials as a function of atom fraction array (G_funx and MU_funx) assume vacancies are at equilibrium.

Methods that compute the Gibbs free energy and chemical potentials as a function of site fraction array (G_funy and MU_funy) are initialized based on the same assumption, but the class provides a method to update these methods in the case of a non-ideal lattice (set_nonideal_lattice).

Variables:
  • comps (list of str) – System components.

  • TK (float) – Temperature in Kelvin.

  • GfV (dict of list) – Vacancy formation energy in pure metals, given as [enthalpy, entropy] in J/mol and J/mol/K. See data_io.get_vacancy_formation_energy().

  • params (dict of floats) –

    Thermodynamic parameters arranged as follows:

    A: G_A for A in endmembers
    AB: [L0, L1] for AB in binary subsystems

  • ideal_lattice (bool) – Whether lattice is ideal, in the sense that the vacancy fraction is maintained at equilibrium.

G_funx(x) :

Return Gibbs free energy at composition given by atom fraction array.

MU_funx(x) :

Return chemical potentials at composition given by atom fraction array.

yVa_fun(x) :

Return equilibrium vacancy fraction at composition given by atom fraction array.

G_fun(x) :

Alias of G_funx.

MU_fun(x):

Return MU_funx as a dict.

G_funy(y):

Return Gibbs free energy at composition given by site fraction array.

MU_funy(y) :

Return chemical potentials at composition given by site fraction array.

__init__(params, comps, phase, TK, GfV, logger)[source]

Class constructor.

Parameters:
  • params (dict of floats) –

    Thermodynamic parameters arranged as follows:

    A: G_A for A in endmembers
    AB: [L0, L1] for AB in binary subsystems

  • comps (list of str) – System components.

  • phase (str) – Phase name.

  • TK (float) – Temperature in Kelvin.

  • vacancy_databases (dict) – Register of vacancy formation energy databases.

  • vacancy_db (str) – Name of database with vacancy formation energy in pure metals.

  • logger (log_utils.CustomLogger) – Logger.

process_parameters(params)[source]

Add vacancy-related interactions to thermodynamic parameters.

extend_G_funx()[source]

Make function that computes G from site fractions.

Here the vacancy site fraction is at its equilibrium value.

extend_MU_funx()[source]

Make function that computes MU from site fractions.

Here the vacancy site fraction is at its equilibrium value (MU_Va = 0).

set_nonideal_lattice()[source]

Update G_funy and MU_funy functions in cas of non-ideal lattice.

Update functions that compute Gibbs free energy and chemical potentials from site fraction array when lattice is non-ideal (vacancy site fraction not maintained at equilibrium).

MU_fun(x)[source]

Calculate chemical potential of atom components.

Parameters:

x (np.array (shape (n_inds, nz))) – Atom fractions.

Returns:

Chemical potentials, shape (nz) {k: mu_k for k in components}.

Return type:

dict

thermodynamics.make_G_fun(comps, pdict, TK)[source]

Make function to compute Gibbs free energy.

Process parameters and call thermo_functions.G_model().

Parameters:
  • comps (list of str) – System constituents.

  • pdict (dict) – Thermodynamic parameters.

  • TK (float) – Temperature in Kelvin.

Returns:

fun – Function that takes composition array (shape (n_inds, nz)) as argument, and returns Gibbs free energy evaluated on this composition grid (shape (nz,)).

Return type:

function

thermodynamics.make_MU_fun(comps, pdict, TK)[source]

Make function that computes chemical potentials.

Process parameters and call thermo_functions.MU_model(). Use a Redlich-Kister polynomial with binary interactions of order 0 and 1 (see thermo_functions.MU_model()).

Parameters:
  • comps (list of str) – System constituents.

  • pdict (dict of floats) – Thermodynamic parameters.

  • TK (float) – Temperature in Kelvin.

Returns:

fun – Function that takes composition array (shape (n_inds, nz)) as argument, and returns chemical potentials evaluated on this composition grid (shape (n_comps, nz)).

Return type:

function

thermodynamics.make_yVa_fun(comps, pdict, TK)[source]

Make function to compute equilibrium vacancy site fractions.

Process parameters and call thermo_functions.yVa_model().

Parameters:
  • comps (list of str) – System constituents, including Va.

  • pdict (dict) – Thermodynamic parameters.

  • TK (float) – Temperature in Kelvin.

Returns:

fun – Function that takes atom fractions (shape (n_inds, nz)) as argument, and returns the equilibrium vacancy fraction evaluated on this composition array (shape (nz,)).

Return type:

function