Skip to content

Commit

Permalink
added test for reverse_sticking_coeff_rate method
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfarinajr committed Feb 19, 2021
1 parent fec029f commit 8be14db
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions rmgpy/reactionTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import cantera as ct
import numpy
from external.wip import work_in_progress
from copy import deepcopy

import rmgpy.constants as constants
from rmgpy.kinetics import Arrhenius, ArrheniusEP, MultiArrhenius, PDepArrhenius, MultiPDepArrhenius, \
Expand Down Expand Up @@ -269,6 +270,29 @@ def test_equilibrium_constant_surface_kc(self):
for i in range(len(Tlist)):
self.assertAlmostEqual(Kclist[i] / Kclist0[i], 1.0, 4)

def test_reverse_sticking_coeff_rate(self):
"""
Test the Reaction.reverse_sticking_coeff_rate() method works for StickingCoefficient format.
"""

original_kinetics = self.rxn2sSC.kinetics
rxn_copy = deepcopy(self.rxn2sSC)
reverse_kinetics = self.rxn2sSC.generate_reverse_rate_coefficient(surface_site_density=2.5e-5)

rxn_copy.kinetics = reverse_kinetics
# reverse reactants, products to ensure Keq is correctly computed
rxn_copy.reactants, rxn_copy.products = rxn_copy.products, rxn_copy.reactants
reverse_reverse_kinetics = rxn_copy.generate_reverse_rate_coefficient(surface_site_density=2.5e-5)
rxn_copy.kinetics = reverse_reverse_kinetics

# check that reverting the reverse yields the original
Tlist = numpy.arange(original_kinetics.Tmin.value_si, original_kinetics.Tmax.value_si, 200.0, numpy.float64)
P = 0
for T in Tlist:
korig = self.rxn2sSC.get_rate_coefficient(T, P, surface_site_density=2.5e-5)
krevrev = rxn_copy.get_rate_coefficient(T, P, surface_site_density=2.5e-5)
self.assertAlmostEqual(korig / krevrev, 1.0, 0)

class TestReaction(unittest.TestCase):
"""
Contains unit tests of the Reaction class.
Expand Down

0 comments on commit 8be14db

Please sign in to comment.