.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OESmilesToMol

.. oe:function:: OESmilesToMol

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

      .. oe:api::

         bool OESmilesToMol(OEMolBase& mol, const std::string& str)

   .. oe:language:: python

      .. oe:api:: python

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

   Converts a :term:`SMILES` string into a molecule.
   After constructing the molecule the following properties are perceived:

   * Rings are perceived by calling the
     :oe:func:`OEChem::OEFindRingAtomsAndBonds` function.

   * The aromaticity is assigned by calling the
     :oe:func:`OEChem::OEAssignAromaticFlags` function using the
     :oe:const:`OEChem::OEAroModel::OpenEye` aromaticity model.

   * The chirality is perceived by calling the
     :oe:func:`OEChem::OEPerceiveChiral` function.

   The molecule object is cleared before parsing so the resulting molecule
   object only contains atoms and bonds from the :term:`SMILES`.  If one
   wishes to *add* atoms and bonds to an existing molecule, one can use
   the lower-level :oe:func:`OEChem::OEParseSmiles` function, which preserves
   any existing atoms and bonds in the molecule.

   .. seealso::

      * :oe:func:`OEChem::OEMolToSmiles` function
      * :oe:func:`OEChem::OEMolToCXSMILES` function
      * :ref:`section_molctordtor_smilesfrommol` section
