.. # split from OEMedChemFunctions.rst:346


.. oe:namespace:: OEMedChem

.. meta::
   :keywords: OEGetRingChainFragments

.. oe:function:: OEGetRingChainFragments

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

      .. oe:api::

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

   .. oe:language:: python

      .. oe:api:: python

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

   The :oe:func:`OEMedChem::OEGetRingChainFragments` function partitions
   the given molecule into ring and chain fragments 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
   OEGetRingChainFragments function<figure_OEGetRingChainFragments>` where
   each fragment returned by the :oe:func:`OEMedChem::OEGetRingChainFragments`
   function is highlighted with a different color.

   The perceived regions are based upon the heavy atoms in the molecule.
   If the molecule contains explicit hydrogen atoms, those explicit hydrogens
   will be returned in the same perception set(s) as their alpha heavy atom neighbor.
   If the perception set(s) returned are used to subset or fragment the molecule, a mixture
   of implicit and explicit hydrogens may result, so care should be taken to normalize
   the structure for subsequent use.

   .. 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_OEGetRingChainFragments:

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

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

   .. seealso::

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



