rdmc.external.rmg#
A module contains RMG related functions. Needs to run with rmg_env.
- rdmc.external.rmg.check_isomorphic_molecules(mols_1: List[Molecule], mols_2: List[Molecule]) bool#
Check if two lists share the same set of molecules.
- Parameters:
mols_1 (list) – The first set of molecules.
mols_2 (list) – The second set of molecules.
- Returns:
bool – If both sets share exactly same molecules.
- rdmc.external.rmg.find_reaction_family(database: rmgpy.data.kinetics.database.KineticsDatabase, reactants: list, products: list, only_families: list | None = None, unique: bool = True, verbose: bool = True, resonance: bool = True) tuple | None#
A helper function to find reaction families for given reactants and products.txt
- Parameters:
database (KineticsDatabase) – A RMG Kinetics database instance.
reactants (list) – A list of reactant molecules.
products (list) – A list of product molecules.
only_families (list, optional) – A list of family to search from. Defaults to
Nonefor unlimited.unique (bool) – Whether to only return a single results. Defaults to
True.verbose (bool, optional) – Whether to print results. Defaults to print.
resonance (bool) – Whether to generate resonance strucuture when searching for reaction family. Defauls to
`True.
- Returns:
- tuple – (family_label, is_forward) if
unique == True.- None – if no match is found.
- list – [(family_label1, is_foward_1), (family_label2, is_forward2)…] if
unique == False.
- rdmc.external.rmg.from_rdkit_mol(rdkitmol, sort: bool = False, raise_atomtype_exception: bool = True) Molecule#
Convert a RDKit Mol object rdkitmol to a molecular structure. Uses RDKit to perform the conversion. This Kekulizes everything, removing all aromatic atom types.
- rdmc.external.rmg.generate_reaction_complex(database: KineticsDatabase, reactants: list, products: list, only_families: list | None = None, forward: bool | None = None, verbose: bool = True, resonance: bool = True) List[Molecule]#
Generate a pair of reactant and product complex according to RMG reaction family.
It will first match the given reactant and product pairs to a family (by calling
find_reaction_family). Then, it will form a reactant complexes based on the reactants list. Finally, it will apply the template corresponding to the family to the reactants complex and yield a product complex with the correct atom map. One can bypasses the searching step by providingonly_familieswith a single-element list and assigning the forward variable. All allowed families names can be found at https://rmg.mit.edu/database/kinetics/families/. Please note that this function currently only returns the first template it finds. This is non-idea if a nominal reaction has multiple channels. # TODO: provide an option if multiple channel if available.- Parameters:
database (KineticsDatabase) – An RMG Kinetics database instance.
reactants (list) – A list of reactant molecules.
products (list) – A list of product molecules.
only_families (list) – A list of families that constrains the search. Defaults to
Nonefor no constraint. Ifonly_familiescontains only one family and forward is specified, the function assumes the user is only interested in the specific reaction family and will skip thefind_reaction_familystep.forward (bool) – Whether the reaction is forward or not. Only used if a user wants to skip the
find_reaction_familystep and assigns an one-element list toonly_families. Defaults toNone, for not skipping thefind_reaction_familystep.resonance (bool) – Generate resonance structures when identifying template matching. Can be potentially expensive for some complicated structures. Defaults to
True.verbose (bool, optional) – Whether to print results. Defaults to
Trueas to print.
- Returns:
Tuple – a reactant complex and a product complex with consistent atom indexing as in the reactant.
- rdmc.external.rmg.load_rmg_database(families: list = [], all_families: bool = False)#
A helper function to load RMG database.
- Returns:
RMGDatabase – A instance of RMG database
- rdmc.external.rmg.load_rxn_family_database(families: list | str = 'all')#
A helper function to load RMG Kinetic database that only contains reaction family info.
- Parameters:
families (list, optional) – Accepts a list or str of the following: - Specific kinetics family labels - Names of family sets defined in recommended.py - ‘all’ - ‘none’. Defaults to ‘all’.