rmgpy.molecule.kekulize

This module contains functions for kekulization of a aromatic molecule. The only function that should be used outside of this module is the main kekulize() function. The remaining functions and classes are designed only to support the kekulization algorithm, and should not be used on their own.

The basic algorithm is as follows: 1. Identify all aromatic rings in the molecule, based on bond types. 2. For each ring, identify endocyclic and exocyclic bonds. 3. Determine if any bonds in the ring are already defined (not benzene bonds). 4. For the remaining bonds, determine whether or not they can be double bonds. 5. If a clear determination cannot be made, make heuristic based assumption. 6. Continue until all bonds in the ring are determined. 7. Continue until all rings in the molecule are determined.

Here, endo refers to bonds that comprise a given ring, while exo refers to bonds that are connected to atoms in the ring, but not part of the ring itself.

A key part of the algorithm is use of degree of freedom (DOF) analysis in order to determine the optimal order to solve the system. Rings and bonds with fewer DOFs have fewer ways to be to be kekulized, and are generally easier to solve. Each ring or bond that is fixed reduces the DOF of adjacent rings and bonds, and the process continues until the entire molecule can be solved.

class rmgpy.molecule.kekulize.AromaticBond

Helper class containing information about a single aromatic bond in a molecule.

DO NOT use outside of this module. This class does not do any aromaticity perception.

update()

Update the local degree of freedom information for this aromatic bond. The DOF counts do not include the bond itself, only its adjacent bonds.

endo_dof refers to the number of adjacent bonds in the ring without fixed bond orders. exo_dof refers to the number of adjacent bonds outside the ring without fixed bond orders.

class rmgpy.molecule.kekulize.AromaticRing

Helper class containing information about a single aromatic ring in a molecule.

DO NOT use outside of this module. This class does not do any aromaticity perception.

kekulize()

Attempts to kekulize a single aromatic ring in a molecule.

Returns True if successful, and False otherwise.

process_bonds()

Create AromaticBond objects for each endocyclic bond.

update()

Update the degree of freedom information for this aromatic ring.

endo_dof refers to the number of bonds in the ring without fixed bond orders. exo_dof refers to the number of bonds outside the ring without fixed bond orders.

rmgpy.molecule.kekulize.kekulize(mol)

Kekulize an aromatic molecule in place. If the molecule cannot be kekulized, a KekulizationError will be raised. However, the molecule will be left in a semi-kekulized state. Therefore, if the original molecule needs to be kept, it is advisable to create a copy before kekulizing.

Args: Molecule object to be kekulized