.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OECanonicalOrderAtoms

.. oe:function:: OECanonicalOrderAtoms

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

      .. oe:api::

         void OECanonicalOrderAtoms(OEMolBase& mol)

   .. oe:language:: python

      .. oe:api:: python

         OECanonicalOrderAtoms(mol: Union[OEGraphMol,OEMol,OEQMol]) -> None

   Reorders the atoms of the molecule into canonical order. This function
   uses the :oe:meth:`OEChem::OEMolBase::OrderAtoms` method to change the
   order in which the iterator returned by
   :oe:meth:`OEChem::OEMolBase::GetAtoms` traverses the atoms of a
   molecule.  This function does not affect the atom indices.

   .. note::

      :oe:func:`OEChem::OECanonicalOrderAtoms` does not provide the
      exactly the same canonicalization that is used to generate
      :term:`canonical isomeric SMILES`.
      The canonical atom order of SMILES generation (with various flavors)
      can be accessed by calling the :oe:func:`OEChem::OEGetSmiStringOrder` function.

.. seealso::

  .. oe:language:: c++

      * Example program :ref:`cansmi.cpp<section_example_oechem_cansmi>`

  .. oe:language:: python

      * Example program :ref:`cansmi.py<section_example_oechem_cansmi>`

  .. oe:language:: java

      * Example program :ref:`CanSmi.java<section_example_oechem_cansmi>`

  .. oe:language:: csharp

      * Example program :ref:`CanSmi.cs<section_example_oechem_cansmi>`

