bool OEAddExplicitHydrogens(OEMol &mol, bool polarOnly=false, bool set3D=true)
bool OEAddExplicitHydrogens(OEMolBase &mol, bool polarOnly=false,
                            bool set3D=true)
bool OEAddExplicitHydrogens(OEMCMolBase &mol, bool polarOnly=false,
                            bool set3D=true)

Converts the implicit hydrogens on the atoms of a molecule to explicit hydrogen atoms. Zero or more new atoms are created with atomic number OEElemNo_H, and new bonds are created to connect these to the parent atom with a single bond. This function also resets the implicit hydrogen count to zero.


If true, this function only add explicit hydrogens to polar atoms, i.e. when OEAtomBase.IsPolar returns true.


If true, the default, and the molecule is 3D, then the OESet3DHydrogenGeom function is automatically called on any hydrogen atom in the molecule that has the same coordinates as its parent heavy atom.

If false, then the sprouted hydrogens are initially given the same coordinates as their parent heavy atom.


In case of a 2D molecule, the coordinates of the explicit hydrogens can be assigned by calling the OESet2DHydrogenGeom function.

bool OEAddExplicitHydrogens(OEMolBase &mol, OEAtomBase *hvyatom)

This function creates a new OEAtomBase for every implicit hydrogen on ‘hvyatom’, as given by OEAtomBase.GetImplicitHCount. The new hydrogen atoms are given the same coordinates as their parent, ‘hvyatom’. This function currently always returns true. To set the 2D or 3D geometry of these atoms, call the OESet2DHydrogenGeom or OESet3DHydrogenGeom functions, respectively.

See also