rizer.kin.rate_fit_common#

Shared fitting/grouping machinery for the Arrhenius and Druyvesteyn rate fits.

Classes#

RateFit

Fields and unit conversions shared by ArrheniusRate and DruyvesteynRate.

Functions#

fit_log_linear_rate(→ tuple[float, float, float, float])

Fit log(k(T)) = log(A) + b * log(T) - x / T**inverse_temperature_exponent.

group_and_sort_rates_by_equation(→ dict[str, list[T]])

Group ArrheniusRate/DruyvesteynRate by equation, sorted by fit cost.

Module Contents#

rizer.kin.rate_fit_common.fit_log_linear_rate(k: numpy.ndarray, temperatures: numpy.ndarray, inverse_temperature_exponent: int, ea_lower_bound: float) tuple[float, float, float, float]#

Fit log(k(T)) = log(A) + b * log(T) - x / T**inverse_temperature_exponent.

Shared linear least-square core of k_fit_arrhenius_lstsq (exponent 1, x = Ea) and k_fit_druyvesteyn_lstsq (exponent 2, x = Ea**2); callers convert the fitted x to Ea themselves since the two models parametrize it differently.

Parameters:
  • k (numpy.ndarray) – Rate constant to be fitted.

  • temperatures (numpy.ndarray) – Temperatures at which the rate constant is computed, in Kelvin.

  • inverse_temperature_exponent (int) – Power of 1/T in the exponential term (1 for Arrhenius, 2 for Druyvesteyn).

  • ea_lower_bound (float) – Lower bound on the fitted x term.

Returns:

Fitted A, b, x and the cost function.

Return type:

tuple of float, float, float, float

Raises:

ValueError – If the least square optimization failed.

class rizer.kin.rate_fit_common.RateFit#

Fields and unit conversions shared by ArrheniusRate and DruyvesteynRate.

A_m3_per_s: float#
b: float#
Ea_K: float#
fit_cost: float#
electron_temperature: numpy.ndarray#
k_raw: numpy.ndarray#
equation: str#
source: str#
equation_alias: str#
note: str#
A_cm3_per_mol_per_s: float#
rizer.kin.rate_fit_common.group_and_sort_rates_by_equation[T: RateFit](rates: list[T], janev_cross_section_first: bool = False) dict[str, list[T]]#

Group ArrheniusRate/DruyvesteynRate by equation, sorted by fit cost.

Shared by group_and_sort_arrhenius_rate_by_equation and group_and_sort_druyvesteyn_rate_by_equation.

Parameters:
  • rates (list of RateFit) – List of ArrheniusRate or DruyvesteynRate.

  • janev_cross_section_first (bool, optional) – If True, move Janev cross section (if it exists) to the first position, by default False. Useful for choosing with database used for a mechanism.

Returns:

Dictionnary where equation are mapped to corresponding list of rates.

Return type:

dict of str to list of RateFit