Skip to content

Commit bc78dbb

Browse files
committed
added reaction unit tests for converting sticking to SA and vice versa
1 parent cb89d46 commit bc78dbb

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

rmgpy/reactionTest.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class TestSurfaceReaction(unittest.TestCase):
137137
"""Test surface reactions"""
138138

139139
def setUp(self):
140+
self.surface_site_density = 2.483e-05 # mol/m^2 for Pt111
140141
m_h2 = Molecule().from_smiles("[H][H]")
141142
m_x = Molecule().from_adjacency_list("1 X u0 p0")
142143
m_hx = Molecule().from_smiles("[H][*]")
@@ -313,6 +314,44 @@ def test_reverse_sticking_coeff_rate(self):
313314
krevrev = rxn_copy.get_rate_coefficient(T, P, surface_site_density=2.5e-5)
314315
self.assertAlmostEqual(korig / krevrev, 1.0, 0)
315316

317+
def test_sticking_coefficient_to_surface_arrhenius(self):
318+
"""
319+
Tests that the sticking_coeff_to_surface_arrhenius() method is working properly
320+
"""
321+
arr = self.rxn2sSC.sticking_coeff_to_surface_arrhenius(surface_site_density=self.surface_site_density)
322+
temps = numpy.linspace(200,2000,10)
323+
for temp in temps:
324+
arr_k = arr.get_rate_coefficient(temp)
325+
sc_k = self.rxn2sSC.get_rate_coefficient(temp,surface_site_density=self.surface_site_density)
326+
self.assertAlmostEqual(arr_k,sc_k,6)
327+
328+
def test_surface_arrhenius_to_sticking_coeff(self):
329+
"""
330+
Tests that the surface_arrhenius_to_sticking_coeff() method is working properly
331+
"""
332+
333+
sc = self.rxn2sSA.surface_arrhenius_to_sticking_coeff(surface_site_density=self.surface_site_density)
334+
arr = self.rxn2sSA.kinetics
335+
self.rxn2sSA.kinetics = sc
336+
temps = numpy.linspace(200,2000,10)
337+
for temp in temps:
338+
arr_k = arr.get_rate_coefficient(temp)
339+
sc_k = self.rxn2sSA.get_rate_coefficient(temp,surface_site_density=self.surface_site_density)
340+
self.assertAlmostEqual(arr_k,sc_k,6)
341+
self.rxn2sSA.kinetics = arr
342+
343+
344+
# also test that the max sticking coefficient is 1 if we are converting a super fast Surface Arr rate
345+
arr_too_fast = SurfaceArrhenius(A=(2.7e30, 'cm^3/(mol*s)'), comment="""a super fast rate""")
346+
self.rxn2sSA.kinetics = arr_too_fast
347+
sc = self.rxn2sSA.surface_arrhenius_to_sticking_coeff(surface_site_density=self.surface_site_density)
348+
temps = numpy.linspace(200,2000,10)
349+
for temp in temps:
350+
sc_T = sc.get_sticking_coefficient(temp)
351+
self.assertAlmostEqual(sc_T,1.0,2)
352+
353+
self.rxn2sSA.kinetics = arr
354+
316355
class TestReaction(unittest.TestCase):
317356
"""
318357
Contains unit tests of the Reaction class.

0 commit comments

Comments
 (0)