Kinetic classes
Documentation for the class objects creation are presented in this section [Highlighted in blue]. Documentation for methods called internally and not requiring user definition are ignored.
- class PharmaPy.Kinetics.CrystKinetics(coeff_solub=None, solub_fn=None, nucl_prim=None, nucl_sec=None, growth=None, dissolution=None, solubility_type='polynomial', sup_sat_type='relative', reformulate_kin=False, alpha_fn=None, temp_ref=298.15, custom_mechanisms=None, mu_sec_nucl='volume')
Bases:
objectSpecify a kinetics crystallization kinetics object
- Parameters:
coeff_solub (array-like) – coefficients for a temperature-dependent solubility (S) polynomial of the form S = A + B*T + C*T^2…
nucl_prim (array-like (3 elements)) – primary nucleation coefficients, with the result given in number of particles per second per cubic meter slurry
nucl_sec (array-like (4 elements) (optional)) – secondary nucleation coefficients, with the result given in number of particles per second per cubic meter slurry
growth (array-like (dimension 3) (optional)) – nucleation parameters, with the result given in um/s
dissolution (array_like (dimension 3) (optional)) – dissolution parameters, with the result given in um/s
rel_super (bool (optional, default True)) – if True, relative supersaturation is used for computing the kinetic mechanism
alpha_fn (callable (optional)) – function that receives the vector of liquid phase compositions and calculates the growth inhibition term, returning a float between 0 and 1
- concat_params()
- deriv_cryst(conc_tg, conc, temp)
- get_kinetics(conc, temp, kv_cry, moments=None, nucl_sec_out=False)
- set_params(params_in)
- solubility_temp(temp, conc=None)
- transform_params(param_dict, reparam)
- class PharmaPy.Kinetics.RxnKinetics(path, k_params, ea_params, rxn_list=None, stoich_matrix=None, partic_species=None, temp_ref=None, reformulate_kin=False, keq_params=None, params_f=None, delta_hrxn=0, tref_hrxn=298.15, kinetic_model=None, df_dstates=None, df_dtheta=None)
Bases:
objectCreate a reaction kinetics object. Reaction rate ri is assumed to have the following functional form:
ri = f1 (T) * f2 ( C1, …, Cn_comp)
- with the temperature-dependent term f1 given by:
f1 = ki * exp(- Eai/R/T)
Composition-dependent term f2 can be passed as a user-defined function. If not given, f2 is assumed to be of the form:
f2 = prodj in reactants for rxn i Cj (alpha{i,j})
where alpha{i,j} values are determined automatically by PharmaPy from the stoichiometric matrix of the reaction system. Custom reaction orders can also be passed through the ‘params_f’ argument
- Parameters:
path (str) – path to the pure-component json file database
k_params (list or tuple) – pre-exponential factor value(s) for the temperature-dependent term f1.
ea_params (list or tuple) – activation energy [J/mol] value(s) for the temperature-dependent term f1.
rxn_list –
list containing reactions represented by strings, where the pattern ‘+’ separates reactants or products from one another, and the pattern –> separates groups of reactants from groups of products. Examples of reactions are
’A + B –> C’ ‘2A –> B’ ‘2 H2 O –> 2 H2 + O2’, ‘H2 O –> H2 + 0.5 O2, ‘H2 O –> H2 + 0.5 O2’
- stoiciometric_matrixnumpy array, optional
stoichiometric matrix for the set of reactions. It must have n_rxn rows and n_comp columns, so the element (i, j) represents the coefficient of species j in reaction i
- partic_specieslist (or tuple) of str, optional
names of participating species. It will be assumed that the order of the names in ‘partic_species’ is that of the columns of ‘stoichiometric_matrix’. The passed names must match those in the pure-component json file
- keq_paramsTYPE, optional
DESCRIPTION. The default is None.
- params_fnumpy array, optional
parameters for the concentration-dependent term f2. If no custom model is provided through the ‘kinetic_model’ argument, then ‘params_f’ values are interpreted as the reaction orders of the built-in elementary reaction kinetic model. The params_f argument is optional only if no custom model is provided. If not given, the reaction orders are set to the stoichiometric coefficients for the involved reactants. The default is None.
- temp_reffloat, optional
reference temperature [K]. If not passed, it will be set to np.inf. The default is None.
- reformulate_kinbool, optional
if True, f1 (T) will be reformulated as:
f1 (T) = exp[phi1 + exp(phi2) * (1/T_ref - 1/T)]
where phi1 = ln(kii) - Ea/R/T_ref and phi2 = ln(Ea/R) We recommend to use this reparametrization when performing parameter estimation with datasets at different temperatures. The default is False.
- delta_hrxnfloat, optional
DESCRIPTION. The default is 0.
- tref_hrxnfloat, optional
DESCRIPTION. The default is 298.15.
- kinetic_modelcallable, optional
kinetic model to be used to compute f2. It must have the signature:
>>> kin_model(conc, params, *args). The default is None.
- df_dstatesTYPE, optional
DESCRIPTION. The default is None.
- df_dthetaTYPE, optional
DESCRIPTION. The default is None.
- Return type:
RxnKinetics object.
- concat_params()
- derivatives(conc, temp, dstates=True)
- dk_dkparams(temp)
- elem_df_dstates(conc)
- elem_df_dtheta(conc)
- elem_f_model(conc, rxn_orders)
Compute elementary reaction rates for each participating reaction
- Parameters:
conc (array-like) – molar concentrations for each participating species (size n_comp)
- Returns:
rxn_rates (array) – rate for each reaction taking place in the system (size n_rxns)
rates_species (array) – rate for each species in each reaction (size n_rxns x n_comp)
total_rates (array) – net reaction rate for each component among all the reactions it participates in (size n_comp)
- equil_term(temp, deltah_temp)
- equilibrium_model(conc, temp, deltah_rxn)
- get_rxn_rates(conc, temp=298.15, overall_rates=True, jac=False, delta_hrxn=None)
- nomenclature(stoich_matrix, kvals)
- set_params(params)
- temp_term(temp)
- transform_params(kvals, evals)
- PharmaPy.Kinetics.cryst_mechanism(sup_sat, moms, temp, temp_ref, params, reformulate, kv, order)
- PharmaPy.Kinetics.disect_rxns(rxns, sep='-->')
- PharmaPy.Kinetics.get_coeff(pattern, expr)
- PharmaPy.Kinetics.get_stoich(di_rxn, partic_species)