From 5b7d66551faad5e8f800b0ee5f7a11bcb7f97511 Mon Sep 17 00:00:00 2001 From: hwpang Date: Tue, 29 Dec 2020 15:00:55 -0500 Subject: [PATCH 1/3] Remove matched labeled_molecule to avoid mismatching --- rmgpy/data/kinetics/family.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rmgpy/data/kinetics/family.py b/rmgpy/data/kinetics/family.py index bd8ac93c3b..9ecdb3857f 100644 --- a/rmgpy/data/kinetics/family.py +++ b/rmgpy/data/kinetics/family.py @@ -2770,6 +2770,7 @@ def add_atom_labels_for_reaction(self, reaction, output_with_resonance=True): if species.is_isomorphic(labeled_molecule, save_order=self.save_order): species.molecule = [labeled_molecule] reaction.products[index] = species + labeled_products.remove(labeled_molecule) break else: raise ActionError('Could not find isomorphic molecule to fit the original product {} from ' @@ -2779,6 +2780,7 @@ def add_atom_labels_for_reaction(self, reaction, output_with_resonance=True): if species.is_isomorphic(labeled_molecule, save_order=self.save_order): species.molecule = [labeled_molecule] reaction.reactants[index] = species + labeled_reactants.remove(labeled_molecule) break else: raise ActionError('Could not find isomorphic molecule to fit the original reactant {} from ' From ee7d88aaa9fa0d09e4301718ccce795706bf8a0c Mon Sep 17 00:00:00 2001 From: hwpang Date: Tue, 29 Dec 2020 15:12:14 -0500 Subject: [PATCH 2/3] Convert A factor to cm mol s unit --- ipython/kinetics_library_to_training_tools.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ipython/kinetics_library_to_training_tools.py b/ipython/kinetics_library_to_training_tools.py index 7c998cc4c8..8192e23a37 100644 --- a/ipython/kinetics_library_to_training_tools.py +++ b/ipython/kinetics_library_to_training_tools.py @@ -33,6 +33,7 @@ import numpy as np import matplotlib.pyplot as plt from IPython.display import display, HTML +from rmgpy.quantity import ScalarQuantity # HTML formatting for output @@ -178,6 +179,15 @@ def process_reactions(database, libraries, families, compare_kinetics=True, show lib_rxn.reactants = fam_rxn.products lib_rxn.products = fam_rxn.reactants + if len(lib_rxn.reactants) == 1: + units = 's^-1' + elif len(lib_rxn.reactants) == 2: + units = 'cm^3/(mol*s)' + elif len(lib_rxn.reactants) == 3: + units = 'cm^6/(mol^2*s)' + A = lib_rxn.kinetics.A + lib_rxn.kinetics.A = ScalarQuantity(value=A.value_si*A.get_conversion_factor_from_si_to_cm_mol_s(),units=units,uncertainty_type=A.uncertainty_type,uncertainty=A.uncertainty_si*A.get_conversion_factor_from_si_to_cm_mol_s()) + if fam_rxn.family in reaction_dict: reaction_dict[fam_rxn.family].append(lib_rxn) else: From 04f618feaa447fb981ee42dfc7ffd7bb0deeae50 Mon Sep 17 00:00:00 2001 From: Hao-Wei Pang Date: Mon, 11 Jan 2021 19:41:31 -0500 Subject: [PATCH 3/3] Change 'all' to 'default' and add family_auto_generated flag --- ipython/kinetics_library_to_training.ipynb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ipython/kinetics_library_to_training.ipynb b/ipython/kinetics_library_to_training.ipynb index ec66a23a29..1bb4ce34d7 100644 --- a/ipython/kinetics_library_to_training.ipynb +++ b/ipython/kinetics_library_to_training.ipynb @@ -20,7 +20,7 @@ "# Set libraries to load reactions from; set to None to load all libraries\n", "libraries = ['vinylCPD_H']\n", "\n", - "# Set families to add training reactions to; either 'all' or a list, e.g. ['R_Addition_MultipleBond']\n", + "# Set families to add training reactions to; either 'default' or a list, e.g. ['R_Addition_MultipleBond']\n", "families = ['Intra_R_Add_Endocyclic']\n", "\n", "# Specify whether to plot kinetics comparisons\n", @@ -73,8 +73,9 @@ "# If we want accurate kinetics comparison, add existing training reactions and fill tree by averaging\n", "if compare_kinetics:\n", " for family in database.kinetics.families.values():\n", - " family.add_rules_from_training(thermo_database=database.thermo)\n", - " family.fill_rules_by_averaging_up(verbose=verbose_comments)" + " if not family.auto_generated:\n", + " family.add_rules_from_training(thermo_database=database.thermo)\n", + " family.fill_rules_by_averaging_up(verbose=verbose_comments)" ] }, { @@ -94,7 +95,7 @@ "source": [ "master_dict, multiple_dict = process_reactions(database,\n", " libraries,\n", - " families,\n", + " list(database.kinetics.families.keys()),\n", " compare_kinetics=compare_kinetics,\n", " show_all=show_all,\n", " filter_aromatic=filter_aromatic)" @@ -213,9 +214,9 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [conda env:rmg_env]", + "display_name": "Python 3", "language": "python", - "name": "conda-env-rmg_env-py" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -227,7 +228,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.7.7" } }, "nbformat": 4,