10.3 Updating Implicit Hydrogen Counts

For most simple molecules, OEChem can deduce the number of implicit hydrogens that are required to fill the valence on each atom. Provided that the molecule doesn't contain radicals, unusual charge states, under-filled or overfilled valences, the number of implicit hydrogens can be deduced from the atomic number and formal charges on atoms, and the bond orders of the bonds of a molecule.

The function to call to automatically update the implicit hydrogen counts of each atom is called OEAssignMDLHydrogens.

#include "oechem.h"

using namespace OEChem;

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

  o = mol.NewAtom(OEElemNo::O);
  OEAssignMDLHydrogens(mol);
  return 0;
}

The OEAssignMDLHydrogens implements a simple model of valence suitable for guessing the number of hydrogens expected to be present on each atom when the formal charge has correctly been assigned.