.. include:: ../substitutions

.. oe:namespace:: OEMolProp

.. meta::
   :keywords: OEGetLongestUnbranchedCarbonsChain

.. _OEMolProp_OEGetLongestUnbranchedCarbonsChain:

.. oe:function:: OEGetLongestUnbranchedCarbonsChain

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

      .. oe:api::

         unsigned int OEGetLongestUnbranchedCarbonsChain(const OEChem::OEMolBase& mol)

   .. oe:language:: python

      .. oe:api:: python

         OEGetLongestUnbranchedCarbonsChain(mol: Union[OEGraphMol,OEMol,OEQMol]) -> int

   Returns the size of the longest chain of all carbons in a molecule. An 
   unbranched atom is a chain atom with maximum two connections to other 
   heavy chain atoms. A set of unbranched atoms which are connected
   together form a chain.  A molecule may contain multiple chains which are isolated
   from each other by non-chain atoms (e.g. ring or branched atoms).

   .. seealso::

      * :oe:func:`OEMolProp::OEGetLongestUnbranchedHeavyAtomsChain` function
      * :ref:`filter_files_unbranched_chains` subsection describing filter files

   **Examples**

   The :oe:func:`OEMolProp::OEGetLongestUnbranchedCarbonsChain` function returns ``4`` for the molecule below.

   .. figure:: ../../../common/images/molprop/uchain_AllC.*
      :width:  250pt
      :align:  center

   The :oe:func:`OEMolProp::OEGetLongestUnbranchedCarbonsChain` function returns ``0`` for the molecule below.
   It is because the unbranched chain does not contain all carbons.

   .. figure:: ../../../common/images/molprop/uchain_carbons_NotAllC.*
      :width:  250pt
      :align:  center



