bm3_thermal_2 module

exception BM3_error[source]

Bases: Exception

class EosFit[source]

Bases: object

Sets up the T-range interval to be used in the eosfit_dir calculations

info()[source]
reset()[source]
set_t(tmin, tmax, nt)[source]
Parameters:
  • tmin – minimum temperature of the interval (in K)

  • tmax – maximum temperaure of the interval (in K)

  • nt – number of points in the interval

class UploadMineral[source]

Bases: object

Interface to the upload_mineral function to compute a complete set of thermodynamic parameters to be stored in a Perplex-like database.

Several attributes of the class drive the calculation, which can conveniently be set by appropriate method of the class.

compute(**kwargs)[source]

Sets and starts the computation of the thermodynamic parameters. All of the arguments to the method are keyword argument. If they are omitted, default values are chosen.

Parameters:
  • trange – minimum, maximum and number of points for the definition of temperature range for the fits of K0, Cp and alpha

  • phase – name of the mineral, as specified in the internal database

  • alpha_method – if equal to ‘k_alpha_dir’, thermal expansion is computed from the K*alpha product, and K is evaluated from the bulk_modulus_p function, with the chosen noeos option (see below). If alpha_method=’k_alpha_eos’, the bulk_modulus in the K*alpha product is from a V-BM3 EoS function is used (default ‘alpha_alpha_dir’)

  • fix – if True and if alpha_method=’k_alpha_eos’, the K’ is kept fixed at the value refined at T=298.15 K (relevant if alpha_method=k_alpha_eos; default False)

  • reuss – if True, the bulk_modulus_p_serie function is used to compute the bulk modulus as a function of T (with the chosen noeos option); K0, V0 and Kp are from an bulk_dir computation. If False, the function bulk_serie is used. (Default False)

  • noeos – relevant if reuss=True or alpha_method=’k_alpha_dir’ (default True)

  • bdir – the bulk_dir function is used to compute dK/dT (default False)

  • t_bulk – maximum temperature for dK/dT fit (relevant if reuss or bdir are True) if t_bulk=0., t_bulk=tmax (default: 0.)

  • HTlim – Temperature at which the Dulong-Petit limit for Cv is supposed to be reached (default 0.: no Dulong-Petit model)

  • t_max – maximum temperature for the power series fit of Cp(T); if t_max=0. (default), t_max=HTlim. The parameter is relevant oly if HTlim is not zero.

  • model – Used in the HTlimit estimation of Cv; Einstein model for Cv(T) with one frequency (default model=[1,g_deg]), or with 2 frequencies (model=[2, g_deg]). The g_deg parameter is Used in the HTlim estimation of Cp (default 1)

  • volc – if True, V0 is set at the value found in the database (default: False)

  • export – if True, the computed data are exported in the database file with the appropriate formatting the the usage in the Perplex program (default False)

  • norestore – if True, the excluded modes are not restored for the calculation of entropy and Cp (default False)

Notes

To set tmin, tmax, points, use the method set_t_range whose argument must be a list [tmin, tmax, points], or the t_range

To set the model for the HT extrapolation of the specific heat, use the method set_HTlim whose argument is the list [model, g_deg]

The different parameters can be set by the appropriate ‘set’ methods implemented for the class. The setting by those methods (before ‘compute’ is invoked) will change the default values and will be permanent within the whole working session. If, otherwise, such parameters are chosen as arguments of the compute method, their original values are recovered immediately at the end of the method.

Examples

>>> upl.set_t_bulk(700.)
>>> upl.compute(phase='py')
>>> upl.compute(t_bulk=700., phase='py')
info()[source]
quality_of_fit(tmax, pmax, mqm, tmin=300.0, pmin=0.0, npp=10, nt=10, n_line=10)[source]

Compares unit cell volumes and Gibbs free energies, as functions of temperature and pressure, that are directly computed within the program, with those derived from the Perplex-Like algorithms from the parameters obtained by the ‘compute’ method, and stored in the internal database for the specified phase.

Parameters:
  • tmin, tmax, nt – define the temperature range (K)

  • pmin, pmax, np – defini the pressure range (GPa)

Notes

Do not use volc=True in the upl.compute method (for the purpose of making the check of the quality of fit)

The Delta values are to be intendend as the difference between the direct computation and the Perplex-like one

Example

>>> upl.compute(phase='jeff')
>>> upl.quality_of_fit(1000., 10., 'jeff')
reset()[source]
set_HTlim(HT_lim)[source]
set_alpha_method(adir)[source]
set_bulk_direct(bdir)[source]
set_export(exp)[source]
set_fix(fix)[source]
set_model(model)[source]
set_noeos(noeos)[source]
set_norestore(norest)[source]
set_parameters(**kwargs)[source]

Set parameters for the compute method by using a single set method. Each parameter is specified by a keyword according to the following list

Parameters:
  • trange – minimum, maximum and number of points for the definition of temperature range for the fits of K0, Cp and alpha

  • phase – name of the mineral, as specified in the internal database

  • alpha_method – if equal to ‘k_alpha_dir’, thermal expansion is computed from the K*alpha product, and K is evaluated from the bulk_modulus_p function, with the chosen noeos option (see below). If alpha_method=’k_alpha_eos’, the bulk_modulus in the K*alpha product is from a V-BM3 EoS function is used (default ‘alpha_alpha_dir’)

  • fix – if True and if alpha_method=’k_alpha_eos’, the K’ is kept fixed at the value refined at T=298.15 K (relevant if alpha_method=k_alpha_eos; default False)

  • reuss – if True, the bulk_modulus_p_serie function is used to compute the bulk modulus as a function of T (with the chosen noeos option); K0, V0 and Kp are from an bulk_dir computation. If False, the function bulk_serie is used. (Default False)

  • noeos – relevant if reuss=True or alpha_method=’k_alpha_dir’ (default True)

  • bdir – the bulk_dir function is used to compute dK/dT (default False)

  • t_bulk – maximum temperature for dK/dT fit (relevant if reuss or bdir are True) if t_bulk=0., t_bulk=tmax (default: 0.)

  • HTlim – Temperature at which the Dulong-Petit limit for Cv is supposed to be reached (default 0.: no Dulong-Petit model)

  • t_max – maximum temperature for the power series fit of Cp(T); if t_max=0. (default), t_max=HTlim. The parameter is relevant oly if HTlim is not zero.

  • model – Used in the HTlimit estimation of Cv; Einstein model for Cv(T) with one frequency (default model=[1,g_deg]), or with 2 frequencies (model=[2, g_deg]). The g_deg parameter is Used in the HTlim estimation of Cp (default 1)

  • volc – if True, V0 is set at the value found in the database (default: False)

  • export – if True, the computed data are exported in the database file with the appropriate formatting the the usage in the Perplex program (default False)

  • norestore – if True, excluded modes are not restored for the calculation of entropy and Cp (default False)

set_phase(mqm)[source]
set_reuss(reuss)[source]
set_t_bulk(t_k)[source]
set_t_cp(t_max)[source]
set_t_range(trange)[source]
set_volc(volc)[source]
upload_mineral()[source]
class acoustic_approx_class[source]

Bases: object

Class used for the estimation of the contribution to the vibrational pressure from acoustic modes, in case supercell data are not available.

Use the method ‘on’ to switch on the correction (‘off’ to switch it off)

The algorithm is used to compute such contribution if the total pressure at given temperature and volume is evaluated by the pressure_dir function

Example

>>> ac_approx.on()
>>> bulk_dir(298)
off()[source]
on()[source]
set(tmin=20.0, tmax=1000.0, deg=3, nt=12, nbin=4, on=True)[source]

Sets parameters for the estimation of the vibrational pressure of low frequency modes, as a function of temperature

Parameters:
  • tmin, tmax, nt – minimum, maximum and number of points defining the temperature range for the estimation of the vibrational pressure as a function of T

  • deg – degree of the polynomial fitting the P(T) values

  • nbin – number of bins for the construction of the frequency histogram

  • on – if True, the P(T) polynomial is computed after the set method was invoked, and the acoustic correction is switched on; if ‘on’ is False, the requested parameters are changed but the correction is not switched on, or recomputed.

acoustic_func()[source]

Estimates the vibrational pressure for acoustic modes, as a function of temperature, in case frequencies data from supercell calculations are not available.

Note

all the required computational parameters are set, used and controlled by the ac_approx methods of the acoustic_approx_class.

alpha_dir(tt, pp)[source]

Calculation of the thermal expansion at a given temperature and pressure. The computation is done by following the definition of alpha, as alpha=1/V (dV/dT)_P.

Parameters:
  • tt – temperature (K)

  • pp – pressure (GPa)

Note

The calculation of the volume at a ginen temperature is done by the volume_dir function

alpha_dir_from_dpdt(tt, pp, prt=False)[source]

Computes thermal expansion, at any temperature and pressure, from the K*alpha product, by using ‘dir’ functions only (no equation of state involved at any step). In particular, the required (dP/dT)_V derivative is calculated from pressures obtained by the pressure_dir function; the volume and the bulk modulus at T, P is obtained by means of the bulk_modulus_p function (with noeos=True)

Parameters:
  • tt – temperature (K)

  • pp – pressure (GPa)

  • prt – is True, alpha, K and V are printed; otherwise unformatted values are returned (default False)

alpha_dir_from_dpdt_serie(tmin, tmax, nt=12, pp=0, fit=False, phase='', save=False, title=True, tex=False)[source]

Thermal expansion in a T-range. The function makes use of the alpha_dir_from_dpdt function.

Parameters:
  • tmin, tmax – minimum and maximum temperature (in K)

  • nt – number of points in the T-range (default 12)

  • pp – pressure (GPa)

  • fit – if True, a power series fit is performed

  • phase – if not equal to ‘’, and fit is True, the coefficients of the power series fit are uploaded in the internal database (default ‘’)

  • save – if True, a figure is saved in a file (default False)

  • tex – if True, latex format is used for the figure (default False)

  • title – if False, the title printing is suppressed (default True)

Note

If a phase is specified and fit is True, use the export function to upload the parameters of the power series in the database file

Example

>>> alpha_dir_from_dpdt_serie(100, 500, fit=True, phase='py')
>>> export('py')
alpha_dir_fun(tt, *coef)[source]

Outputs the thermal expansion at a given temperature, from the fit obtained with the alpha_dir_serie function

alpha_dir_serie(tmin, tmax, nt, pp, fit=True, prt=True)[source]

Thermal expansion in a given range of temperatures. The computation is done by using the alpha_dir function that, in turn, makes use of the volume_dir function (EoS-free computation of the volume at a given pressure and temperature).

Parameters:
  • tmin, tmax, nt – minimum, maximum temperatures (K) and number of points in the T-range

  • pp – pressure (GPa)

  • fit – if True, a power serie fit of the alpha values is performed (see ALPHA keyword in the input file)

  • prt – if True, a detailed output is printed.

