Skip to content

Commit

Permalink
Log the problem reaction if it causes an error making a species.
Browse files Browse the repository at this point in the history
If there's a problem making a species or estimating its thermochemistry
it can be helpful to know where the species came from to help debugging.
This will report the reaction that was being processed when the species was made
and where it came from, e.g. the kinetics library, seed mechanism, or reaction family.
Then it will raise the original error as if nothing happened.
Helps address #2030.
  • Loading branch information
rwest committed Oct 22, 2020
1 parent d3a8295 commit b4366b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rmgpy/rmg/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,12 @@ def make_new_reaction(self, forward, check_existing=True, generate_thermo=True):
"""

# Determine the proper species objects for all reactants and products
reactants = [self.make_new_species(reactant, generate_thermo=generate_thermo)[0] for reactant in forward.reactants]
products = [self.make_new_species(product, generate_thermo=generate_thermo)[0] for product in forward.products]
try:
reactants = [self.make_new_species(reactant, generate_thermo=generate_thermo)[0] for reactant in forward.reactants]
products = [self.make_new_species(product, generate_thermo=generate_thermo)[0] for product in forward.products]
except:
logging.error("Error when making species in reaction {forward:s} from {forward.family:s}")
raise
if forward.specific_collider is not None:
forward.specific_collider = self.make_new_species(forward.specific_collider)[0]

Expand Down

0 comments on commit b4366b6

Please sign in to comment.