From b4366b618e7cefabd85451bce51ae2f4e508fe9a Mon Sep 17 00:00:00 2001 From: Richard West Date: Thu, 22 Oct 2020 16:58:05 -0400 Subject: [PATCH] Log the problem reaction if it causes an error making a species. 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. --- rmgpy/rmg/model.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rmgpy/rmg/model.py b/rmgpy/rmg/model.py index ff0c3de9260..1e425105992 100644 --- a/rmgpy/rmg/model.py +++ b/rmgpy/rmg/model.py @@ -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]