Skip to content

Commit

Permalink
Change comparison level for isomorphic_species_list in KineticsFamily
Browse files Browse the repository at this point in the history
Change to level 2 (InChI comparison) for speed in
  __createReaction (to check that reactants and products are different)
  __generateReactions (to match the specified products)
  getLabeledReactantsAndProducts (to match the specified products)
  • Loading branch information
mliu49 committed Jun 19, 2018
1 parent c5afe72 commit f9d2f17
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ def __createReaction(self, reactants, products, is_forward):
"""

# Make sure the products are in fact different than the reactants
if isomorphic_species_lists(reactants, products):
if isomorphic_species_lists(reactants, products, level=2):
return None

# Create and return template reaction object
Expand Down Expand Up @@ -1841,17 +1841,13 @@ def generate_products_and_reactions(order):

products0 = reaction.products[:] if forward else reaction.reactants[:]

# For aromatics, generate aromatic resonance structures to accurately identify isomorphic species
if prod_resonance:
for i, product in enumerate(products0):
if product.isCyclic:
aromaticStructs = generate_aromatic_resonance_structures(product)
if aromaticStructs:
products0[i] = aromaticStructs[0]

# Skip reactions that don't match the given products
if isomorphic_species_lists(products, products0):
rxnList.append(reaction)
if prod_resonance:
if isomorphic_species_lists(products, products0, level=2):
rxnList.append(reaction)
else:
if isomorphic_species_lists(products, products0, level=1):
rxnList.append(reaction)

# Determine the reactant-product pairs to use for flux analysis
# Also store the reaction template (useful so we can easily get the kinetics later)
Expand Down Expand Up @@ -2218,7 +2214,7 @@ def getLabeledReactantsAndProducts(self, reactants, products):
pass
else:
if product_structures is not None:
if isomorphic_species_lists(list(products), list(product_structures)):
if isomorphic_species_lists(list(products), list(product_structures), level=2):
return reactant_structures, product_structures
else:
continue
Expand Down

0 comments on commit f9d2f17

Please sign in to comment.