alpha_dir_v(tmin, tmax, nt=12, type='spline', deg=4, smooth=0.001, comp=False, fit=False, trim=0.0, phase='')[source]

Computes thermal expansion from the derivative of a V(T) function calculated on a generally large T range.

Parameters:
  • tmin – minimum temperature

  • tmax – maximum temperature

  • nt – number of T points in the range (default 12)

  • type – if ‘spline’ (default), a spline fit of the V(T) values is performed; otherwise a polynomial fit is chosen.

  • deg – degree of the spline (or polynomial) fit of the V(T) values (default 4)

  • smooth – smoothness parameter of the spline fit (default 0.001); relevant if type=’spline’

  • comp – if True, the thermal expansions from other methods are also computed and plotted (default False)

  • fit – if True, a power serie fit is performed and parameters are returned

  • trim – if trim > 0. and if fit=True, the power serie fit is done over the [tmin, tmax-trim] T-range, to avoid possible fitting problems at the end of the high temperature interval

  • phase – if not empty and if fit=True, uploads the coefficients of the power serie fit for the selected phase (default ‘’)

Note

The spline fit is performed on the Log(V) values; the derivative of the spline fit does coincide with the definition of thermal expansion

Note

the volume at each temperature is computed by using the volume_dir function

Note

Without selecting phase, to upload the parameters from the power serie fit, execute the alpha_dir_v function by saving the output in a variable; then use the load_alpha method of the mineral class to upload the variable.

alpha_fun(tt, *coef)[source]

Outputs the thermal expansion at a given temperature, from the fit obtained with the alpha_serie function

alpha_serie(tini, tfin, npoint, pp, plot=False, prt=True, fit=True, HTlim=0.0, g_fit=True, degree=1, save='', g_deg=1, tex=False, title=True, dir=False, **kwargs)[source]

Thermal expansion in a temperature range, at a given pressure (pp), and (optional) fit with a polynomium whose powers are specified in the input.txt file

Parameters:
  • tini, tfin, npoint – parameters defining the T-range of the calculation (K)

  • pp – pressure (GPa)

  • prt – if True, a list of alpha values in the T-range is printed

  • fit – a fit of the alpha values as function of T is performed according to the power serie specified in the input.txt file

  • HTlim – if higher than 0., an extrapolation of alpha to the high temperature limit (HTlim) is performed.

  • degree – if HTlim > 0.,this is the degree of the polynomial fitting the gamma/VK values as a function of T (default 1), where gamma in the ratio Cp/Cv.

  • g_deg – if HTlim > 0., this is the degree of the polynomial (default 1) fitting the gamma values (Cp/Cv) as function of T

  • g_fit – if False, the Cp/Cv fit (gamma fit) is not performed if it was already perfomed in a previous computation; g_fit=True forces the fit to be recomputed (default True)

  • dir – if True, all direct functions are used in the different steps of the calculation (default False)

  • plot – used for debug purpose if plot=True and dir=False (see the documentation of the thermal_exp_v function)

  • save, tex, title – have to do with the saving of a figure of the function alpha(T)

Note

if dir is False, the computation is perfomed by using the thermal_exp_v function that is based on the evaluation of K*alpha product by using, in turn, the bmx_tem function (for details, see the documentation of the thermal_exp_v function). If dir is True, the bulk_dir function is used, together with the direct.dpdt function to get the (dP/dT)_v values. This is recommended when phonon dispersion contributions are included (as their are not taken into account by the bmx_tem function)

class anh_class[source]

Bases: object

off()[source]
on()[source]
anharm_pressure(mode, tmin, tmax, nt, deg=2, dv=2, fit=True, fit_deg=4, prt=True)[source]

Pressure (GPa) of an anharmonic mode in a given T range

Parameters:
  • mode – mode number (a number in the list [0,…, anharm.nmode])

  • tmin – minimum temperature

  • tmax – maximum temperature

  • nt – number of points in the T interval

  • deg, dv – see doc for anharm_pressure_vt

  • fit – polynomial fit of the P(T) values

  • fit_deg – degree of the fitting polynomial

  • prt – if True, prints a list of T, V, P values

anharm_pressure_vt(mode, vv, tt, deg=2, dv=2, prt=True)[source]

Pressure (GPa) of a single anharmonic mode at a given cell volume and temperature from the derivative -(dF/dV)_T

Parameters:
  • mode – mode number (a number in the list [0,…, anharm.nmode])

  • vv – volume (A^3)

  • tt – temperature (K)

  • deg – degree of the polynomial fitting the F(V) function (default: 2)

  • dv – V range (A^3) for the calculation of the F(V) function (default: 2)

  • prt – print formatted result (default: True)

anharm_setup()[source]
bm3(vv, v0, k0, kp)[source]

Birch-Murnaghan equation (3^rd order)

Parameters:
  • vv – volume

  • v0 – volume at the minimum of the energy

  • k0 – bulk modulus

  • kp – derivative of k0 with respect to P

Returns:

the pressure at the volume vv

class bm4_class[source]

Bases: object

Set up and information for a 4^ order Birch-Murnaghan EoS (BM4)

It provides:
  1. energy: function; Volume integrated BM4 (V-BM4)

  2. pressure: function; BM4

  3. bm4_static_eos: BM4 parameters for the static energy calculation as a function of V

  4. en_ini: initial values for the BM4 fit

  5. bm4_store: BM4 parameters from a fitting at a given temperature

methods:

estimates(v4, e4)[source]

Estimates initial values of BM4 parameters for the fit

off()[source]

Switches off the BM4 calculation

on()[source]

Switches on the BM4 calculation

status()[source]

Informs on the status of BM4 (on, or off)

store(bm4st)[source]

Stores BM4 parameters from a fit a given temperature

upgrade()[source]

Uses the stored values of parameters [from the application of store()] to upgrade the initial estimation done with estimates()

upload(bm4_eos)[source]

Loads the parameters from the static calculation (that are then stored in bm4_static_eos)

bm4_def()[source]
bm4_dir(tt, prt=True)[source]

Optimizes a BM4 EoS from volumes and total pressures at a given temperature. Negative pressures are excluded from the computation.

Parameters:
  • tt – temperature

  • prt (optional) – if True, prints a P(V) list; default: False

bmx_tem(tt, **kwargs)[source]

V-BMx (volume integrated) fit at the selected temperature

Parameters:

tt – temperature

Keyword Arguments:

fix – if fix > 0.1, kp is fixed to the value ‘fix’ during the optimization of the EoS. (this is a valid option only for the BM3 fit, but it is ignored for a BM4 EoS)

Returns:

  1. free energy values at the volumes used for the fit

  2. optimized v0, k0, kp, (kpp), and c

  3. covariance matrix

Note

bmx_tem optimizes the EoS according to several possible options specified elsewhere:

  1. kp fixed or free

  2. frequencies not fitted, or fitted by polynomials or splines

  3. 3^rd or 4^th order BM EoS

Note

bmx_tem includes energy contributions from static and vibrational optical modes; acoustic contributions from the modified Kieffer model are included, provided the KIEFFER keyword is in the input file; contributions from anharmonic modes are included, provided the ANH keyword is in the input file. NO dispersion correction is included (even is the DISP keyword is provided).

bulk_conversion(kk)[source]

Bulk modulus unit conversion (from atomic units to GPa)

bulk_dir(tt, prt=False, out=False, pmax=0.0, npmax=12, **kwargs)[source]

Optimizes a BM3 EoS from volumes and total pressures at a given temperature. In turn, phonon pressures are directly computed as volume derivatives of the Helmholtz function; static pressures are from a V-BM3 fit of E(V) static data.

Negative pressures are excluded from the computation.

Parameters:
  • tt – temperature

  • prt (optional) – if True, prints a P(V) list; default: False

  • pmax (optional) – if greater than 0., sets the maximum pressure for the EoS fit.

  • npmax – if pmax is greater than 0., sets the number of P/V points for the EoS fit (default 12)

Keyword Arguments:

fix – Kp fixed, if fix=Kp > 0.1

bulk_dir_serie(tini, tfin, npoints, degree=2, update=False, **kwargs)[source]

Computes the bulk modulus K0 in a given temperature range, by using the bulk_dir function (BM3 fit on a PV data set, at each T).

Parameters:
  • tini, tfin, npoints – minimum, maximum and number of points defining the T range

  • degree – degree of the K0(T) fitting polynomial

  • update – if True, the coefficients of the K0(T) fitting polynomial are returned (default False)

Note

It is advised to fix the Kp value at the different temperatures to get the K0 values following reasonable trends. In order to do that, use the optional keyword ‘fix’ explicitly, followed by the Kp value, and note that the set_fix function does NOT work in this case.

Example

>>> bulk_dir_serie(300, 800, 12, degree=1, fix=4.5)
bulk_modulus_adiabat(tt, pp, noeos=False, prt=True, **kwargs)[source]

Adiabatic bulk modulus at a temperature and pressure

Parameters:
  • tt – temperature

  • pp – pressure

  • fix (optional) – optimizes Kp if fix=0., or keeps Kp fixed if fix=Kp > 0.1

The values are computed through the direct derivative -V(dP/dV)_T. Since the computation of pressure requires the bm3_tem function, Kp can be kept fixed by setting fix=Kp > 0.1

bulk_modulus_p(tt, pp, noeos=False, prt=False, **kwargs)[source]

Bulk modulus at a temperature and pressure

Parameters:
  • tt – temperature

  • pp – pressure

  • noeos – to compute pressures, the bm3 EoS is used if noeos=False (default); otherwise the EoS is used only for the static part, and vibrational pressures are obtained from the derivative of the F function (pressure_dir function)

  • prt – if True, results are printed

  • fix (optional) – optimizes Kp if fix=0., or keeps Kp fixed if fix=Kp > 0.1. This is relevant if noeos=False

The values are computed through the direct derivative -V(dP/dV)_T. Since the computation of pressure requires the bm3_tem function (if noeos=False) Kp can be kept fixed by setting fix=Kp > 0.1

bulk_modulus_p_serie(tini, tfin, nt, pres, noeos=False, fit=False, type='poly', deg=2, smooth=5, out=False, **kwargs)[source]

Computes the bulk modulus from the definition K=-V(dP/dV)_T in a range of temperature values

Parameters:
  • tini – lower temperature in the range

  • tfin – higher temperature in the range

  • nt – number of points in the [tini, tfin] range

  • pres – pressure (GPa)

  • noeos – see note below

  • fit – if True, a fit of the computed K(T) values is performed

  • type – type of the fit (‘poly’, or ‘spline’)

  • deg – degree of the fit

  • smooth – smooth parameter for the fit; relevant if type=’spline’

  • out – if True, the parameters of the K(T) and V(T) fits are printed

