4.4 OEAddExplicitHydrogens

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

Convert 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 co-ordinates as their parent atom. However, if the ``set3D'' parameter is true, the default, and the given molecule has three dimensional co-ordinates (i.e. OEMolBase::GetDimension returns a value of three or more), this routine automatically calls the OESet3DHydrogenGeom function.

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 atm->GetImplicitHCount(). The new hydrogen atoms are given the same co-ordinates as their parent, ``atm''. This function currently always returns true. To set the 3D geometry of these atoms, call the OESet3DHydrogenGeom function.