Skip to content

Commit 8b33eba

Browse files
rwestssun30
authored andcommitted
Extra error logging in HBI thermo estimation.
1 parent dc1ce4c commit 8b33eba

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

rmgpy/data/thermo.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,8 +2064,12 @@ def estimate_radical_thermo_via_hbi(self, molecule, stable_thermo_estimator):
20642064
"not {0}".format(thermo_data_sat))
20652065
thermo_data_sat = thermo_data_sat[0]
20662066
else:
2067-
thermo_data_sat = stable_thermo_estimator(saturated_struct)
2068-
2067+
try:
2068+
thermo_data_sat = stable_thermo_estimator(saturated_struct)
2069+
except DatabaseError as e:
2070+
logging.error(f"Trouble finding thermo data for saturated structure {saturated_struct.to_adjacency_list()}"
2071+
f"when trying to evaluate radical {molecule.to_adjacency_list()} via HBI.")
2072+
raise
20692073
if thermo_data_sat is None:
20702074
# We couldn't get thermo for the saturated species from libraries, ml, or qm
20712075
# However, if we were trying group additivity, this could be a problem
@@ -2570,9 +2574,10 @@ def _add_group_thermo_data(self, thermo_data, database, molecule, atom):
25702574
node = node0
25712575
while node is not None and node.data is None:
25722576
node = node.parent
2573-
if node is None:
2577+
if node is None:
25742578
raise DatabaseError(f'Unable to determine thermo parameters for atom {atom} in molecule {molecule}: '
2575-
f'no data for node {node0} or any of its ancestors in database {database.label}.')
2579+
f'no data for node {node0} or any of its ancestors in database {database.label}.\n' +
2580+
molecule.to_adjacency_list())
25762581

25772582
data = node.data
25782583
comment = node.label

rmgpy/rmg/model.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,11 @@ def process_new_reactions(self, new_reactions, new_species, pdep_network=None, g
811811
Makes a reaction and decides where to put it: core, edge, or PDepNetwork.
812812
"""
813813
for rxn in new_reactions:
814-
rxn, is_new = self.make_new_reaction(rxn, generate_thermo=generate_thermo, generate_kinetics=generate_kinetics)
814+
try:
815+
rxn, is_new = self.make_new_reaction(rxn, generate_thermo=generate_thermo, generate_kinetics=generate_kinetics)
816+
except Exception as e:
817+
logging.error(f"Error when making reaction {rxn} from {rxn.family}")
818+
raise
815819
if rxn is None:
816820
# Skip this reaction because there was something wrong with it
817821
continue

0 commit comments

Comments
 (0)