Skip to content

unexpected families loaded in database #2925

@sevyharris

Description

@sevyharris

Bug Description

I'm trying to load a blank/mostly empty RMG database, but when I specify kinetics_families=[], it doesn't load a database with zero families. It turns out, you have to specify kinetics_families='none'

How To Reproduce

import rmgpy.data.rmg
database = rmgpy.data.rmg.RMGDatabase()
database.load(
    path=rmgpy.settings['database.directory'],
    thermo_libraries=['primaryThermoLibrary'],
    transport_libraries=[],
    reaction_libraries=[],
    seed_mechanisms=[],
    kinetics_families=[],
    kinetics_depositories=[],
    depository=False,
)

# Prepare the database by loading training reactions but not averaging the rate rules
for familyLabel, family in database.kinetics.families.items():
    if not family.auto_generated:
        family.add_rules_from_training(thermo_database=database.thermo)
        family.fill_rules_by_averaging_up(verbose=True)

Expected Behavior

I would expect an empty list to give me the same behavior as 'none' i.e. a database with zero families. Instead, it seems to be loading all the families. Or at least a large number of families.

Installation Information

  • OS: Ubuntu 24.04.4 LTS
  • Installation method: source
  • RMG version information:
    • RMG-Py: 708fecd
    • RMG-database: ecb79707121726295363f92846cfdf88c4d7311d

Additional Context

This is a really petty thing to complain about, but there's a downstream problem where loading the database like this includes surface families, which require a surface library to do the data tree averaging or else you'll get this error that I want to say Jonathan had also run into for some of the RMG website stuff:

---------------------------------------------------------------------------
DatabaseError                             Traceback (most recent call last)
Cell In[28], [line 4](vscode-notebook-cell:?execution_count=28&line=4)
      2 for familyLabel, family in database.kinetics.families.items():
      3     if not family.auto_generated:
----> [4](vscode-notebook-cell:?execution_count=28&line=4)         family.add_rules_from_training(thermo_database=database.thermo)
      5         family.fill_rules_by_averaging_up(verbose=True)

File ~/rmg/RMG-Py/rmgpy/data/kinetics/family.py:1266, in KineticsFamily.add_rules_from_training(self, thermo_database, train_indices)
   1264     product.molecule[0].clear_labeled_atoms()
   1265     product.generate_resonance_structures()
-> [1266](https://file+.vscode-resource.vscode-cdn.net/home/moon/uncertainty_estimator/uncertainty_tool_dev/demos/quadrature/~/rmg/RMG-Py/rmgpy/data/kinetics/family.py:1266)     product.thermo = thermo_database.get_thermo_data(product, training_set=True, metal_to_scale_to=metal)
   1267 # Now that we have the thermo, we can get the reverse k(T)
   1268 item.kinetics = data

File ~/rmg/RMG-Py/rmgpy/data/thermo.py:1295, in ThermoDatabase.get_thermo_data(self, species, metal_to_scale_to, training_set)
   1293 if species.contains_surface_site():
   1294     try:
-> [1295](https://file+.vscode-resource.vscode-cdn.net/home/moon/uncertainty_estimator/uncertainty_tool_dev/demos/quadrature/~/rmg/RMG-Py/rmgpy/data/thermo.py:1295)         thermo0 = self.get_thermo_data_for_surface_species(species)
   1296         metal_to_scale_from = self.adsorption_groups.split('adsorption')[-1]
   1297         if metal_to_scale_from != metal_to_scale_to:

File ~/rmg/RMG-Py/rmgpy/data/thermo.py:1572, in ThermoDatabase.get_thermo_data_for_surface_species(self, species)
   1569         return species.thermo.get_enthalpy(298.0)
   1571 if species.is_surface_site():
...
   1574 logging.debug("Trying to generate thermo for surface species using first of %d resonance isomer(s):",
   1575               len(species.molecule))
   1577 resonance_data = []

DatabaseError: Can't estimate thermo of vacant site. Should be in library (and should be 0).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions