.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEPerceiveCIPStereo

.. note::

   The aromaticity (see :ref:`chapter_aromaticity` chapter) has to be perceived by calling
   the :oe:func:`OEChem::OEAssignAromaticFlags` function prior to calling
   :oe:func:`OEChem::OEPerceiveCIPStereo`.

.. oe:function:: OEPerceiveCIPStereo

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

      .. oe:api::

         unsigned int OEPerceiveCIPStereo(const OEMolBase& mol,
                                          const OEAtomBase* atom)

   .. oe:language:: python

      .. oe:api:: python

         OEPerceiveCIPStereo(mol: Union[OEGraphMol,OEMol,OEQMol],
                             atom: OEAtomBase) -> int

   Perceives the Cahn-Ingold-Prelog descriptor for the given atom.
   The return value is taken from the :oe:constns:`OEChem::OECIPAtomStereo` namespace.

   For a chiral atom center the function returns

   * either :oe:const:`OEChem::OECIPAtomStereo::R` or :oe:const:`OEChem::OECIPAtomStereo::S`, if the atom has specified stereochemistry
   * :oe:const:`OEChem::OECIPAtomStereo::UnspecStereo` if the CIP atom stereo center has no specified stereo (*i.e.* when :oe:meth:`OEChem::OEAtomBase::HasStereoSpecified` returns false),

   The function always returns :oe:const:`OEChem::OECIPAtomStereo::NotStereo` for the following atoms:

   * non-chiral atoms
   * atoms that have invalid valence (checked by :oe:func:`OEChem::OECheckAtomValence`)

   .. seealso::

      * :oe:func:`OEChem::OESetCIPStereo` to set atom stereo from CIP stereo descriptor
      * :ref:`section_stereochemistry_CIP` section

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

      .. oe:api::

         unsigned int OEPerceiveCIPStereo(const OEMolBase& mol,
                                          const OEBondBase* bond)

   .. oe:language:: python

      .. oe:api:: python

         OEPerceiveCIPStereo(mol: Union[OEGraphMol,OEMol,OEQMol],
                             bond: OEBondBase) -> int

   Perceives the Cahn-Ingold-Prelog descriptor for the given bond stereo center.
   The return value is taken from the :oe:constns:`OEChem::OECIPBondStereo` namespace.

   For a double bond, the function returns

   * either :oe:const:`OEChem::OECIPBondStereo::E` or :oe:const:`OEChem::OECIPBondStereo::Z`, if the bond has specified stereochemistry
   * :oe:const:`OEChem::OECIPBondStereo::UnspecStereo` if the CIP bond stereo center has no specified stereo (*i.e.* when :oe:meth:`OEChem::OEBondBase::HasStereoSpecified` returns false)

   For a non-chiral bond, the function always returns :oe:const:`OEChem::OECIPBondStereo::NotStereo`.

   .. seealso::

      * :oe:func:`OEChem::OESetCIPStereo` to set bond stereo from CIP stereo descriptor
      * :ref:`section_stereochemistry_CIP` section
      *
