10.2 Implicit vs. Explicit Hydrogen Atoms

In many chemistry applications its is useful to treat the hydrogen atoms implicitly. Typically, the number of heavy (non-hydrogen) atoms is approximately half the total number of atoms in a molecule. This means that if instead of representing hydrogens explicitly, they are maintained as an implicit hydrogen count associated with each atom, it is possible to halve the amount of memory required to represent a molecule (on average). For applications such as computational chemistry where algorithms are often worse than linear in the number of atoms, this more than doubles their performance. In molecular mechanics, this is often referred to as a ``united atom'' representation of a molecule. Due to its convenience, this is the representation of choice for Daylight SMILES and MDL connection tables.

OEChem supports the united atom representation of molecules, by providing SetImplicitHCount and GetImplicitHCount functions for OEAtomBases. In the example, above it is possible to create and represent a water molecule by an OEMolBase containing only a single OEAtomBase.

#include "oechem.h"

using namespace OEChem;

int main()
{
  OEAtomBase *o;
  OEMol mol;

  o = mol.NewAtom(OEElemNo::O);
  o->SetImplicitHCount(2);
  return 0;
}

To determine whether a molecule is represented by an all atom or united atom representation (or possibly some combination of both, such as polar hydrogens), OEChem provides the two functions OEHasExplicitHydrogens and OEHasImplicitHydrogens.