Keyword Arguments:

fix – if fix is provided, Kp is kept fixed at the fix value Relevant if noeos=False

Note

if noeos=False, the pressure at any given volume is calculated from the equation of state. If noeos=True, the pressure is computed as the first derivative of the Helmholtz function (at constant temperature)

bulk_serie(tini, tfin, npoint, fit=True, degree=2, update=False, save='', tex=False, title=True, xlim=-1, **kwargs)[source]

Computes the bulk modulus K0 as a function of temperature in a given T range

Parameters:
  • tini – minimum temperature

  • tfin – maximum temperature

  • npoint – number of points in the T range

  • fix (optional) – keeps Kp constant in the calculation of K0 if fix=Kp > 0.1. If fix=0. Kp is optimized at every different temperature.

  • fit (optional) – makes a polynomial fit of the K0(T) values

  • degree (optional) – degree of polynomial for the fitting

  • save (optional, string) – file name of the saved plot

  • dpi (optional, integer) – dpi resolution of the saved image

Note

the fix argument overrides the value of Kp possibly set by the set_fix function

check_poly(ifr, save=False, title=True, tex=False)[source]

Plot of the frequency as a function of volume

Parameters:
  • ifr – mode number

  • save – if True, the plot is saved in a file

  • dpi – resolution of the plot

  • ext – graphics file format

  • title – if True, a title is written above the plot

  • tex – if True, LaTeX fonts are used in the labels

check_poly_list(list_of_modes)[source]

Plots the frequencies of a given list of normal modes

Parameters:

list_of_modes (a list of integers)

Example

>>> check_poly_list([0, 1, 2])
check_poly_total()[source]

Plots the frequencies of all the modes as a function of volumes along with their fitting according to the polynomial degree chosen.

The fitting is restricted to the volume range set by the set_volume_range function.

check_spline(ifr, save=False, title=True, tex=False)[source]

Plot of the frequency as a function of volume

Parameters:
  • ifr – mode number

  • save – if True, the plot is saved in a file

  • dpi – resolution of the plot

  • ext – graphics file format

  • title – if True, a title is written above the plot

  • tex – if True, LaTeX fonts are used in the labels

check_spline_list(list_of_modes)[source]

Plots the frequencies of a given list of normal modes as functions of volumes, along with their fitting according to the spline parameters chosen.

Args: list_of_modes (a list of integers)

Example

>>> check_spline_list([0, 1, 2])
check_spline_total()[source]

Plots the frequencies of all the modes as a function of volumes along with their fitting according to the spline parameters chosen.

The fitting is restricted to the volume range set by the set_volume_range function.

compare_exp(graph_exp=True, unit='j', save='', dpi=300, **kwargs)[source]

Compare experimental with computed data for Cp and S; makes a plot of the data

Parameters:
  • graph_exp – if True, a plot of Cp vs T is produced

  • unit – unit of measure of experimental data; allowed values are ‘j’ or ‘cal’ (default ‘j’)

  • save – file name to save the plot (no file written by default)

  • dpi – resolution of the image (if ‘save’ is given)

cp(tt, pp, plot=False, prt=False, dul=False, **kwargs)[source]

Specific heat at constant pressure (Cp) and entropy (S)

Parameters:
  • tt – temperature

  • pp – pressure

  • fix (optional) – optimizes Kp if fix=0, or keeps Kp fixed if fix=Kp > 0

  • plot (optional) – checks against numerical issues (experts only)

  • prt (optional) – prints formatted results

Note

Cp = Cv + V*T*K*alpha^2

Cp, Cv (J/mol K), Cp/Cv, alpha (K^-1), K=K0+K’P (GPa)

cp_dir(tt, pp, prt=False)[source]

Computes the specific heat at constant pressure by using ‘dir’ functions. In particular, at T and P, the equilibrium volume, the entropy, the specific heat at constant volume and the thermal expansion are calculated by respectively using the volume_dir, the entropy_dir_v and the alpha_dir_from_dpdt functions; bulk modulus is evaluated by means of the bulk_modulus_p function with the option noeos set to True (the volume and bulk modulus values are from the alpha_dir_from_dpdt function output, too).

Parameters:
  • tt – temperature (K)

  • pp – pressure (GPa)

  • prt – if True a detailed output is printed

cp_dir_serie(tmin, tmax, nt, pp=0)[source]
cp_fun(tt, *coef)[source]

Computes the specific heat a constant pressure, at a given temperature from the fit Cp(T) performed with the cp_serie function

cp_serie(tini, tfin, points, pp, HTlim=0.0, model=1, g_deg=1, plot=False, prt=False, dr=False, fit=True, t_max=0.0, graph=True, save='', tex=False, title=True, **kwargs)[source]

Outputs a list of Cp values (J/mol K) in a given temperature range, at a fixed pressure

Parameters:
  • tini – minimum temperature (K)

  • tfin – maximum temperature

  • points – number of points in the T range

  • pp – pressure (GPa)

  • HTlim – if HTlim > 0, the Dulong-Petit limit (DP) for Cp is imposed at a high T value (HTlim); the procedure is performed by computing Cv in the [tini, tfin] T range and by fitting the Cv curve by the Einstein’s model after the DP limit is added for T=HTlim; The gamma value (Cp/Cv) at T > tfin is linerarly extrapolated from the gamma(T) fit obtained in the [tini,tfin] range. For T > tfin (and up to HTlim) Cp is computed as the product of Cv (from the Einstein’s model) and the extrapolated gamma.

  • t_max – maximum temperature at which the power series Cp(T) fit is done. If t_max=0. (default), tmax=HTlim. The parameter is relevant only if HTlim is not zero.

  • fix (optional) – keeps Kp fixed at the value Kp=fix if fix > 0.1

  • prt (optional) – print a table of Cp(T) values if prt=True (default)

  • fit (optional) – fits the Cp(T) values with a polynomial function whose powers must be specified in the input.txt file

  • graph (optional) – makes a plot of the Cp(T) serie and its fit if graph=True (default)

  • save (optional, string) – saves the plot image in the file name specified

  • dpi (optional) – dpi resolution of the saved image

Note

to output the coefficients of the fit, prt must be set to False

The optional argument plot (default: False) is for checking possible numerical issues

It is advised to keep Kp fixed during the computation

cv_fit_func(tt, par3)[source]
cv_fit_func_high(tt, debye_t)[source]
cv_k_plot(tini, tfin, npoints)[source]
cv_kief(tt)[source]
d_integrand(y)[source]
dalpha_dt(tt, pp, **kwargs)[source]

Outputs the derivative of alpha with respect to T at constant pressure. It is used by dCp_dP

class data_info[source]

Bases: object

Stores information about the current settings

show()[source]

Prints information about the current settings stored in the classes

dcp_dp(tt, pp, **kwargs)[source]

Derivative of Cp with respect to P (at T constant)

Parameters:
  • tt – temperature

  • pp – pressure

  • fix (optional) – fixed Kp value; if fix=0., Kp is optimized

Notes

The derivative is evaluated from the relation (dCp/dP)_T = -VT[alpha^2 + (d alpha/dT)_P] It is strongly advised to keep Kp fixed (Kp=fix)

debye(tmin=5.0, tmax=300.0, nt=24, d_min=50.0, d_max=1500.0, nd=48)[source]

Debye temperature estimation

Parameters:
  • tmin – lower limit of the temperature range

  • tmax – higher limit of the temperature range

  • nt – number of point is the T range

  • d_min, d_max, nd – define the range where the Debye temperature is to be searched

debye_limit(tmin=0.1, tmax=50, nt=24)[source]

Debye temperature estimation at the low temperature limit

Parameters:
  • tmin – lower limit of the temperature range

  • tmax – higher limit of the temperature range

  • nt – number of point is the T range

delta_T_func(rv, d_t)[source]
delta_T_parameter(tmax, npoint=8, tref=298.15, out=False)[source]

Anderson-Gruneisen parameter delta_T

K_T(T) = K_T(T0)*(V0/V(T))^delta_T

class delta_class[source]

Bases: object

Control parameters for the numerical evaluation of the first and second derivatives of the Helmholtz free energy as a function of T. They are relevant for the entropy_v function that computes both the entropy and specific heat at a fixed volume, as well as the computation of thermal expansion.

Initial values of delta, degree and number of points are read from the parameters file ‘parame.py’

New values can be set by the methods set_delta, set_degree and set_nump of the class. values can be retrieved by the corresponding ‘get’ methods.

The reset method set the default values.

An adaptive scheme is activated by the method adaptive_on (adaptive_off deactivates the scheme). In this case the delta value is computed as a function of temperature (T). Precisely:

delta=delta_min+(T-t_min)*(delta_max-delta_min)/(t_max-t_min)

delta=delta_min if T < t_min delta=delta_max if T > t_max

The paramaters t_min, t_max, delta_min and delta_max can be set by the adaptive_set method (default values 50, 1000, 10, 50, respectively)

adaptive_off()[source]
adaptive_on()[source]
adaptive_set(tmin=50.0, tmax=1000.0, dmin=10.0, dmax=50.0)[source]
get_degree()[source]
get_delta(tt=300)[source]
get_nump()[source]
reset()[source]
set_degree(degree)[source]
set_delta(delta)[source]
set_nump(nump)[source]
class direct_class[source]

Bases: object

Computes thermodynamic quantities directly as derivative of the Helmholtz function. The computed quantities are: volume, pressure, entropy, Cv and Cp.

cp(tt, pp=0)[source]

Uses the function cp_dir to compute the specific heat at constant pressure, at a given temperature and pressure

Parameters:
  • tt – temperature (K)

  • pp – pressure (GPa; default 0)

cp_serie(tmin, tmax, nt=0, pp=0, fit='default', save='default', tex='default', title='default', name='default', phase='default')[source]

Makes a plot and (optionally) a fit of the specific heat at constant pressure in a given temperature range and at a given pressure

Parameters:
  • tmin – minimum temperature in the range (K)

  • tmax – maximum temperature in the range (K)

  • pp – pressure (GPa, default 0)

Note

See the documentation for the set_param method for the meaning of all the other parameters

cv(tt, pp=0)[source]

Computes the specific heat at constant volume at a given temperature and pressure

Parameters:
  • tt – temperature (in K)

  • pp – pressure (in GPa, default 0)

Note

The function computes the volume at the assigned temperature and pressure (through the volume_dir function) and then computes the specific heat at constant volume

dpdt(tt, vv, prt=False)[source]

Computes the derivative dP/dT at a given temperature and volume

Parameters:
  • tt – temperature (in K)

  • vv – volume (in A^3)

dpdt_p(tt, pp)[source]

