Skip to content

Commit

Permalink
databaseTest checks units for surface reaction libraries
Browse files Browse the repository at this point in the history
Hopefully this is right. Surface rate expressions and their
units are somewhat confusing.
  • Loading branch information
rwest committed Mar 12, 2019
1 parent 42889bb commit d83a8e7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion testing/databaseTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,24 @@ def kinetics_checkRateUnitsAreCorrect(self, database, tag='library'):
k = entry.data
rxn = entry.item
molecularity = len(rxn.reactants)
surface_reactants = sum([1 for s in rxn.reactants if s.containsSurfaceSite()])
try:
if isinstance(k, rmgpy.kinetics.Arrhenius):

if isinstance(k, rmgpy.kinetics.StickingCoefficient):
"Should be dimensionless"
A = k.A
if A.units:
boo = True
logging.error('Reaction {0} from {1} {2}, has invalid units {3}'.format(rxn, tag, database.label, A.units))
elif isinstance(k, rmgpy.kinetics.SurfaceArrhenius):
A = k.A
expected = copy(dimensionalities[molecularity])
# for each surface reactant but one, switch from (m3/mol) to (m2/mol)
expected[pq.m] -= (surface_reactants-1)
if pq.Quantity(1.0, A.units).simplified.dimensionality != expected :
boo = True
logging.error('Reaction {0} from {1} {2}, has invalid units {3}'.format(rxn, tag, database.label, A.units))
elif isinstance(k, rmgpy.kinetics.Arrhenius): # (but not SurfaceArrhenius, which came first)
A = k.A
if pq.Quantity(1.0, A.units).simplified.dimensionality != dimensionalities[molecularity]:
boo = True
Expand Down

0 comments on commit d83a8e7

Please sign in to comment.