.. # split from OEMedChemFunctions.rst:264


.. oe:namespace:: OEMedChem

.. meta::
   :keywords: OEGetFuncGroupFragments

.. oe:function:: OEGetFuncGroupFragments

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

      .. oe:api::

         OESystem::OEIterBase<OEChem::OEAtomBondSet>* OEGetFuncGroupFragments(const OEChem::OEMolBase& mol)

   .. oe:language:: python

      .. oe:api:: python

         OEGetFuncGroupFragments(mol: Union[OEGraphMol,OEMol,OEQMol]) -> OEAtomBondSetIter

   The :oe:func:`OEMedChem::OEGetFuncGroupFragments` function partitions
   the given molecule into functional groups and returns an iterator
   over :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>` objects.
   Each :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>` container stores the atoms and the
   bonds of an identified fragment.
   See example in :ref:`Figure: Example of fragments returned by the
   OEGetFuncGroupFragments function<figure_OEGetFuncGroupFragments>` where
   each fragment returned by the :oe:func:`OEMedChem::OEGetFuncGroupFragments`
   function is highlighted with a different color.

   The :oe:func:`OEMedChem::OEGetFuncGroupFragments` function uses the following
   heuristics to fragment a molecule:

   * rings are left intact *i.e.* considered as a unit
   * exo-ring double bonds are not cleaved from adjacent rings
   * hetero atoms next to each other are kept together
   * sp and sp2 atoms next to each other are kept together
   * in order to avoid generating one atom fragments isolated atoms are
     attached to the smallest neighbor fragment

   .. note::

      The molecule argument is ``const``, so this function requires that the
      :oe:func:`OEChem::OEFindRingAtomsAndBonds` perception activity has been
      performed prior to calling this function.

   .. _figure_OEGetFuncGroupFragments:

   .. figure:: ../images/OEGetFuncGroupFragments.*
      :align:  center

      **Example of fragments returned by the OEGetFuncGroupFragments function**

   .. seealso::

      * :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>` and :ref:`OEMolBase <OEChem_OEMolBase>` classes in the *OEChem TK* manual
      * :ref:`chapter_fragmentation` chapter