Computes the derivative dP/dT at a given temperature and pressure :Parameters: * tt – temperature (in K)

  • pp – pressure (in GPa)

entropy(tt, pp=0, prt=False)[source]

Computes the entropy at a given temperature an pressure

Parameters:
  • tt – temperature (in K)

  • pp – pressure (in GPa; default 0)

integral_dpdt(tref, tfin, vol)[source]

Computes the integral of dP/dT in a given T-range and at a given volume

Parameters:
  • tref – reference temperature (minimum T; in K)

  • tfin – final temperature (in K)

  • vol – volume (in A^3)

pressure(tt, vv)[source]

Returns the pressure (GPa) at a given temperature and volume

Parameters:
  • tt – temperature (in K)

  • vv – volume (in A^3)

set(nt=12, fit=False, save=False, tex=False, title=True, phase='')[source]

Sets relevant parameters for the class

Parameters:
  • nt – number of temperature points at which specific heath is computed (default 12; relevant for cp_serie)

  • fit – if True, a fit of the Cp vs T is done (default False; relevant for cp_serie)

  • save – if True, the plot of Cp vs. T is saved on a file (default False; relevant for cp_serie)

  • tex – if True, Latex font will be used (default False; relevant for cp_serie)

  • title – if True, a plot title will given to the Cp(T) plot (default True; relevant for cp_serie)

  • phase – if not an empty string, the parameters from the Cp(T) fit will be assigned to the phase and load in the relevant item of the internal database (default ‘’; relevant for cp_serie)

volume(tt, pp=0)[source]

Returns the volume (A^3) at a given temperature and pressure

Parameters:
  • tt – temperature (in K)

  • pp – pressure (GPa); (default 0)

class disp_class[source]

Bases: object

Sets up the computation for the inclusion of phonon dispersion effects the EoS computation or for the calculation of all the thermodynamic properties.

The class is relevant and activated if the DISP keyword is contained in the input.txt input file.

Dispersion effects can be switched on or off by using the on() and off() methods.

Note

To apply the phonon dispersion correction to computation of an equation of state, the method eos_on() must be invoked [the method eos_off() switches it off]. In this case, more than one volume must be present in the input file for dispersion.

Note

If phonon frequencies are computed for several values of the unit cell volume, in order to apply a VT-phonon dispersion correction to thermodynamic properties, the method thermo_vt_on() must be invoked [the method thermo_vt_off() switches it off]. On the contrary, a T-phonon dispersion correction is applied (it is assumed that phonon frequencies do not change with volume).

Note

The method free_fit_vt() must be used to get the F(V,T) function for off-center phonon modes.

check(ifr)[source]

Check of the frequencies fit quality for a specified mode

Parameters:

ifr – sequence number of the mode to be checked

check_all()[source]

Check of the frequencies fit quality for all the off-center modes

check_multi(fr_l)[source]

Check of the frequencies fit quality for a list of modes

Parameters:

fr_l – list of sequence numbers of the various modes to be checked

Example

>>> disp.check_multi([0, 1, 2, 3])
>>> disp.check_multi(np.arange(10))
eos_off()[source]
eos_on()[source]
free(temp, vv)[source]
free_exclude(ex_list)[source]

Excludes the indicated off-center modes from the computation of the free energy

Parameters:

ex_list – list of modes to be excluded

Note

Even a single excluded mode must be specified as a list; for instance disp.free_exclude([0])

Note

after the exclusion of some modes, the F(V,T) function has to be recomputed by the free_fit_vt method

free_exclude_restore()[source]

The excluded modes are restored

free_fit(mxt, vv, disp=True)[source]
free_fit_ctrl(min_t=10.0, t_only_deg=6, degree_v=4, degree_t=4, nt=24, fit=True, disp=True)[source]

Free fit driver: sets the relevant parameters for the fit computation of the F(V,T) function, on the values of F calculated on a grid of V and T points.

Parameters:
  • min_t – minimum temperature for the construction of the VT grid (default=10.)

  • degree_v – maximum degree of V terms of the surface (default=4)

  • degree_t – maximum degree ot T terms of the surface (default=4)

  • t_only_degree – degree of the T polynomial for a single volume phonon dispersion (default=4)

  • nt – number of points along the T axis for the definition of the (default=24) grid

  • disp – it True, a plot of the surface is shown (default=True)

Note

By default the method does execute the fit, unless fit=False; in the latter case, it just defines the most important parameters for the fit (which is done by the free_fit_vt() method).

Note

the volumes used for the construction of the VT grid are those provided in the appropriate input file. They are available in the disp.vol variable.

free_fit_vt()[source]
free_func(temp)[source]
free_vt(temp, volume)[source]
free_vt_func(data, *par)[source]
freq_fit()[source]

It requests and makes polynomial fits of the frequencies of the off center modes as function of volumes.

The relevant parameter for the fit (degree) is specified in the appropriate input file.

freq_func(ifr, vv)[source]
freq_spline_fit()[source]

It requests and makes spline fits of the frequencies of the off center modes as function of volumes.

Relevant parameters for the fit (degree and smooth parameters) are specified in the appropriate input file.

freq_spline_func(ifr, vv)[source]
off()[source]
on()[source]
pressure(temp, p_total)[source]
select(mfreq, fit=False)[source]

Selects off-center modes whose frequencies are below a given threshold. It may be useful in order to exclude, from the calculation of the F(V,T) surface, those modes which could be affected by intrinsic anharmonicity.

Parameters:
  • mfreq – frequency threshold

  • fit – if True, the selected modes are added to the excluded list, and a fit of the F(V,T) surface is computed.

Examples

>>> disp.free_exclude(disp.select(100.))
>>> disp.free_fit_vt()
>>> disp.select(100., fit=True)

Note

The elimination of some modes in the computation of the F(V,T) surface is not, in principle, a correct procedure to follow, no matter about the reason behind their exclusion. In this view, the select function here defined should be used to just estimate the impact of those ‘troublesome’ modes, and not a way to produce stable and reliable results.

set_nt(nt)[source]
set_tmin(tmin)[source]
thermo_vt_off()[source]
thermo_vt_on()[source]
einstein_2_fun(tt, eps1, eps2)[source]
einstein_fun(tt, eps)[source]
einstein_t(tini, tfin, npoint, HT_lim=3000, dul=False, model=1)[source]

Computes the Einstein temperature

Parameters:
  • tini – minimum temperature (K) of the fitting interval

  • tfin – maximum temperature

  • npoint – number of points in the T range

  • HT_lim – high temperature limit where Cv approaches the Dulong-Petit value

  • model – if model=1 a single Einstein oscillator is considered (default), if model > 1, 2 Einstein oscillators are considered

entropy_dir_v(tt, vv, prt=False)[source]

Computation of the entropy at a given volume by means of the free_fit_vt function. The method is EoS free and automatically includes contributions from optic modes, off-center modes and anharmonic modes.

Parameters:
  • tt – temperature (K)

  • vv – cell volume (A^3)

  • prt – detailed output

Note

In case phonon dispersion is included, the disp.thermo_vt mode must be activated. The function checks and, in case, activates such mode.

entropy_p(tt, pp, plot=False, prt=True, dir=False, **kwargs)[source]

Entropy and specific heat at constant volume at selected temperature and pressure

Parameters:
  • tt – temperature

  • pp – pressure

  • plot (optional) – (default False) plots free energy vs T for checking possible numerical instabilities

  • prt (optional) – (default True) prints formatted output

Keyword Arguments:

fix – if fix is provided, it controls (and overrides the setting possibly chosen by set_fix) the optimization of kp in BM3; if fix > 0.1, kp = fix and it is not optimized.

Returns:

if prt=False outputs the entropy (J/mol K); if prt=True (default), a formatted output is printed and the function returns None

entropy_v(tt, vv, plot=False, prt=False, **kwargs)[source]

Entropy and specific heat at constant volume

Parameters:
  • tt – temperature

  • vv – volume

  • plot (optional) – (default False) plots free energy vs T for checking possible numerical instabilities

  • prt (optional) – (default False) prints formatted output

Keyword Arguments:

fix – if fix is provided, it controls (and overrides the setting possibly chosen by set_fix) the optimization of kp in BM3; if fix > 0.1, kp = fix and it is not optimized.

Returns:

if prt=False (default) outputs the entropy and the specific heat at constant volume (unit: J/mol K). if prt=True, a formatted output is printed and the function provides no output

eos_temp(tt, prt=True, update=False, kp_only=False, save=False, tex=False, title=True)[source]

Outputs the EoS (BM3) at a given temperature

Parameters:
  • tt – temperature (K)

  • prt (optional) – if prt=True (default) plots the F(V) function and a list o volume/pressure at the chosen temperature

Note

In the optimization, Kp can be kept fixed to the value set by the set_fix function

eos_temp_range(vmin_list, vmax_list, npp, temp)[source]

EoS computed for different volumes ranges

Parameters:
  • vmin_list – list of minimum volumes

  • vmax_list – list of maximum volumes

  • npp – number of points in each V-range

  • temp – temperature

Note

vmin_list and vmax_list must be lists of same length

eosfit(file_name, **kwargs)[source]

Writes a PVT file to be used with EosFit Temperature data are in the temperature_list list

Parameters:

file_name – name of the output file

Keyword Arguments:

fixed (if the optional argument 'fix' is larger than 0.1, Kp=fix is) –

Example

>>> eosfit("myfile.dat")

enclose the file name in quotes

eosfit_dir(file_name, pmin=0.0, pmax=0.0, volume_max=0.0, unit=False, scale=0.0)[source]

Writes a PVT file to be used with EosFit Temperature data are in the temperature_list list

Parameters:
  • file_name – name of the output file

  • unit – if unit=True, volumes are converted in cm^3/mol

  • pmax – if not 0., maximum pressure in the computed dataset (in GPa); if pmax=0. (default) there is no limit in the pressure (which is determined by the input volume range).

  • pmin – Minimum pressure to be stored in the PVT file (default 0.)

  • volume_max – if gt. 0, this is the maximum volume to be considered in the calculation.

  • scale – if scale > 0., a scale factor is applied to the volume values (default 0.)

Examples

>>> eosfit_dir("myfile.dat")
>>> eosfit_dir("myfile.dat", pmax=10., unit=True, scale=0.9787)

enclose the file name in quotes.

Note

The computation of P(V,T) is performed without reference to any EoS, as pressure at (V,T) is computed as numerical derivative of F with respect to V at constant temperature.

Note

The method eosf.set_t can be used to set the T_range interval on which the eosfit computation has to be done (instead of using a TEMPERATURE keyword in the input file).

equilib_dir(tini, tfin, npoint, mqm='py', prod=['py', 1], rea=['ens', 1.5, 'cor', 1], out=False)[source]

