12.1 Cycle Membership

The simplest form of ring processing in OEChem is testing for ring/cycle membership. The OEChem function OEFindRingAtomsAndBonds is used to determine which atoms and bonds are members of one or more cycles and which are acyclic. This function uses an efficient O(n) algorithm. Once OEFindRingAtomsAndBonds has been called, an atom or bond can be tested for being in a ring by calling either the OEAtomBase IsInRing or the OEBondBase IsInRing methods respectively.

Because of this it is common to test IsInRing (or aromaticity) in user applications, the function OEFindRingAtomsAndBonds is called automatically by the high-level file I/O functions (including OEChem oemolistream GetOEMols method or OEReadMolecule). However, whenever you modify a molecule by adding or deleting bonds, you'll need to call OEFindFingAtomsAndBonds.