Skip to content

Commit

Permalink
Extra error logging in HBI thermo estimation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwest authored and ssun30 committed May 8, 2024
1 parent e8c0e76 commit 70e00db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions rmgpy/data/thermo.py
Expand Up @@ -2049,8 +2049,12 @@ def estimate_radical_thermo_via_hbi(self, molecule, stable_thermo_estimator):
"not {0}".format(thermo_data_sat))
thermo_data_sat = thermo_data_sat[0]
else:
thermo_data_sat = stable_thermo_estimator(saturated_struct)

try:
thermo_data_sat = stable_thermo_estimator(saturated_struct)
except DatabaseError as e:
logging.error(f"Trouble finding thermo data for saturated structure {saturated_struct.to_adjacency_list()}"
f"when trying to evaluate radical {molecule.to_adjacency_list()} via HBI.")
raise
if thermo_data_sat is None:
# We couldn't get thermo for the saturated species from libraries, ml, or qm
# However, if we were trying group additivity, this could be a problem
Expand Down Expand Up @@ -2555,9 +2559,10 @@ def _add_group_thermo_data(self, thermo_data, database, molecule, atom):
node = node0
while node is not None and node.data is None:
node = node.parent
if node is None:
if node is None:
raise DatabaseError(f'Unable to determine thermo parameters for atom {atom} in molecule {molecule}: '
f'no data for node {node0} or any of its ancestors in database {database.label}.')
f'no data for node {node0} or any of its ancestors in database {database.label}.\n' +
molecule.to_adjacency_list())

data = node.data
comment = node.label
Expand Down
6 changes: 5 additions & 1 deletion rmgpy/rmg/model.py
Expand Up @@ -810,7 +810,11 @@ def process_new_reactions(self, new_reactions, new_species, pdep_network=None, g
Makes a reaction and decides where to put it: core, edge, or PDepNetwork.
"""
for rxn in new_reactions:
rxn, is_new = self.make_new_reaction(rxn, generate_thermo=generate_thermo, generate_kinetics=generate_kinetics)
try:
rxn, is_new = self.make_new_reaction(rxn, generate_thermo=generate_thermo, generate_kinetics=generate_kinetics)
except Exception as e:
logging.error(f"Error when making reaction {rxn} from {rxn.family}")
raise
if rxn is None:
# Skip this reaction because there was something wrong with it
continue
Expand Down

0 comments on commit 70e00db

Please sign in to comment.