.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OE3DToAtomStereo


.. _OEChem_OE3DToAtomStereo:

.. oe:function:: OE3DToAtomStereo

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

      .. oe:api::

         bool OE3DToAtomStereo(OEMolBase& mol)

   .. oe:language:: python

      .. oe:api:: python

         OE3DToAtomStereo(mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

   Set the stereochemistry at the chiral atoms of a molecule, as
   specified by the molecule's 3D coordinates.  The affected atoms are
   those with a 'chiral' atom property of ``true``, as perceived by a call
   to :oe:func:`OEChem::OEPerceiveChiral`, or set manually by the user
   calling the :oe:meth:`OEChem::OEAtomBase::SetChiral` method.  If no
   chirality has been perceived on the molecule,
   :oe:func:`OEChem::OEPerceiveChiral` will be called inside this
   function.

   This function will return ``false`` immediately, if the dimension of
   the molecule is not found to be 3.

   The :oe:func:`OEChem::OE3DToAtomStereo` function throws a warning
   and returns ``false`` at the end, if the geometry of any of the chiral atoms
   of the given molecule is not tetrahedral *i.e.* if the atom stereo
   can not be determined from the coordinates.

   After stereochemistry is set
   :oe:meth:`SetPerceived<OEChem::OEMolBase::SetPerceived>` is called with
   the :oe:const:`OEChem::OEPerceived::AtomStereo` flag set to
   ``true``. Subsequent calls to :oe:func:`OEChem::OE3DToAtomStereo` will
   return ``true`` immediately as the value of
   :oe:meth:`HasPerceived<OEChem::OEMolBase::HasPerceived>` is checked on
   entry. Stereochemistry can be forced to be reperceived by setting the
   :oe:const:`OEChem::OEPerceived::AtomStereo` flag to ``false``.

