.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEAssignMDLHydrogens

.. oe:function:: OEAssignMDLHydrogens

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEAssignMDLHydrogens(OEMolBase& mol)

   .. oe:language:: python

      .. oe:api:: python

         OEAssignMDLHydrogens(mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

   Sets the implicit hydrogen count property of each atom in the molecule
   based upon the **MDL valence model** by
   calling :oe:func:`OEAssignMDLHydrogens(OEAtomBase*)<OEChem::OEAssignMDLHydrogens>`
   with the value returned by :oe:func:`OEChem::OEDefaultImplicitHCount`.
   This function returns ``true`` if the implicit hydrogen count of any atom in the
   molecule is changed. It returns ``false`` if none of the atoms in the molecule has the
   implicit hydrogen count changed.
   The assigned implicit hydrogen count can be accessed by
   :oe:meth:`OEChem::OEAtomBase::GetImplicitHCount` method.

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEAssignMDLHydrogens(OEAtomBase* atm)

   .. oe:language:: python

      .. oe:api:: python

         OEAssignMDLHydrogens(atm: OEAtomBase) -> bool

   Sets the implicit hydrogen count property of an atom based upon the
   **MDL valence model**. This function assumes that the formal charges
   are correctly set. This function calls the
   :oe:meth:`OEChem::OEAtomBase::SetImplicitHCount` method on each atom with the value
   returned by :oe:func:`OEChem::OEDefaultMDLHCount`. This function returns ``false``
   if the implicit hydrogen count of the atom is not changed.
   If the charge state of each atom has not been assigned, you should call the
   :oe:func:`OEChem::OEAssignImplicitHydrogens` and
   :oe:func:`OEChem::OEAssignFormalCharges` functions instead.

   .. seealso::

      * :ref:`section_valence_mdl` section
      * :oe:func:`OEChem::OEDefaultMDLHCount` function
      * :oe:func:`OEChem::OEMDLGetValence` function
      * :oe:cls:`OEChem::OEIsValidMDLAtomValence` predicate 