Computes the equilibrium pressure for a reaction involving a given set of minerals, in a range of temperatures.

Parameters:
  • tini – minimum temperature in the range

  • tfin – maximum temperature in the range

  • npoint – number of points in the T range

  • mqm – mineral phase dealt at the quantum mechanical level, whose Gibbs free energy is computed as G=F+PV

  • prod – list of products of the reaction in the form [name_1, c_name_1, name_2, c_name_2, …] where name_i is the name of the i^th mineral, as stored in the database, and c_name_i is the corresponding stoichiometric coefficient

  • rea – list of reactants; same syntax as the “prod” list.

Example

>>> equilib_dir(300, 500, 12, mqm='py', prod=['py',1], rea=['ens', 1.5, 'cor', 1])
class exclude_class[source]

Bases: object

Contains the list of modes to be excluded from the calculation of the Helmholtz free energy. It can be constructed by using the keyword EXCLUDE in the input.txt file.

add(modes)[source]
Parameters:

n – can be a scalar or a list of modes to be excluded

on()[source]
restore()[source]

Restores all the excluded modes

field_dir(tmin, tmax, pmin, pmax, mqm, prod_spec, prod_coef, rea_spec, rea_coef, nx=6, ny=6)[source]
find_pressure_vt(vv, tt, pmin, pmax, prt=True)[source]
find_temperature_vp(vv, pp, tmin=100.0, tmax=1000.0, prt=True)[source]
class fit_flag[source]

Bases: object

off()[source]
on()[source]
fit_off()[source]
fit_status()[source]
class fix_flag(value=0.0)[source]

Bases: object

off()[source]
on(value=4)[source]
fix_status()[source]

Inquires about the setting concerning Kp

class flag(value)[source]

Bases: object

inc()[source]
off()[source]
on()[source]
reset()[source]
free(temperature)[source]

Computes the Helmholtz free energy (hartree) at a given temperature

Parameters:

temperature – temperature (in K) at which the computation is done

Note

  1. ei is the static energy

  2. enz_i is the zero point energy

  3. fth_i is thermal contribution to the Helmholtz free energy

  4. tot_i is the total Helmholtz free energy

Note

This is a direct calculation that avoids the fit of a polynomium to the frequencies. No FITVOL in input.txt

Note

If kieffer.flag is True, the contribution from acoustic branches is taken into account, by following the Kieffer model.

free_fit(temperature)[source]

Computes the Helmholtz free energy (in hartree) at a given temperature

Parameters:

temperature – temperature (in K)

Note

  1. ei is the static energy

  2. enz_i is the zero point energy

  3. fth_i is thermal contribution to the Helmholtz free energy

  4. tot_i is the total Helmholtz free energy

Note

This computation makes use of polynomia fitted to the frequencies of each vibrational mode, as functions of volume. It is activated by the keyword FITVOL in the input.txt file

Note

Possible contributions from anharmonicity (keyword ANH in the input file) or from a modified Kieffer model (keyword KIEFFER in the input file) are included. NO contribution from DISP modes is considered (phonon dispersion from a supercell calculation).

Note: the volumes at which the free energy refers are defined in the fit_vol

list

free_fit_vt(tt, vv)[source]

Computes the Helmholtz free energy at a given pressure and volume.

Free energy is computed by addition of several contributions:
  1. static contribution from a volume-integrated BM3 EoS

  2. vibrational contribution from optical vibrational modes

  3. vibrational contribution from phonon dispersion (supercell calculations)

  4. vibrational contribution from acoustic modes (modified Kieffer model)

  5. vibrational contribution from anharmonic mode(s)

Contributions (1) and (2) are always included; contributions (3) and (4) are mutually exclusive and are respectively activated by the keywords DISP and KIEFFER in the input file; anharmonic contributions (5) are activated by the keyword ANH in the input file.

Parameters:
  • tt – temperature (K)

  • vv – volume (A^3)

free_kief(tt)[source]
free_stack_t(tini, tfin, npoints)[source]

Computes the contribution to the Helmholtz free energy from acoustic phonons, in a given temperature range, according to the Kieffer model. Values of free energies are stored in a stack (of the kieffer class) and recovered, when needed, by the method get_value of the class.

The function is called by quick_start or by the freq method of the kieffer class.

free_v(tt, vol, **kwargs)[source]

Helmholtz free energy at a given temperature and volume Unit: a.u.

Parameters:
  • tt – temperature (K)

  • vol – cell volume (A^3)

Keyword Arguments:

fix – if fix is provided, it controls (and overrides the setting possibly chosen by set_fix) the optimization of kp in BM3; if fix > 0.1, kp = fix and it is not optimized.

freq_ac_estimation(K, Vol, nu=0.35, set_kief=False)[source]

Estimation of Kieffer’s frequencies for the estimation of the acoustic contribution to S and Cv, by the modified Kieffer model.

The approximation here implemented computes the shear modulus (mu) from a given Poisson ratio (nu); then, secondary (vs) and primary (vp) velocities of the acoustic waves are estimated from K (bulk modulus) and mu. Finally, the frequencies at the Brillouin zone boundary are computed and printed.

Parameters:
  • K – bulk modulus (GPa)

  • Vol – unit cell volume of the primitive cell (A^3)

  • nu – Poisson parameter (default value 0.35)

  • set_kief – if True, The kieffer frequencies are stored for the calculation of S and Cv.

Note

Since the calculation requires the density of the crystal, the formula weight must be set by using the FWG keyword in the input.txt file.

freq_ac_exact(KV, KR, GV, GR, VMAX, Vol, set_kief=False)[source]

Computation of Kieffer’s frequencies for the estimation of the acoustic contribution to S and Cv, by the modified Kieffer model.

The required input data can be read from a CRYSTAL calculation of the full elastic tensor

Parameters:
  • KV, KR – Voigt and Reuss bulk moduli (GPa)

  • GV, GR – Voigt and Reuss shear moduli

  • VMAX – maximum shear velocity

  • Vol – unit cell volume of the primitive cell (A^3)

  • set_kief – if True, The kieffer frequencies are stored for the calculation of S and Cv (default False)

Note

Since the calculation requires the density of the crystal, the formula weight must be set by using the FWG keyword in the input.txt file.

freq_poly_p(ifr, tt=300.0, p0=0.0, plot=True, prt=True, **kwargs)[source]

Prints the frequency of a given mode at some temperature and pressure if a spline fitting method has been chosen

Parameters:
  • ifr – mode number (starting from 0)

  • tt – temperature (K)

  • pp – pressure (GPa)

Keyword Arguments:

fix (optional) – Kp value fixed to fix if fix > 0.1

Note

A polynomial fitting must be active

freq_spline(ifr)[source]
freq_spline_p(ifr, tt=300.0, pp=0.0, prt=True, **kwargs)[source]

Prints the frequency of a given mode at some temperature and pressure if a spline fitting method has been chosen

Parameters:
  • ifr – mode number (starting from 0)

  • tt – temperature (K)

  • pp – pressure (GPa)

  • fix (optional) – Kp value fixed to fix if fix > 0.1

A spline fitting must be active

freq_spline_v(ifr, vv)[source]
freq_stack_fit()[source]

Accumulates all the coefficients of the polynomia fitting the frequencies of all the modes, computed by freq_v_fit. Outputs the array “pol_stack” used by freq_v_fun

freq_stack_spline()[source]
freq_v_fit(ifr)[source]

Computes the coefficients of the polynomium fitting the frequency of the “ifr” mode with respect to volume; the degree of the fitting polynomium (“dg”) is specified in the input.txt file, under the keyword FITVOL, or it can be set by the set_poly function.

freq_v_fun(ifr, vv)[source]

Outputs the frequency of the “ifr” mode as a function of volume by using the polynomial fit computed with freq_v_fit

frequency_p_range(ifr, pmin, pmax, npoint, out=False, dir=False, temp=298.15, degree=1, title=True, tex=False, save=False, fit_out=False)[source]

Frequency of a mode computed as a function of pressure in a given range, at a fixed temperature.

Parameters:
  • ifr – mode number

  • pmin, pmax, npoint – minimum and maximum pressure in the range (GPa), and number of points

  • temp – temperature (default 298.15 K)

  • out – if True, a pressure-frequency list is returned (default False)

  • dir – if True, volume is computed through the volume_dir function; otherwise, the EoS-based new_volume function is used (default False)

  • degree – degree of the fitting polynomial (default 1)

  • title – if False, title of the plot is suppressed (default True)

  • tex – if True, Latex output is used for the plot (default False)

  • save – if True, the plot is saved (default False)

  • fit_out – if True, fit parameters of frequency versus pressure are returned (default False)

Note

A fit of the frequencies vs volume (either poly or spline) is required.

Note

if save is True and tex is True, the fontsize, the resolution and extension of the saved file are controlled by the parameters of the latex class.

frequency_t_range(ifr, tmin, tmax, npoint, dir=False, pressure=0.0, degree=1, title=True, tex=False, save=False)[source]

Frequency of a mode computed as a function of pressure in a given range, at a fixed temperature.

Parameters:
  • ifr – mode number

  • tmin, tmax, npoint – minimum and maximum temperature in the range (K), and number of points

  • pressure – pressure (default 0 GPa)

  • dir – if True, volume is computed through the volume_dir function; otherwise, the EoS-based new_volume function is used (default False)

  • degree – degree of the fitting polynomial (default 1)

  • title – if False, title of the plot is suppressed (default True)

  • tex – if True, Latex output is used for the plot (default False)

  • save – if True, the plot is saved (default False)

Note

A fit of the frequencies vs volume (either poly or spline) is required.

Note

if save is True and tex is True, the fontsize, the resolution and extension of the saved file are controlled by the parameters of the latex class.

frequency_temperature(mode_list, temp_list, pres=0)[source]
g_vt_dir(tt, pp, **kwargs)[source]
gamma_calc(tt, pol)[source]
class gamma_class[source]

Bases: object

Store coefficients of a gamma(T) fit

upload(deg, pcoef)[source]
gamma_estim(tini, tfin, npoint=12, g_deg=2, dir=False)[source]
gibbs_p(tt, pp, **kwargs)[source]
gibbs_serie_p(pini, pfin, npres, tt, prt=True, **kwargs)[source]

Gibbs free energy in a pressure interval, at a given temperature

Parameters:
  • pini – minimum pressure (GPa)

  • pfin – maximum pressure (GPa)

  • npres – number of points in the interval

  • tt – temperature (K)

  • prt (optional) – if True, prints a numerical table G(P)

Keyword Arguments:
  • fix – Kp fixed, if fix=Kp > 0.1

  • g0 – Experimental G at the reference T and P (J/mol)

  • v0 – Experimental V at the reference T and P (J/mol bar)

Returns:

Gibbs free energy in J/mol

