Skip to content

Conversation

Copy link

Copilot AI commented Oct 16, 2025

Problem

The rmg_kinetics.py script had two issues affecting the accuracy of kinetic rate coefficient calculations:

  1. Double multiplication of the A factor by degeneracy: The code was multiplying the rate coefficient by degeneracy twice - once internally in family.get_kinetics() (which accepts a degeneracy parameter) and again explicitly via kinetics.change_rate(deg_rxn.degeneracy). This resulted in incorrect rate coefficients.

  2. Missing training rules incorporation: When loading the RMG database, training rules were not being added to kinetics families, which could result in incomplete kinetic data.

Changes

1. Removed duplicate degeneracy multiplication (line 101)

# Before
kinetics_list = family.get_kinetics(reaction=deg_rxn, template_labels=deg_rxn.template, degeneracy=deg_rxn.degeneracy)
for kinetics_detailes in kinetics_list:
    kinetics = kinetics_detailes[0]
    kinetics.change_rate(deg_rxn.degeneracy)  # ❌ Double multiplication!
    if hasattr(kinetics, 'to_arrhenius'):
        ...

# After
kinetics_list = family.get_kinetics(reaction=deg_rxn, template_labels=deg_rxn.template, degeneracy=deg_rxn.degeneracy)
for kinetics_detailes in kinetics_list:
    kinetics = kinetics_detailes[0]
    if hasattr(kinetics, 'to_arrhenius'):  # ✅ Degeneracy already applied
        ...

2. Added training rules to kinetics families

def load_rmg_database() -> RMGDatabase:
    rmgdb = RMGDatabase()
    ...
    rmgdb.load_kinetics(path=os.path.join(DB_PATH, 'kinetics'),
                        reaction_libraries=kinetics_libraries,
                        kinetics_families='default',
                        kinetics_depositories=['training'])
    # Add training rules to each family
    for family in rmgdb.kinetics.families.values():
        family.add_rules_from_training(rmgdb)
    return rmgdb

Impact

  • Kinetic rate coefficients will now have the correct A factor values (not multiplied by degeneracy twice)
  • Kinetics families will include rules derived from training data, providing more complete and accurate kinetic estimates
Original prompt

In the rmg_kinetics.py file, we need to make changes. We need to remove the line 'kin.change_rate(cand.degeneracy)' because that just multiplies the A twice before output. In the load RMG database section we need to call on 'for family in rmgdb.kinetics.families.values(): family.add_rules_from_training(rmgdb)
I think we need to loop, I am not sure.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: calvinp0 <56573970+calvinp0@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove duplicate rate multiplication and update RMG database Fix duplicate degeneracy multiplication and add training rules to kinetics families Oct 16, 2025
Copilot AI requested a review from calvinp0 October 16, 2025 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants