I'm testing out the uncertainty tool. I generate a mechanism in RMG and then try to load the database using rmgpy.uncertainty.load_database() and a few families crash when trying to average up the kinetics trees:
This is especially frustrating because I don't even care about those families, they're just part of the default set.
WARNING:root:No reactions matched the specified template, frozenset({'R5JJ_Cd'})
ERROR:root:Reactant: Species(label="", molecule=[Molecule(smiles="C=C1[CH]C2C=CC=C[C]2C1"), Molecule(smiles="C=C1[CH]C2C=C[CH]C=C2C1"), Molecule(smiles="[CH2]C1=CC2C=CC=C[C]2C1"), Molecule(smiles="[CH2]C1=CC2C=C[CH]C=C2C1"), Molecule(smiles="C=C1[CH]C2[CH]C=CC=C2C1"), Molecule(smiles="[CH2]C1=CC2[CH]C=CC=C2C1")], molecular_weight=(130.186,'amu'))
ERROR:root:Product: Molecule(smiles="C=C=CC1C=CC=CC1=C")
---------------------------------------------------------------------------
KineticsError Traceback (most recent call last)
Cell In[6], line 84
80 print('Kinetics Libraries:', kinetics_libs)
81 print('Kinetics Families:', kinetics_families)
---> 84 uncertainty.load_database( # this call does the averaging up of kinetics families
85 thermo_libraries=thermo_libs,
86 kinetics_families=kinetics_families,
87 reaction_libraries=kinetics_libs,
88 )
File ~/rmg/RMG-Py/rmgpy/tools/uncertainty.py:418, in Uncertainty.load_database(self, kinetics_families, kinetics_depositories, thermo_libraries, reaction_libraries)
416 for familyLabel, family in self.database.kinetics.families.items():
417 if not family.auto_generated:
--> 418 family.add_rules_from_training(thermo_database=self.database.thermo)
419 family.fill_rules_by_averaging_up(verbose=True)
File ~/rmg/RMG-Py/rmgpy/data/kinetics/family.py:1276, in KineticsFamily.add_rules_from_training(self, thermo_database, train_indices)
1273 template = self.get_reaction_template(item)
1275 item.template = self.get_reaction_template_labels(item)
-> 1276 new_degeneracy = self.calculate_degeneracy(item)
1278 if isinstance(entry.data, SurfaceArrhenius):
1279 data = SurfaceArrheniusBEP(
1280 # analogous to Arrhenius.to_arrhenius_ep
1281 A=deepcopy(data.A),
(...)
1287 coverage_dependence=deepcopy(data.coverage_dependence),
1288 )
File ~/rmg/RMG-Py/rmgpy/data/kinetics/family.py:1935, in KineticsFamily.calculate_degeneracy(self, reaction, resonance)
1933 for product in reaction.products:
1934 logging.error("Product: {0!r}".format(product))
-> 1935 raise KineticsError(('Unable to calculate degeneracy for reaction {0} '
1936 'in reaction family {1}. Expected 1 reaction '
1937 'but generated {2}').format(reaction, self.label, len(reactions)))
1938 return reactions[0].degeneracy
KineticsError: Unable to calculate degeneracy for reaction C=C1[CH]C2C=CC=C[C]2C1 <=> <Molecule "C=C=CC1C=CC=CC1=C"> in reaction family 1,4_Cyclic_birad_scission. Expected 1 reaction but generated 0
This shouldn't crash.
Bug Description
I'm testing out the uncertainty tool. I generate a mechanism in RMG and then try to load the database using
rmgpy.uncertainty.load_database()and a few families crash when trying to average up the kinetics trees:This is especially frustrating because I don't even care about those families, they're just part of the default set.
How To Reproduce
input.txt
Then try loading the database with the uncertainty tool.
Expected Behavior
This shouldn't crash.
Installation Information
Uncertainty tool development branch
https://github.com/sevyharris/RMG-Py/tree/uncertainty_tool_20250929