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 the ‘polar only’ argument is true, this function does nothing if the atom is not polar, i.e. when OEAtomBase::IsPolar returns false. The sprouted hydrogens are initially given the same coordinates as their parent atom.

If the ‘set3D’ parameter is true, the default, and the molecule is three dimensional (i.e. OEMolBase::GetDimension returns a value of three or more) this routine automatically calls the OESet3DHydrogenGeom function on any hydrogen atom in the molecule that has the same coordinates as its parent atom.


This means it will sprout a hydrogen into three dimensional coordinates that were created outside this function if that hydrogen atom has the same coordinates as its parent atom.

bool OEAddExplicitHydrogens(OEMolBase &mol, OEAtomBase *atm)

The form of the OEAddExplicitHydrogens function operates only on the specified OEAtomBase. This function creates a new OEAtomBase for every implicit hydrogen on ‘atm’, as given by OEAtomBase::GetImplicitHCount. The new hydrogen atoms are given the same coordinates as their parent, ‘atm’. This function currently always returns true. To set the 3D geometry of these atoms, call the OESet3DHydrogenGeom function.