# rmgpy.data.kinetics.KineticsLibrary¶

class rmgpy.data.kinetics.KineticsLibrary(label='', name='', solvent=None, short_desc='', long_desc='', auto_generated=False)

A class for working with an RMG kinetics library.

ancestors(node)

Returns all the ancestors of a node, climbing up the tree to the top.

are_siblings(node, node_other)

Return True if node and node_other have the same parent node. Otherwise, return False. Both node and node_other must be Entry types with items containing Group or LogicNode types.

check_for_duplicates(mark_duplicates=False)

Check that all duplicate reactions in the kinetics library are properly marked (i.e. with their duplicate attribute set to True). If mark_duplicates is set to True, then ignore and mark all duplicate reactions as duplicate.

convert_duplicates_to_multi()

Merge all marked duplicate reactions in the kinetics library into single reactions with multiple kinetics.

descend_tree(structure, atoms, root=None, strict=False)

Descend the tree in search of the functional group node that best matches the local structure around atoms in structure.

If root=None then uses the first matching top node.

Returns None if there is no matching root.

Set strict to True if all labels in final matched node must match that of the structure. This is used in kinetics groups to find the correct reaction template, but not generally used in other GAVs due to species generally not being prelabeled.

descendants(node)

Returns all the descendants of a node, climbing down the tree to the bottom.

generate_old_tree(entries, level)

Generate a multi-line string representation of the current tree using the old-style syntax.

get_entries_to_save()

Return a sorted list of the entries in this database that should be saved to the output file.

Then renumber the entry indexes so that we never have any duplicate indexes.

get_library_reactions()

makes library and template reactions as appropriate from the library comments and returns at list of all of these LibraryReaction and TemplateReaction objects

get_species(path, resonance=True)

Load the dictionary containing all of the species in a kinetics library or depository.

load(path, local_context=None, global_context=None)

Load an RMG-style database from the file at location path on disk. The parameters local_context and global_context are used to provide specialized mapping of identifiers in the input file to corresponding functions to evaluate. This method will automatically add a few identifiers required by all data entries, so you don’t need to provide these.

load_entry(index, label, kinetics, degeneracy=1, duplicate=False, reversible=True, reference=None, referenceType='', shortDesc='', longDesc='', allow_pdep_route=False, elementary_high_p=False, allow_max_rate_violation=False, metal=None, site=None, facet=None)

Method for parsing entries in database files. Note that these argument names are retained for backward compatibility.

load_old(path)

Load an old-style RMG kinetics library from the location path.

load_old_dictionary(path, pattern)

Parse an old-style RMG database dictionary located at path. An RMG dictionary is a list of key-value pairs of a one-line string key and a multi-line string value. Each record is separated by at least one empty line. Returns a dict object with the values converted to Molecule or Group objects depending on the value of pattern.

load_old_library(path, num_parameters, num_labels=1)

Parse an RMG database library located at path.

load_old_tree(path)

Parse an old-style RMG database tree located at path. An RMG tree is an n-ary tree representing the hierarchy of items in the dictionary.

mark_valid_duplicates(reactions1, reactions2)

Check for reactions that appear in both lists, and mark them as (valid) duplicates.

match_node_to_child(parent_node, child_node)

Return True if parent_node is a parent of child_node. Otherwise, return False. Both parent_node and child_node must be Entry types with items containing Group or LogicNode types. If parent_node and child_node are identical, the function will also return False.

match_node_to_node(node, node_other)

Return True if node and node_other are identical. Otherwise, return False. Both node and node_other must be Entry types with items containing Group or LogicNode types.

match_node_to_structure(node, structure, atoms, strict=False)

Return True if the structure centered at atom matches the structure at node in the dictionary. The structure at node should have atoms with the appropriate labels because they are set on loading and never change. However, the atoms in structure may not have the correct labels, hence the atoms parameter. The atoms parameter may include extra labels, and so we only require that every labeled atom in the functional group represented by node has an equivalent labeled atom in structure.

Matching to structure is more strict than to node. All labels in structure must be found in node. However the reverse is not true, unless strict is set to True.

Attribute

Description

node

Either an Entry or a key in the self.entries dictionary which has a Group or LogicNode as its Entry.item

structure

A Group or a Molecule

atoms

Dictionary of {label: atom} in the structure. A possible dictionary is the one produced by structure.get_all_labeled_atoms()

strict

If set to True, ensures that all the node’s atomLabels are matched by in the structure

parse_old_library(path, num_parameters, num_labels=1)

Parse an RMG database library located at path, returning the loaded entries (rather than storing them in the database). This method does not discard duplicate entries.

remove_group(group_to_remove)

Removes a group that is in a tree from the database. In addition to deleting from self.entries, it must also update the parent/child relationships

Returns the removed group

save(path)

Save the current database to the file at location path on disk.

save_dictionary(path)

Extract species from all entries associated with a kinetics library or depository and save them to the path given.

save_entry(f, entry)

Write the given entry in the kinetics library to the file object f.

save_old(path)

Save an old-style reaction library to path. This creates files named species.txt, reactions.txt, and pdepreactions.txt in the given directory; these contain the species dictionary, high-pressure limit reactions and kinetics, and pressure-dependent reactions and kinetics, respectively.

save_old_dictionary(path)

Save the current database dictionary to a text file using the old-style syntax.

save_old_library(path)

Save the current database library to a text file using the old-style syntax.

save_old_tree(path)

Save the current database tree to a text file using the old-style syntax.