rmgpy.data.kinetics.KineticsDatabase

class rmgpy.data.kinetics.KineticsDatabase

A class for working with the RMG kinetics database.

extract_source_from_comments(reaction)
reaction: A reaction object containing kinetics data and kinetics data comments.

Should be either a PDepReaction, LibraryReaction, or TemplateReaction object as loaded from the rmgpy.chemkin.load_chemkin_file function

Parses the verbose string of comments from the thermo data of the species object, and extracts the thermo sources.

Returns a dictionary with keys of either ‘Rate Rules’, ‘Training’, ‘Library’, or ‘PDep’. A reaction can only be estimated using one of these methods.

source = {‘RateRules’: (Family_Label, OriginalTemplate, RateRules),

‘Library’: String_Name_of_Library_Used, ‘PDep’: Network_Index, ‘Training’: (Family_Label, Training_Reaction_Entry), }

generate_reactions(reactants, products=None, only_families=None, resonance=True)

Generate all reactions between the provided list of one or two reactants, which should be Molecule objects. This method searches the depository, libraries, and groups, in that order.

generate_reactions_from_families(reactants, products=None, only_families=None, resonance=True)

Generate all reactions between the provided list or tuple of one or two reactants, which can be either Molecule objects or Species objects. This method can apply all kinetics families or a selected subset.

Parameters:
  • reactants – Molecules or Species to react

  • products – List of Molecules or Species of desired product structures (optional)

  • only_families – List of family labels to generate reactions from (optional) Default is to generate reactions from all families

  • resonance – Flag to generate resonance structures for reactants and products (optional) Default is True, resonance structures will be generated

Returns:

List of reactions containing Species objects with the specified reactants and products.

generate_reactions_from_libraries(reactants, products=None)

Find all reactions from all loaded kinetics library involving the provided reactants, which can be either Molecule objects or Species objects.

generate_reactions_from_library(library, reactants, products=None)

Find all reactions from the specified kinetics library involving the provided reactants, which can be either Molecule objects or Species objects.

get_forward_reaction_for_family_entry(entry, family, thermo_database)

For a given entry for a reaction of the given reaction family (the string label of the family), return the reaction with kinetics and degeneracy for the “forward” direction as defined by the reaction family. For families that are their own reverse, the direction the kinetics is given in will be preserved. If the entry contains functional groups for the reactants, assume that it is given in the forward direction and do nothing. Returns the reaction in the direction consistent with the reaction family template, and the matching template. Note that the returned reaction will have its kinetics and degeneracy set appropriately.

In order to reverse the reactions that are given in the reverse of the direction the family is defined, we need to compute the thermodynamics of the reactants and products. For this reason you must also pass the thermo_database to use to generate the thermo data.

load(path, families=None, libraries=None, depositories=None)

Load the kinetics database from the given path on disk, where path points to the top-level folder of the families database.

load_families(path, families=None, depositories=None)

Load the kinetics families from the given path on disk, where path points to the top-level folder of the kinetics families.

The families argument accepts a single item or list of the following:
  • Specific kinetics family labels

  • Names of family sets defined in recommended.py

  • ‘all’

  • ‘none’

If all items begin with a ! (e.g. [‘!H_Abstraction’]), then the selection will be inverted to families NOT in the list.

load_libraries(path, libraries=None)

Load the listed kinetics libraries from the given path on disk.

Loads them all if libraries list is not specified or None. The path points to the folder of kinetics libraries in the database, and the libraries should be in files like <path>/<library>.py.

load_old(path)

Load the old RMG kinetics database from the given path on disk, where path points to the top-level folder of the old RMG database.

Load the recommended families from the given file. The file is usually stored at ‘kinetics/families/recommended.py’.

The old style was as a dictionary named recommendedFamilies containing all family names as keys with True/False values.

The new style is as multiple sets with unique names which can be used individually or in combination.

Both styles can be loaded by this method.

react_molecules(molecules, products=None, only_families=None, prod_resonance=True)

Generate reactions from all families for the input molecules.

reconstruct_kinetics_from_source(reaction, source, fix_barrier_height=False, force_positive_barrier=False)

Reaction is the original reaction with original kinetics. Note that for Library and PDep reactions this function does not do anything other than return the original kinetics…

You must enter source data in the appropriate format such as returned from returned from self.extract_source_from_comments, self-constructed. fix_barrier_height and force_positive_barrier will change the kinetics based on the Reaction.fix_barrier_height function. Return Arrhenius form kinetics if the source is from training reaction or rate rules.

save(path)

Save the kinetics database to the given path on disk, where path points to the top-level folder of the kinetics database.

save_families(path)

Save the kinetics families to the given path on disk, where path points to the top-level folder of the kinetics families.

save_libraries(path)

Save the kinetics libraries to the given path on disk, where path points to the top-level folder of the kinetics libraries.

save_old(path)

Save the old RMG kinetics database to the given path on disk, where path points to the top-level folder of the old RMG database.

Save the recommended families to [path]/recommended.py. The old style was as a dictionary named recommendedFamilies. The new style is as multiple sets with different labels.