Note

the free energy is given with reference to the energy at the standard state (298.15 K; 0 GPa)

gibbs_serie_t(tini, tfin, ntemp, pp, prt=True, **kwargs)[source]

Gibbs free energy in a temperature interval, at a given pressure

Parameters:
  • tini – minimum temperature (K)

  • tfin – maximum temperature (K)

  • ntemp – number of points in the interval

  • pp – pressure (GPa)

  • prt (optional) – if True, prints a numerical table G(Y)

Keyword Arguments:
  • fix – Kp fixed, if fix=Kp > 0.1

  • g0 – Experimental G at the reference T and P (J/mol)

  • v0 – Experimental V at the reference T and P (J/mol bar)

Returns:

Gibbs free energy in J/mol

Note

The free energy is given with reference to the energy at the standard state (298.15 K; 0 GPa)

gibbs_tp(tt, pp, **kwargs)[source]
grun_mode_vol(ifr, vv, method='poly', plot=False)[source]

Mode-gamma Gruneisen parameter of a normal mode at a given volume

Parameters:
  • ifr – mode number

  • vv – volume

  • method (optional) – method chosen for the frequency/volume values (default: ‘poly’; other possible method=’spline’)

  • plol (optional) – if not False (default), plots the frequency values of the selected mode in a neighborhood of the volume vv

Returns:

Mode-gamma Gruneisen parameter and the frequency of the mode at the volume vv

grun_therm_serie(tini, tfin, npoint=12, HTlim=2000.0, degree=1, g_deg=1, ex=False, dir=False)[source]
gruneisen(vol, method='poly', plot=True)[source]

Mode-gamma Gruneisen parameter of all the normal modes at a given volume

Parameters:
  • vv – volume

  • method (optional) – method chosen for the frequency/volume values (default: ‘poly’; other possible method=’spline’)

  • plot (optional) – if True (default), plots the mode-gamma Gruneisen parameters of all the modes

Returns:

if plot=False, outputs the list of the mode-gamma Gruneisen parameters of all the modes

gruneisen_therm(tt, pp, ex_data=False, dir=False, prt=True)[source]

Gruneisen parameter: alpha*K_T*V/Cv

Parameters:
  • tt – temperature

  • pp – pressure

  • dir – if True, the direct.dpdt function that returns the product k*alpha is used (default False)

  • ex_data – if True, values of volume, constant volume specific heat, thermal expansion, bulk modulus and gamma are returned (default False)

  • prt – if True, computed values are printed

Note

The required bulk modulus (Reuss definition) is computed by the bulk_modulus_p function, with the noeos parameter set to True. Thermal expansion is evaluated by the function ‘compute’ of the thermal_expansion class, with the method ‘k_alpha_dir’; Cv is from the direct.cv method.

helm_anharm_func(mode, vv, tt)[source]
import_file(file)[source]
init_bm3(vv, en)[source]

Estimates initial parameters for the V-integrated BM3 EoS in case the INI keyword is not present in “input.txt”

Parameters:
  • vv (list) – volumes

  • en (list) – static energies at the corresponding volumes vv

Returns:

“ini” list of V-integrated EoS parameters estimated by a polynomial fit: v_ini, k0_ini, kp, e0_ini. kp is set to 4.

Note

such parameters are used as initial guesses for the bm3 optimization.

init_bm4(vv, en, kp)[source]

Function used to estimate the initial parameters of a V-integrated BM4 EoS. The function is used by the method “estimates” of the bm4 class. The estimation is done on the basis of a previous BM3 optimization whose initial parameters are provided by the current function.

Parameters:
  • vv (list) – volumes

  • en (list) – static energies at the corresponding volumes vv

  • kp – initail value assigned to kp

Returns:

“ini” list of V-integrated EoS parameters (for a BM3) estimated by a polynomial fit: v_ini, k0_ini, kp, e0_ini.

Note: such parameters are used as initial guesses for the BM3 optimization performed by the method “estimates” of the class bm4 that, in turn, outputs the “ini” list for the BM4 EoS optimization.

kief_int_ent_t(tt, xnti)[source]
kief_int_free_t(tt, xnti)[source]
kief_int_t(tt, xnti)[source]
kief_intnd_ent_t(x, tt, xnti)[source]
kief_intnd_free_t(x, tt, xnti)[source]
kief_intnd_t(x, tt, xnti)[source]
class kieffer_class(flag=False)[source]

Bases: object

freq(f1, f2, f3)[source]
get_value(temperature)[source]
off()[source]
on()[source]
plot()[source]
rescale(fact=1.0, save=False)[source]
stack(t_range, f_list)[source]
class latex_class[source]

Bases: object

Setup for the use of LaTeX for axis labels and titles; sets of parameters for graphics output.

get_dpi()[source]
get_ext()[source]
get_fontsize()[source]
get_tsize()[source]
off()[source]
on()[source]
set_param(dpi=300, fsize=14, tsize=12, ext='jpg')[source]
Parameters:
  • dpi – resolution of the graphics file (default 300)

  • fsize – size of the labels of the axes in points (default 14)

  • tsize – size of the ticks in points (default 12)

  • ext – extension of the graphics file (default ‘jpg’); this argument is only used in those routines where the name of the file is automatically produced by the program (e.g. check_poly or check_spline functions). In other cases, the extension is directly part of the name of the file given as argument to the function itself, and ‘ext’ is ignored.

class lo_class[source]

Bases: object

LO/TO splitting correction.

The class stores a copy of the original TO frequencies, the modes affected by LO/TO splitting and the splitting values. Modes are identified by their progressive number (starting from 0) stored in the mode attribute. When the correction is activated, new values of frequencies (f_eff) are computed for the relevant modes, according to the formula:

f_eff = 2/3 f_TO + 1/3 f_LO

where f_LO = f_TO + split.

Correction is activated by the keyword LO in the input.txt file, followed by the name of the file containing the splitting data (two columns: mode number and the corresponding split in cm^-1).

Internally, the methods on and off switch respectively on and off the correction. The method apply does the computation of the frequencies f_eff.

apply()[source]
off()[source]
on()[source]
load_disp(disp_info, disp_file)[source]

Load files containing data for the phonon dispersion correction. These are the same files that could be also specified under the keyword DISP in the input.txt file.

Parameters:
  • disp_info – name of the info file

  • disp_file – name of the frequencies’ file

main()[source]
mode_crossing(modes, title=True, tex=False, save=False, dpi=80, ext='png')[source]

Plot of the frequencies of modes as a function of volume in the same plot. Useful to check for modes crossing.

Parameters:
  • modes – list of modes to be plotted

  • title – if True, a title is shown

  • save – if True, the plot is saved in the file ‘crossing_modes’

  • ext – extension of the file (relevant if save is True)

  • dpi – resolution of the saved plot (relevant if save=True)

  • tex – latex plotting

Note

if tex is True, dpi and ext parameters are overwritten by those requested by the latex class

new_volume(tt, pr, **kwargs)[source]

Computes the volume (A^3) at a given pressure and temperature

Parameters:
  • tt – temperature (K)

  • pr – pressure (GPa)

Keyword Arguments:

fix (optional) – used to keep Kp fixed

number_phonon_mode(ifr, tt, vol, method='poly')[source]

Number of phonons of a given mode at given temperature and volume

Parameters:
  • ifr – mode number

  • tt – temperature

  • vv – volume

  • method (optional) – method chosen for the frequency/volume values (default: ‘poly’; other possible method=’spline’)

Returns:

Number of phonons computed according to the Bose-Einstein statistics

p_static(nvol=50, v_add=[], e_add=[])[source]

