.. include:: ../../toolkit-substitutions

.. oe:namespace:: OEChem

.. oe:function:: OEDetectMonomers

   .. attention::

      |PRELIMINARY-API|

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

      .. oe:api::

         bool OEDetectMonomers(OEMolBase& mol, const OEMonomerSet& monomers)
         bool OEDetectMonomers(OEMolBase& mol, const OEMonomerSet& monomers,
                               const std::string& codeSet)

   .. oe:language:: python

      .. oe:api:: python

         OEDetectMonomers(mol: Union[OEGraphMol,OEMol,OEQMol],
                          monomers: OEMonomerSet) -> bool
         OEDetectMonomers(mol: Union[OEGraphMol,OEMol,OEQMol],
                          monomers: OEMonomerSet, codeSet: str) -> bool


   Detects the monomers defined in the specified monomer set in the given molecule.
   The function returns true if all atoms in the molecule are part of the defined monomers
   and false otherwise.

   mol
    The molecule (:oe:cls:`OEChem::OEMolBase`) to be searched for monomers.

   monomers
    The monomer set (:oe:cls:`OEChem::OEMonomerSet`) that stores the monomers that
    are being detected.

   code-set
    The code set to use for detecting monomers, if not specified the primary code-set of the
    monomer set will be used.

   The detected monomers are stored on the molecule as groups (:oe:cls:`OEChem::OEGroupBase`).

   **Example**

   .. oe:source:: DetectMonomers.py
      :language: python
      :noindent:
      :frag:     SNIPPET

   .. oe:source:: DetectMonomers.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET

   .. seealso::

      * :oe:cls:`OEChem::OEMonomerSet` class
      * :oe:func:`OEChem::OEMolToHelm` function
