.. include:: ../substitutions

.. oe:namespace:: OEMolProp

.. meta::
   :keywords: OEGetLongestUnbranchedHeavyAtomsChain

.. _OEMolProp_OEGetLongestUnbranchedHeavyAtomsChain:

.. oe:function:: OEGetLongestUnbranchedHeavyAtomsChain

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

      .. oe:api::

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

   .. oe:language:: python

      .. oe:api:: python

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

   Returns the size of the longest chain of heavy atoms in a molecule. This is defined
   to be the maximum number of connected, unbranched, and non-ring heavy atoms.
   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::OEGetLongestUnbranchedCarbonsChain` function
      * :ref:`filter_files_unbranched_chains` subsection describing filter files

   **Examples**

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

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

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

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

