.. include:: ../../toolkit-substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OECreateSmartsString

.. oe:function:: OECreateSmartsString

   .. attention::

      |PRELIMINARY-API|

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

      .. oe:api::

         void OECreateSmartsString(std::string& str, const OEMolBase& mol,
                                   const char* smartsTag = nullptr,
                                   unsigned int flavor = (OESMILESFlag::DEFAULT & ~OESMILESFlag::Canonical),
                                   std::pair<const OEAtomBase*, const OEAtomBase*>* atmord = nullptr)




   .. oe:language:: python

      .. oe:api::

         OECreateSmartsString(OEMolBase mol, str smartsTag = None,
                              int flavor = (OESMILESFlag_DEFAULT & ~OESMILESFlag_Canonical)) -> str

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

      Generate the :term:`SMARTS` string from the provided molecule using the flavors from the :oe:constns:`OEChem::OESMILESFlag` namespace.
      If the ``smartsTag`` argument is null, the data tag applied by :oe:func:`OEChem::OEParseSmarts` 
      is assumed to contain the atom and bond annotations from the SMARTS parse, otherwise an explicit generic data tag
      can be provided for custom SMARTS constraint annotations.  Note that custom constraint annotations are not validated, so
      extra checking for a valid SMARTS query will be required (e.g., by calling :oe:func:`OEChem::OEParseSmarts`).

      The provided default flavor for the SMARTS generation suppresses reordering which can invalidate the statically captured
      pattern constraints.  Any explicitly provided non-default flavor should also suppress reordering activity for the same reason.
      While the flavor is provided for user control and experimentation, be aware that only actual atom/bond properties on the molecule
      are considered for the flavor provided, so any SMARTS qualifiers from the ``smartsTag`` generic data are considered to be completely irrelevant
      during canonicalization. Extra care is also required if any atom (:oe:const:`OEChem::OESMARTSAtomFlag::Chirality`)
      or bond (:oe:const:`OEChem::OESMARTSBondFlag::Chirality`) stereo parity is encoded as into the SMARTS string, requiring one or both of
      :oe:const:`OEChem::OESMILESFlag::AtomStereo` for tetrahedral stereo parity SMARTS encodings, or
      :oe:const:`OEChem::OESMILESFlag::BondStereo` for cis/trans SMARTS encodings.

      .. seealso::
         * :ref:`SMARTS <chapter_SMARTS>`
         * :oe:func:`OEChem::OECreateAtomSmartsString`
         * :oe:func:`OEChem::OECreateBondSmartsString`

   .. oe:language:: java csharp

      This function is only provided in C++ and python.
