Skip to content

Commit cb89d46

Browse files
committed
added method to convert StickingCoeff kinetics to SurfaceArrhenius
1 parent 2efc4e5 commit cb89d46

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

rmgpy/reaction.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ cdef class Reaction:
101101

102102
cpdef surface_arrhenius_to_sticking_coeff(self, double surface_site_density, Tmin=?, Tmax=?)
103103

104+
cpdef sticking_coeff_to_surface_arrhenius(self, double surface_site_density, Tmin=?, Tmax=?)
105+
104106
cpdef fix_barrier_height(self, bint force_positive=?)
105107

106108
cpdef reverse_arrhenius_rate(self, Arrhenius k_forward, str reverse_units, Tmin=?, Tmax=?)

rmgpy/reaction.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,46 @@ def surface_arrhenius_to_sticking_coeff(self, surface_site_density, Tmin=None, T
786786
kf.fit_to_data(Tlist, klist, "", kf.T0.value_si)
787787
return kf
788788

789+
def sticking_coeff_to_surface_arrhenius(self, surface_site_density, Tmin=None, Tmax=None):
790+
"""
791+
Converts `StickingCoefficient` kinetics to `SurfaceArrhenius` kinetics using the provided
792+
`surface_site_density` in SI units (mol/m^2). The reaction's kinetics type must but be
793+
`StickingCoefficent`.
794+
795+
Returns:
796+
`SurfaceArrhenius` kinetics
797+
"""
798+
cython.declare(kf=SurfaceArrhenius)
799+
cython.declare(Tlist=np.ndarray, klist=np.ndarray, i=cython.int)
800+
if not isinstance(self.kinetics, StickingCoefficient):
801+
raise TypeError(f'Expected a Sticking Coeff object but received {self.kinetics}')
802+
803+
# Get the units for the reverse rate coefficient
804+
try:
805+
surf_reacts = [spcs for spcs in self.reactants if spcs.contains_surface_site()]
806+
except IndexError:
807+
raise KineticsError("Species do not have an rmgpy.molecule.Molecule."
808+
"Cannot determine units for rate coefficient.")
809+
n_surf = len(surf_reacts)
810+
n_gas = len(self.reactants) - len(surf_reacts)
811+
kunits = get_rate_coefficient_units_from_reaction_order(n_gas, n_surf)
812+
813+
# generate temperature array to evaluate the rate coeff
814+
if Tmin is not None and Tmax is not None:
815+
Tlist = 1.0 / np.linspace(1.0 / Tmax.value, 1.0 / Tmin.value, 50)
816+
else:
817+
Tlist = 1.0 / np.arange(0.0005, 0.0034, 0.0001)
818+
819+
# Determine the values of the rate coeff k_f(T) at each temperature
820+
klist = np.zeros_like(Tlist)
821+
for i in range(len(Tlist)):
822+
klist[i] = self.get_surface_rate_coefficient(Tlist[i], surface_site_density)
823+
824+
# create Surface Arrh kinetics and fit to rate coeff array
825+
kf = SurfaceArrhenius()
826+
kf.fit_to_data(Tlist, klist, kunits)
827+
return kf
828+
789829
def fix_diffusion_limited_a_factor(self, T):
790830
"""
791831
Decrease the pre-exponential factor (A) by the diffusion factor

0 commit comments

Comments
 (0)