9. Atom, Bond and Conformer Indices

OEChem assigns each OEAtomBase and each OEBondBase of an OEMolBase and each OEConfBase of an OEMCMolBase an index when it is created. This index can be used to distinguish one OEAtomBase from another, as it is unique amongst OEAtomBases of the same molecule. Atom and bond indices are also stable, meaning a given OEAtomBase will have the same index throughout its lifetime, independent of the reordering of atoms of a molecule, or the creation or deletion of other atoms (with the single exception of the Sweep method of OEMolBases and the SweepConfs method of OEMCMolBases).

Note that atom and bond and conformer indices are not guaranteed to be sequential, or even created sequentially, hence atom indices can't easily be used to retrieve all of the atoms of a molecule. They can however be assumed to be dense small integers greater than or equal to zero and less than GetMaxAtomIdx for atoms (or GetMaxBondIdx for bonds or GetMaxConfIdx for conformers).

Even typing the following idiom may invalidate any chance of support and eliminate any glimmer of respect from OpenEye Scientific Software or the computational chemistry/chemoinformatics community.

// Never ever, ever do this!
OEAtomBase *aptr;
unsigned int i;

for (i=0; i<mol.NumAtoms(); ++i)
{
  aptr = mol.GetAtom(OEHasAtomIdx(i));
  // Pretend that aptr is valid
}

There are far more efficient methods of crashing computer software that should be used instead. OpenEye reserves the right to increase and/or demand additional maintenance and support fees on discovering such abuses, and reserves the right to publish the names of known offenders on our web site and at annual user group meetings. This information is also available to HR departments for aiding hiring and firing decisions upon request.