Aromaticity Perception

Aromaticity and Hückel‘s rule

OEChem‘s aromaticity perception routines are based around the Hückel‘s rule that defines cyclic conjugated systems with \((4N+2)\) number of \(\pi\) electrons as aromatic (where \(N\) is zero or any positive integer).

Aromaticity can be set using the OEAssignAromaticFlags function, which takes an OEMolBase argument. The OEAssignAromaticFlags sets the aromaticity flags on atoms and bonds using an aromaticity model. (For the list of available aromaticity models in OEChem see section Aromaticity Models in OEChem. )

OEGraphMol mol = new OEGraphMol();
oechem.OEParseSmiles(mol, "C1[NH]C=CC=1CO");
oechem.OEAssignAromaticFlags(mol);

Hint

The OESmilesToMol function automatically perceives the aromaticity of the molecule using the default OEAroModel.OpenEye aromaticity model.

The following two code snippets demonstrate how to loop over aromatic atoms using the OEIsAromaticAtom functor and the IsAromatic method of the OEAtomBase class.

for (OEAtomBase atom : mol.GetAtoms(new OEIsAromaticAtom())) {
    System.out.println(atom.GetIdx() + " " +
            oechem.OEGetAtomicSymbol(atom.GetAtomicNum()));
}
for (OEAtomBase atom : mol.GetAtoms()) {
    if (atom.IsAromatic()) {
        System.out.println(atom.GetIdx() + " " +
                oechem.OEGetAtomicSymbol(atom.GetAtomicNum()));
    }
}

The aromatic bonds of a molecule can similarly be accessed using the OEIsAromaticBond functor and the IsAromatic method of the OEBondBase class. For more information about functors see chapter Predicates Functors.

The user can also set the atom and bond aromaticity flags manually using the OEAtomBase.SetAromatic and OEBondBase.SetAromatic methods.

Aromaticity Models in OEChem

The OEAssignAromaticFlags function can also take an aromaticity model constant as an argument to perceive various aromaticity models. The following aromaticity models are available in OEChem:

  1. OpenEye (default model)
  2. Daylight
  3. Tripos
  4. MDL
  5. MMFF

The following table demonstrates the difference between the five available aromaticity models.

../_images/OEAssignAromaticFlags_Table.png

Table footnotes:

[1] Atomic elements such as Te, B, Se are not available in the MMFF and Tripos aromaticity models.

[2] Only two out of the four five-membered rings are recognized as aromatic.

The code in Listing 1 demonstrates how to perceive aromaticity with these available models.

Listing 1: Aromaticity perception with various models

package openeye.docexamples.oechem;

import openeye.oechem.*;

public class Aromaticity {

    static void PerceiveAromaticity(OEMolBase mol, String modelname, int aromodel) {
        oechem.OEAssignAromaticFlags(mol, aromodel);
        StringBuffer cansmi = new StringBuffer();
        oechem.OECreateCanSmiString(cansmi, mol);
        System.out.println(modelname + " : " + cansmi);
    }

    public static void main(String argv[]) {
        OEGraphMol mol = new OEGraphMol();
        oechem.OESmilesToMol(mol, "c1ncncc1c2cocc2-c3[nH]ccc(=O)c3");

        PerceiveAromaticity(mol, "OEAroModelOpenEye ", OEAroModel.OpenEye);
        PerceiveAromaticity(mol, "OEAroModelDaylight", OEAroModel.Daylight);
        PerceiveAromaticity(mol, "OEAroModelTripos  ", OEAroModel.Tripos);
        PerceiveAromaticity(mol, "OEAroModelMMFF    ", OEAroModel.MMFF);
        PerceiveAromaticity(mol, "OEAroModelMDL     ", OEAroModel.MDL);
    }
}

Since these models define aromaticity rules differently, the generated canonical SMILES are depend on the applied aromaticity models. The output of Listing 1 is the following:

OEAroModel::OpenEye  : c1c[nH]c(cc1=O)c2cocc2c3cncnc3
OEAroModel::Daylight : c1c[nH]c(cc1=O)c2cocc2c3cncnc3
OEAroModel::Tripos   : c1c(cncn1)C2=COC=C2C3=CC(=O)C=CN3
OEAroModel::MMFF     : c1c(cncn1)c2cocc2C3=CC(=O)C=CN3
OEAroModel::MDL      : c1c(cncn1)C2=COC=C2C3=CC(=O)C=CN3
../_images/OEAssignAromaticFlags_Difference.png

Example of aromaticity perception with different models

Clearing Aromaticity

The aromatic property of all atoms and bonds in a molecule, can conveniently be cleared (i.e. set to value false) by calling the OEClearAromaticFlags function. This is useful when writing the Kekulé form of a SMILES string, which can be done by calling OEClearAromaticFlags before calling OEKekulize and OECreateSmiString functions.

Listing 2: Clearing aromaticity

package openeye.docexamples.oechem;

import openeye.oechem.*;

public class ClearAromaticity {

    public static void main(String argv[]) {
        OEGraphMol mol = new OEGraphMol();
        oechem.OEParseSmiles(mol, "n1ccncc1");
        StringBuffer smiles = new StringBuffer();
        oechem.OECreateCanSmiString(smiles, mol);
        System.out.println("Canonical smiles : " + smiles);
        oechem.OEClearAromaticFlags(mol);
        oechem.OEKekulize(mol);
        oechem.OECreateCanSmiString(smiles, mol);
        System.out.println("Kekule smiles    : " + smiles);
    }
}

The output of Listing 2 is the following:

Canonical smiles : c1cnccn1
Kekule smiles    : C1=CN=CC=N1

Input/Output Aromaticity

Since OEParseSmiles preserves the aromaticity present (or absent) in the input SMILES string, the OEClearAromaticFlags or the OEAssignAromaticFlags have to be explicitly called to remove or perceive aromaticity in a molecule, respectively. (See examples in Listing 1 and Listing 2)

However, when a molecule is imported from a file with a high-level OEReadMolecule function, atom and bond aromaticity is automatically perceived using the default OEAroModelOpenEye model.

As mentioned before (in section Molecular Property Preservation), the high-level OEWriteMolecule` writer function may automatically update atom and bond properties (including aromaticity) in order to standardize the exported molecules. The following table shows the aromaticity models associated with various file formats.

File Format Default Output Aromaticity Models
OEFormat.CAN OEAroModel.OpenEye
OEFormat.CDX OEAroModel.OpenEye
OEFormat.CSV OEAroModel.OpenEye
OEFormat.FASTA [1]
OEFormat.ISM OEAroModel.OpenEye
OEFormat.MDL OEClearAromaticFlags
OEFormat.MF [1]
OEFormat.MMOD [1]
OEFormat.MOL2 OEAroModel
OEFormat.MOL2H OEAroModel.Tripos
OEFormat.MOPAC [1]
OEFormat.OEB [1]
OEFormat.PDB [1]
OEFormat.SDF OEClearAromaticFlags
OEFormat.SLN OEAroModel.Tripos
OEFormat.SMI OEAroModel.OpenEye
OEFormat.XYZ [1]
OEFormat.INCHI [1]
OEFormat.INCHIKEY [1]

Table footnote:

[1] The aromaticity model is not changed by the associated molecule writer.

The following snippet shows how to overwrite the default aromaticity model of a specific file format.

oemolostream ofs = new oemolostream(".smi");
oechem.OEWriteMolecule(ofs, mol);  // using default OpenEye aromaticity model
int flavor = ofs.GetFlavor(ofs.GetFormat());
flavor |= OEOFlavor.Generic.OEAroModelMDL;
ofs.SetFlavor(ofs.GetFormat(), flavor);
oechem.OEWriteMolecule(ofs, mol);
ofs.close();

This will produce the following output:

c1c[nH]cc1CO
C1=CNC=C1CO

See also