7.1 OEAddDepictionHydrogens

bool OEAddDepictionHydrogens(OEMolBase &mol)

This function adds explicit ``depiction'' hydrogens to the specified OEMolBase. Depiction hydrogens are hydrogens that need to be explicitly drawn in a 2D depiction to faithfully represent tetrahedral stereochemistry. A depiction hydrogen is currently defined as the single hydrogen attached to a non-hydrogen atom that has tetrahedral chirality specified and either has only two non-hydrogen neighbors, or has three non-hydrogen neighbors that are connected via cyclic ``ring'' bonds. See the definition of OEHasDepictionHydrogens below. For example, the hydrogens on the fusion atoms of decalin are depiction hydrogens.

The OEAddDepictionHydrogens function identifies all implicit depiction hydrogens (using the OEHasDepictionHydrogens function), and converts them into explicit hydrogens using the OEAddExplicitHydrogens function. This function returns true if any depiction hydrogens were converted into explicit atoms.

bool OEAddDepictionHydrogens(OEMolBase &mol)
{
  bool result = false;
  OEIter<OEAtomBase> atom;
  for (atom=mol.GetAtoms(); atom; ++atom)
  {
    OEAtomBase *aptr = atom;
    if (OEHasDepictionHydrogens(aptr) &&
        OEAddExplicitHydrogens(mol,aptr))
      result = true;
  }
  return result;
}