Computes a static BM3-EoS from a P/V set of data. Data (cell volumes in A^3 and pressures in GPa) must be contained in a file whose name must be specified in the input file (together with the energy, in hartree, at the equilibrium static volume.

Parameters:
  • nvol – number of volume points for the graphical output (default 50)

  • v_add / e_add – lists of volume/energy data to be plotted together with the E/V curve from the V-EoS fit. Such added points are not used in the fit (no points added as default)

Note

This function provides static data for the calculation of the static contribution to the Helmholtz free energy. It is an alternative to the fit of the static E/V data performed by the ‘static’ function.

class p_static_class[source]

Bases: object

class poly_flag(flag=False, degree=2)[source]

Bases: fit_flag

off()[source]
on()[source]
set_degree(degree)[source]
stack()[source]
vol_range(v_ini, v_fin, npoint)[source]
pressure(tt, vv, **kwargs)[source]

Computes the pressure at a temperature and volume

Parameters:
  • tt – temperature

  • vv – unit cell volume

  • fix (optional) – optimizes Kp if fix=0., or keeps Kp fixed if fix=Kp > 0.1

pressure_dir(tt, vv)[source]

Computes the pressure at a given volume and temperature from the numerical derivative of the Helmholtz free energy with respect to the volume (at constant temperature).

Parameters:
  • tt – temperature (K)

  • vv – volume (A^3)

pressure_freq(ifr, freq, tt, degree=4, **kwargs)[source]

Computes the pressure given the frequency of a normal mode, at a fixed temperature.

Parameters:
  • ifr – normal mode number

  • freq – value of the frequency

  • tt – temperature

  • degree (optional) – degree of the polynomial fitting the P/freq values from the pressure_freq_list function

Keyword Arguments:

fix – Kp fixed, if fix=Kp > 0.1

Notes

it is advised to keep Kp fixed by either specifying fix, or by using set_fix.

For “noisy” modes, use polynomial fits (set_poly), or a spline fit (set_spline) with a large smooth parameter.

pressure_freq_list(tt, ifr, **kwargs)[source]
pressure_phonon(tt, vol, method='poly', plot=True, prt=True, prt_list=False, thr=0.0)[source]

Vibrational pressure from all the normal modes at given temperature and volume

Parameters:
  • tt – temperature

  • vv – volume

  • method (optional) – method chosen for the frequency/volume values (default: ‘poly’; other possible method=’spline’)

  • plot (optional) – if True (default), plots the contribution to the vibrational pressure of all the normal modes.

Returns:

If plot=False, outputs the vibrational pressure of all the modes (in GPa) at the selected temperature (tt) and volume (vv).

pressure_phonon_f_range(tt, pp=0, prt=True)[source]

Computes the vibrational pressure from optic modes which subdivided in a number of intervals according to their frequencies.

Parameters:
  • tt – temperature (K) at which the vibrational pressures are computed

  • pp – pressure (GPa; default 0)

  • prt – if True, a detailed printout is provided; if False, the pressure per mode in the low frequency interval is returned

Notes

This function is mainly used to estimate the contribution to the total pressure due to acoustic phonons, in case no supercell data are available This estimation and the relative corrections to the elastic properties are performed by the methods of the ac_approx instance of the acoustic_approx_class.

To change the number of intervals (bins) to build the histogram of the frequencies, use the ac_approx.set method, by specifying the nbin keyword argument

Example

>>> ac_approx.set(nbin=5)
>>> pressure_phonon_f_range(298)
pressure_phonon_mode(ifr, tt, vol, method='poly')[source]

Contribution to the vibrational pressure from a given mode, at fixed temperature and volume

Parameters:
  • ifr – mode number

  • tt – temperature

  • vol – volume

  • method (optional) – method chosen for the frequency/volume values (default: ‘poly’; other possible method=’spline’)

Returns:

Vibrational pressure of the “ifr” mode (in GPa) at the selected temperature (tt) and volume (vv)

pressure_react_dir(tt, mqm, prod_spec, prod_coef, rea_spec, rea_coef)[source]
pressure_temp(tmin, tmax, nt, ptot=0)[source]

Computes contribution to the total pressure in a given temperature range

Parameters:
  • tmin – minimum temperature (K)

  • tmax – maximum temperature (K)

  • nt – number of temperature values

  • ptot – total (external) pressure (in GPa; default 0 GPa)

q_parameter(pfin=5.0, temp=298.15, npoint=12, dir=False)[source]

Calculation of the parameter q of the equation

gamma/gamma_0 = (V/V_0)^q

The Gruneisen parameter is evaluated at constant temperature for a range of pressures, for which the corresponding volumes are computed, by using the gruneisen_therm function.

Parameters:
  • pfin – final (maximum) pressure (GPa; default 5)

  • temp – temperature (K; default 298.15)

  • npoint – number of points in the P range (default 12)

  • dir – see the help of the gruneisen_therm function (default False)

q_parameter_func(rv, q)[source]
quick_start(path)[source]

Quick start of the program. Reads the input files found under the folder ‘path’ whose name is written in the ‘quick_start.txt’ file (found in the master folder). Executes read_file; static (static equation of state) and stacks data for the application of the Kieffer model, if required with the optional ‘KIEFFER’ keyword in input.txt

reaction_dir(tt, pp, mqm, prod_spec, prod_coef, rea_spec, rea_coef)[source]
read_file(data_path)[source]
reload_input(path)[source]
remark(string)[source]
reset_fix()[source]

Resets the fix Kp option: f_fit.flag=False

reset_flag()[source]
s_kief(tt)[source]
set_fix(fix=4.0)[source]

Sets Kp to a value and keeps it fixed during fitting of EoS

Parameters:
  • fix (optional) – Kp value. Default 4.

  • if fix=0, Kp if fixed to the last computed value stored in info.kp

The flag f_fit.flag is set to True

set_poly(degree=4, npoint=16)[source]

Sets polynomial fits of the frequencies as function of volume

Parameters:
  • degree (optional) – degree of the spline (default: 4)

  • npoint (optional) – number of points of the polynomial function (default: 16)

set_spline(degree=3, smooth=5, npoint=16)[source]

Sets spline fits of the frequencies as function of volume

Parameters:
  • degree (optional) – degree of the spline (default: 3)

  • smooth (optional) – smoothness of the spline (default: 5)

  • npoint (optional) – number of points of the spline function (default: 16)

set_volume_range(vini, vfin, npoint=16, prt=False)[source]

Defines a volume range for the fitting of frequencies and EoS in the case that SPLINE or POLY fits have been chosen

Parameters:
  • vini – minimum volume

  • vfin – maximum volume

  • npoint (optional) – number of points in the volume range

class spline_flag(flag=False, degree=3, smooth=0)[source]

Bases: fit_flag

Sets up the spline fit of the frequencies as functions of the volume of the unit cell.

Several variables are defined:
  1. flag: (boolean); if True, frequencies are fitted with splines

  2. degree: degree of the spline

  3. smooth: smoothness of the spline

  4. flag_stack: (boolean) signals the presence of the spline stack

  5. pol_stack: it is the stack containing parameters for the spline fit

Note

The spline stack can be set up and initialized by using the keyword SPLINE under the keyword FITVOL in the input.txt file

Methods:

off()[source]
on()[source]
set_degree(degree)[source]
set_smooth(smooth)[source]
stack()[source]
vol_range(v_ini, v_fin, npoint)[source]
start_bm4()[source]
static(plot=False, vmnx=[0.0, 0.0], prt=True)[source]

Static EoS

Parameters:
  • plot – plot of the E(V) curve

  • vmnx – array of two reals [vmin and vmax]; vmin is the minimum volume and vmax is the maximum volume. If vmin and vmax are both 0., the whole V range is used (as specified in the static energies file). Default=[0., 0.]

Note

The volume range can also be modified by using the methods of the static_volume class

Examples

>>> static_volume.set(100., 120.)
>>> static_volume.on()
>>> static(plt=True)

Computes the static EoS in the [100., 120.] volume range. The same is obtained with

>>> static(plt=True, vmnx=[100., 120.])

However, with the first method the defined volume range is recorded for future computations; by using the second method, the volume range is reset to the original one, once the fit is performed.

class static_class[source]

Bases: object

Defines the volume range for the fit of the static EoS If not specified (default) such range is defined from the volumes found in the static energies file.

off()[source]

Restores the original V-range (actually, it switches off the volume selection for the fit of the static EoS)

on()[source]

It switches on the volume selection for the fit of the static EoS

Note

The minimum and maximum V-values are set by the ‘set’ method of the class

set(vmin, vmax)[source]

Sets the minimum and maximum volumes for the V-range

Parameters:
  • vmin – minimum volume

  • vmax – maximum volume

static_pressure_bm3(vv, prt=True)[source]

Outputs the static pressure (in GPa) at the volume (vv)

Parameters:

vv – volume

stop()[source]

used to exit from the program in case of fatal exceptions

class super_class[source]

Bases: object

Store supercell data: number of cells on which the frequencies computation was done. To be used in connection with CRYSTAL calculations performed with SCELPHONO and QHA keywords. Default value: 1

reset()[source]
set(snum)[source]
temperature_freq(ifr, freq, tmin, tmax, npt, pp, degree=2, **kwargs)[source]

Computes the temperature given the frequency of a normal mode, at a fixed pressure. A T range must be specified

Parameters:
  • ifr – normal mode number

  • freq – value of the frequency

  • tmin – minimum value of T

  • tmax – maximum value of T

  • npt – number of T points in the range

  • pp – pressure

  • degree (optional) – degree of the polynomial fitting the P/freq values from the pressure_freq_list function

Keyword Arguments:

fix – Kp fixed, if fix=Kp > 0.1

Note

it is advised to keep Kp fixed by either specifying fix, or by using set_fix.

For “noisy” modes, use polynomial fits (set_poly), or a spline fit (set_spline) with a large smooth parameter.

thermal_exp_p(tt, pp, plot=False, exit=False, **kwargs)[source]

Thermal expansion at given temperature and pressure, based on the computation of K*alpha product. :Parameters: * tt – temperature

  • pp – pressure

  • plot (optional) – plots pressure vs T values (see help to the thermal_exp_v function)

  • exit – if True, the alpha value is returned without formatting (default False)

Keyword Arguments:

fix – if fix is provided, it controls (and overrides the setting possibly chosen by set_fix) the optimization of kp in BM3; if fix > 0.1, kp = fix and it is not optimized.

Note

see help for the thermal_exp_v function

thermal_exp_v(tt, vv, plot=False, **kwargs)[source]

Thermal expansion at a given temperature and volume

Parameters:
  • tt – temperature

  • vv – volume

  • plot (optional) – (default False) plots pressure vs T for checking possible numerical instabilities

Keyword Arguments:

fix – if fix is provided, it controls (and overrides the setting possibly chosen by set_fix) the optimization of kp in BM3; if fix > 0.1, kp = fix and it is not optimized.

Returns:

thermal expansion (K^-1), bulk modulus (GPa) and pressure (GPa) at given temperature=tt and volume=vv

Notes

The value is obtained by calculating (dP/dT)_V divided by K where K=K0+K’*P; P is obtained by the BM3 EoS’s whose parameters (at temperatures in the range “t_range”) are refined by fitting the free energy F(V,T) curves. The different pressures calculated (at constant vv) for different T in t_range, are then fitted by a polynomial of suitable degree (“degree” variable) which is then derived analytically at the temperature tt, to get (dP/dT)_V

If “fix” > 0.1, the BM3 fitting is done by keeping kp fixed at the value “fix”.

The function outputs the thermal expansion (in K^-1), the bulk modulus [at the pressure P(vv,tt)] and the pressure (in GPa) if the boolean “plot” is True (default) a plot of P as a function of T is plotted, in the range t_range

class thermal_expansion_class[source]

Bases: object

Interface for the computation of thermal expansion by different algorithms. The method ‘compute’ performs the calculation by calling different functions according to the ‘method’ keyword. Similarly, the method ‘compute_serie’ performs the calculation of alpha as a function of temperature.

Several default parameters for the calculation are provided, which can be set by the method ‘set’.

The algortithms which are currently implemented can be listed by the method ‘info’

The ‘compute_serie’ method perform the calculation of the thermal expansion in a given T-range and, optionally, performs a power series fit on the computed values. Data from the fit can optionally be loaded in the internal database if a phase name is provided.

Note

For the method ‘k_alpha_eos’, this class uses a specialized plotting function from the plot.py module, whose parameters are controlled by the plot.set_param method.

compute(tt, pp, method='default', fix=0.0, prt=False)[source]

Thermal expansion at a specific temperature and pressure

Parameters:
  • tt – temperature (K)

  • pp – pressure (GPa)

  • method – 3 methods are currently implemented (‘k_alpha_dir’, ‘k_alpha_eos’ and ‘alpha_dir’); default ‘k_alpha_dir’

  • fix – relevant for method ‘k_alpha_eos’ (default 0., Kp not fixed)

  • prt – relevant for method ‘k_alpha_eos’; it controls printout (default False)

compute_serie(tmin, tmax, pressure=0, nt=0, fit='default', tex='default', title='default', save='default', phase='default', method='default', prt=True, fix=0)[source]

Thermal expansion in a T-range

Parameters:
  • tmin, tmax – minimum and maximum temperature in the range

  • pressure – pressure (GPa); default 0

  • nt – number of points in the T-range; if nt=0, the default is chosen (12)

  • method – one of the three methods currently implemented

  • fit – if True, a power series fit is performed

  • phase – if fit is True and a phase name is specified (label), the data from the power series fit are loaded in the internal database

  • fix – relevant for the method ‘k_alpha_eos’; if fix is not 0., Kp is fixed at the specified value

  • title – if True, a title of the plot is provided

  • tex – if tex is True, laTeX formatting is provided

  • prt – relevant for the method ‘k_alpha_eos’

  • save – if True, the plot is saved in a file

Note

if save is True and method is ‘k_alpha_eos’, the name of the file where the plot is saved is controlled by the plot.name and plot.ext variables. The file resolution is controlled by the plot.dpi variable. The appropriate parameters can be set by the set_param method of the plot instance of the plot_class class (in the plot.py module)

Example

>>> plot.set_param(dpi=200, name='alpha_k_eos_serie')
>>> thermal_expansion.compute_serie(100, 500, method='k_alpha_eos', save=True)
info()[source]
set(method='k_alpha_dir', nt=12, fit=False, tex=False, save=False, phase='', title=True, fix=0.0)[source]
upload_mineral(tmin, tmax, points=12, HT_lim=0.0, t_max=0.0, deg=1, g_deg=1, model=1, mqm='py', b_dir=False, blk_dir=False, extra_alpha=True, volc=False)[source]

Prepares data to be uploaded in the mineral database.

Parameters:
  • tmin – minimum temperature for fit K0, Cp and alpha

  • tmax – maximum temperature for fit

  • points – number of points in the T range for fit

  • mqm – name of the mineral, as specified in the internal database,

  • b_dir – if True, the alpha_dir_serie function is used for the computation of thermal expansion

  • blk_dir

    if True, the bulk_modulus_p_serie function is used

    to compute the bulk modulus as a function of T (with noeos=False); K0, V0 and Kp are from an eos_temp computation.

    If False, the function bulk_serie is used.

  • HT_lim – Temperature at which the Dulong-Petit limit for Cv is supposed to be reached (default 0.: no Dulong-Petit

    model)

  • t_max – maximum temperature for the power series fit of Cp(T); if t_max=0. (default), t_max=HT_lim. The parameter is relevant oly if HT_lim is not zero.

  • model – Used in the HT_limit estimation of Cv; Einstein model for Cv(T) with one frequency (default model=1), or with 2 frequencies (model=2)

  • deg – Used in the HT limit estimation of alpha (relevant if HT_lim > 0; default: 1)

  • g_deg – Used in the HT limit estimation of Cp (relevant if HT_lim > 0.; default 1)

  • extra_alpha – if True, the high temperature estrapolation is done (relevant if HT_lim > 0; default: True)

  • volc – if True, V0 is set at the value found in the database (default: False)

Example

>>> upload_mineral(300,800,16,mqm='coe', b_dir=True)
v_bm3(vv, v0, k0, kp, c)[source]

Volume integrated Birch-Murnaghan equation (3^rd order)

Parameters:
  • vv – volume

  • v0 – volume at the minimum of the energy

  • k0 – bulk modulus

  • kp – derivative of k0 with respect to P

  • c – energy at the minimum

Returns:

the energy at the volume vv

class verbose_class(value)[source]

Bases: object

off()[source]
on()[source]
view()[source]

View input file (input.txt)

view_input(input_file)[source]
class vol_corr_class[source]

Bases: object

off()[source]
on()[source]
set_volume(vv)[source]
class volume_F_control_class[source]

Bases: object

Class controlling some parameters relevant for the computation of volume and thermal expansion by using the volume_from_F function. Precisely, the initial volume (around which the refined volume vref is to be searched) is set to vini+shift, where vini is the output from the volume_dir, whereas shift is from this class. Shift is computed as the difference vref-vini; it can be upgraded provided the flag upgrade_shift is set to True.

get_flag()[source]
get_shift()[source]
get_upgrade_status()[source]
off()[source]
on()[source]
set_shift(sh)[source]
upgrade_off()[source]
upgrade_on()[source]
class volume_control_class[source]

Bases: object

Defines suitable parameters for the volume_dir function

debug_off()[source]
debug_on()[source]
kp_off()[source]
kp_on()[source]
set_all(degree=2, delta=2.0, skew=1.0, shift=0.0, t_max=500.0, quad_shrink=4, kp_fix=True, upgrade_shift=False, debug=False, t_dump=0.0, dump=1.0, t_last=0.0)[source]
set_degree(degree)[source]

Sets the degree of polynomial used to fit the (P(V)-P0)^2 data. The fitted curve is the minimized to get the equilibrium volume at each T and P.

For each of the single parameter revelant in this class, there exist a specific method to set its value. The method set_all can be used to set the values of a number of that, at the same time, by using appropriate keywords as argument. The arguments to set_all are:

Parameters:
  • degree – degree of the fitting polynomial (default=2)

  • delta – volume range where the minimum of the fitting function is to be searched (default=2.)

  • skew – the Volume range is centered around the equilibrium volume approximated by the EoS-based new_volume function The symmetry around such point can be controlled by the skew parameter (default=1.: symmetric interval)

  • shift – Systematic shift from the new_volume estimation (default=0.)

  • t_max – In the initial estimation of the volume at P/T with the EoS-based new_volume function, the Kp is refined if T < t_max. If T > t_max and kp_fix=True, Kp is fixed at the value refined at t_max (default=500K)

  • kp_fix – See t_max (default=True)

  • quad_shrink – if degree=2, it restricts the volume range around the approximated volume found. The new range is delta/quad_shrink (default=4)

  • upgrade_shift – at the end of the computation, the difference between the volume found and the initial one (from the EoS- based new_volume function) is calculated. The shift attribute is then upgraded if upgrade_shift is True (default=False)

  • debug – if True, the (P(V)-P0)**2 function is plotted as a function of V (default=False)

  • t_dump – temperature over which a dumping on the shift parameter is applied (default=0.)

  • dump – dumping on the shift parameter (shift=shift/dump; default=1.)

  • t_last – if t_last > 10., the last volume computed is used as the initial guess value (vini) for the next computation at a new temperature.

set_delta(delta)[source]
set_shift(shift)[source]
set_shrink(shrink)[source]
set_skew(skew)[source]
set_t_dump(t_dump=0.0, dump=1.0)[source]
set_t_last(t_last)[source]
set_tmax(tmax)[source]
shift_reset()[source]
upgrade_shift_off()[source]
upgrade_shift_on()[source]
volume_conversion(vv, atojb=True, prt=True)[source]

Volume conversion from/to unit cell volume (in A^3) to/from the molar volume (in J/bar)

Parameters:
  • vv – value of volume (in A^3 or J/bar)

  • atojb – if aotjb is True (default), conversion is from A^3 to J/bar if atojb is False, conversion is from J/bar to A^3

class volume_delta_class[source]

Bases: object

Defines a suitable V range for the numerical evaluation of the derivatives of any quantity with respect to V.

The V-range (delta) is obtained by multiplying the static equilibrium volume (V0; which is computed by the static function) with a factor read from the parame.py parameters’ file; such parameter (frac) is stored in the vd.frac variable and can also be set by the set_frac method.

The method set_delta computes delta, provided a volume is input.

When delta is computed, the vd.flag is set to True and its values is used in several functions computing derivatives. On the contrary, if vd.flag is set to False (use the method off), the delta value is read from the parameters’ file (pr.delta_v).

off()[source]
on()[source]
set_delta(vol=0.0)[source]

Sets the V-delta value for the calculation of derivatives with respect to V.

Parameters:

vol – if vol > 0.1, computes delta for the volume vol; if vol < 0.1, vol is set to the default value stored in the v0 variable.

set_frac(frac)[source]
volume_dir(tt, pp, alpha_flag_1=False, alpha_flag_2=False)[source]

Computes the equilibrium volume at a given temperature and pressure without using an equation of state.

An initial estimation of the volume is however obtained by using a BM3 EoS, by calling the eos_temp function; such volume is stored in the v_new variable.

A list of volumes around the v_new value is then built and, for each value in the list, a pressure is computed by using the pressure_dir function, and compared to the input pressure to find the volume at which the two pressures are equal.

A number of parameters are used to control the computation. They are all defined by the volume-control driver (volume_ctrl). Convenient values are already set by default, but they can be changed by using the method volume_ctrl.set_all. Use the info.show method to get such values under the ‘volume driver section’.

volume_from_F(tt, shrink=10.0, npoints=60, debug=False)[source]

Computation of the equilibrium volume at any given temperature and at 0 pressure. The algorithm looks for the minimum of the Helmholtz function with respect to V (it is equivalent to the minimization of the Gibbs free energy function as the pressure is zero. The methods is very similar to that implemented in the more general volume_dir function, but it does not require the calculation of any derivative of F (to get the pressure). The Helmholtz free energy is computed by means of the free_fit_vt function.

Parameters:
  • tt – temperature (in K)

  • npoints – number of points in the V range (centered around an initial volume computed by the volume_dir function), where the minimum of F is to be searched (default 60).

  • shrink – shrinking factor for the definition of the V-range for the optimization of V (default 10).

  • debug – plots and prints debug information. If debug=False, only the optimized value of volume is returned.

Note

The function makes use of parameters sets by the methods of the volume_F_ctrl instance of the volume_F_control_class class. In particular, the initial value of volume computed by the volume_dir function can be shifted by the volume_F_ctrl.shift value. This value is set by the volume_F_ctrl.set_shift method provided that the volume_F_ctrl.upgrade_shift flag is True.

volume_from_F_serie(tmin, tmax, npoints, fact_plot=10, debug=False, expansion=False, degree=4, fit_alpha=False, export=False, export_alpha=False, export_alpha_fit=False)[source]

Volume and thermal expansion (at zero pressure) in a range of temperatures, computed by the minimization of the Helmholtz free energy function.

Parameters:
  • tmin, tmax, npoints – minimum, maximum and number of points defining the T range

  • fact_plot – factor used to compute the number of points for the plot (default 10)

  • debug – debugging information (default False)

  • expansion – computation of thermal expansion (default False)

  • degree – if expansion=True, in order to compute the thermal expansion a log(V) vs T polynomial fit of degree ‘degree’ is performed (default 4)

  • fit_alpha – thermal expansion is fitted to a power serie (default False)

  • export – list of computed volume is exported (default False)

  • export_alpha_fit – coefficients of the power series fitting the alpha’s are exported

Note

Thermal expansion is computed from a log(V) versus T polynomial fit

Note

if export is True, the volume list only is exported (and the function returns) no matter if expansion is also True (that is, thermal expansion is not computed). Likewise, if export_alfa is True, no fit of the thermal expansion data on a power serie is performed (and, therefore, such data from the fit cannot be exported).

Note

Having exported the coefficients of the power serie fitting the alpha values, they can be uploaded to a particular phase by using the load_alpha method of the mineral class; e.g. py.load_alpha(alpha_fit, power_a)

Examples

>>> alpha_fit=volume_from_F_serie(100, 400, 12, expansion=True, fit_alpha=True, export_alpha_fit=True)
>>> py.load_alpha(alpha_fit, power_a)
>>> py.info()
class zero_point[source]

Bases: object

off()[source]
on()[source]