.. include:: ../substitutions

.. oe:namespace:: OEChem

.. meta::
   :keywords: OEParseSmirks

.. oe:function:: OEParseSmirks

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

      .. oe:api::

         bool OEParseSmirks(OEQMolBase& mol, const char* smirks,
                            unsigned int opt = OESmartsParseOpts::Default)
         bool OEParseSmirks(OEQMolBase& mo, const char* smirks,
                            const OEVectorBindings& vb,
                            unsigned int opt = OESmartsParseOpts::Default)

   .. oe:language:: python

      .. oe:api:: python

         OEParseSmirks(arg1: OEQMol, arg2: str, opt: int) -> bool
         OEParseSmirks(arg1: OEQMol, arg2: str, vb: OEVectorBindings, opt: int) -> bool

   These functions generate a reaction molecule by parsing the given
   :term:`SMIRKS` pattern.
   If the :term:`SMIRKS` string passed to the function is valid and
   is parsed correctly the function will return a ``true``,
   otherwise the it will return ``false``.

   *mol*
    The :ref:`OEQMolBase <OEChem_OEQMolBase>` object that is generated for the
    given :term:`SMIRKS` pattern.

   *smirks*
    The :term:`SMARTS` string that represents a molecular substructure query.

   *opts*
     The parameter determines how the :term:`SMARTS` pattern is interpreted.
     This value has to be from the :oe:constns:`OEChem::OESmartsParseOpts`
     namespace.

   *vbinding*
     The parameter provides a mechanism for parsing a :term:`SMARTS` pattern that
     contains vector bindings.  An :ref:`OEVectorBindings <OEChem_OEVectorBindings>` object
     containing the complete set of possible vector bindings that may be
     contained in a :term:`SMIRKS` pattern, including recursive vector
     bindings, and passed to the :oe:func:`OEChem::OEParseSmarts` function.
     Vector bindings will be resolved while the :term:`SMIRKS` pattern is being
     parsed.
 
   .. seealso::

      * :ref:`chapter_SMARTS` chapter
      * :oe:constns:`OEChem::OESmartsParseOpts` namespace

   .. note::

      :oe:func:`OEChem::OEParseSmirks` is functionally nearly identical to
      :oe:func:`OEChem::OEParseSmarts`.  The only significant difference in
      how :term:`SMARTS` and :term:`SMIRKS` are parsed is the handling of the ``[H]``
      expression.  :term:`SMARTS` interprets ``[H]`` as an atom that has a total
      hydrogen count of exactly one.  :term:`SMIRKS` interprets ``[H]`` as an
      explicit hydrogen.  The :oe:func:`OEChem::OEParseSmirks` function
      therefore parses ``[H]`` differently than would
      :oe:func:`OEChem::OEParseSmarts`, and performs additional validity
      checks of the :term:`SMIRKS` string.

   .. seealso::

      .. oe:language:: c++

         * Example program :ref:`libgen.cpp<section_example_oechem_libgen>`

      .. oe:language:: python

         * Example program :ref:`libgen.py<section_example_oechem_libgen>`

      .. oe:language:: java

         * Example program :ref:`LibGen.java<section_example_oechem_libgen>`

      .. oe:language:: csharp

         * Example program :ref:`LibGen.cs<section_example_oechem_libgen>`
