.. oe:namespace:: OEChem

.. _OEMDLQueryOpts_constraints:

.. oe:constnamespace:: OEMDLQueryOpts

   The :oe:constns:`OEChem::OEMDLQueryOpts` namespace encodes symbolic
   constants used as bit-masks to indicate how to interpret MDL query
   files or MDL reaction imported by
   :oe:func:`OEChem::OEReadMDLQueryFile` and
   :oe:func:`OEChem::OEReadMDLReactionQueryFile` functions,
   respectively.

   This namespace contains the following constants:

   .. oe:constant:: Default
   
      Only constraints explicitly specified in the MDL file are added
      to the :ref:`OEQMolBase <OEChem_OEQMolBase>` query structure with the
      the :oe:const:`OEChem::OEMDLQueryOpts::Optimize` option.
 
   .. oe:constant:: SuppressExplicitH
   
      Controls how the explicit hydrogens of the query are
      matched to the explicit/implicit hydrogens of the target structures.

      .. seealso::

         * :ref:`section_mdlqueries_features` section for the supported MDL query features
         * :ref:`section_mdlqueries_interpret` section
         * :ref:`section_mdlqueries_hydrogens` section

   .. oe:constant:: AddBondAliphaticConstraint
   
      Controls whether or not map an aliphatic query bond only to 
      aliphatic bonds in the target structure during the substructure search.

      .. seealso::

         * :ref:`section_mdlqueries_interpret` section

   .. oe:constant:: AddBondTopologyConstraint

      By default, ring bonds in the query structure can only be mapped to ring bonds in the target,
      and chain bonds in the query can be mapped to both ring and chain bonds.

      The :oe:const:`OEChem::OEMDLQueryOpts::AddBondTopologyConstraint` option enables enforcement
      of bond topology constraint during substructure search i.e. ring bonds in the query can
      only be mapped to ring bonds, and chain bonds in the query can
      only be mapped to chain bonds.

      .. seealso::

         * :ref:`section_mdlqueries_interpret` section

   .. oe:constant:: ExactMatchStarAtoms
   
      By default, R-group atoms and `*` atoms (:oe:const:`OEChem::OEElemNo::Du`)
      match like an "any"-atom - matching atoms of any type for both :term:`SMARTS` and MDL queries.
      Adding this non-default option flag will force `*atoms` that are neither
      pseudo-atoms nor R-group atoms to match only explicit `*` atoms in the target.

      .. seealso::

         * :ref:`section_mdlqueries_interpret` section

   .. oe:constant:: MatchAtomStereo

      By default, atom stereo information is not considered when building
      query molecules, allowing unconditional match between any atom 
      configuration.

      When  the :oe:const:`OEChem::OEMDLQueryOpts::MatchAtomStereo`
      option is turned on, an S/R atom stereo configuration in the
      query will match only to any S/R configuration in the target
      molecule, but not to a R/S (opposite) or an  unspecified one.
      If an atom stereo configuration is undefined in the query, 
      it can match to any atom regardless to its stereo configuration.

      .. seealso::

         * :ref:`section_mdlqueries_interpret` section

   .. oe:constant:: MatchIsotope

      By default, the isotopic information (*i.e.* lines starting with
      ``M ISO`` in the MDL query file) is ignored.  

      When the :oe:const:`OEChem::OEMDLQueryOpts::MatchIsotope` option is
      turned on, a query isotope atoms can be match to a target atom only if
      it has the same atomic mass.
      If the query atom has no specified isotope number, it will still match 
      to any target atom regardless of its atomic mass.

      .. seealso::

         * :ref:`section_mdlqueries_interpret` section

   .. oe:constant:: Optimize

      When the :oe:const:`OEChem::OEMDLQueryOpts::Optimize` option is
      turned on, the atom and bond expressions are optimized for
      substructure search.

   .. oe:constant:: ReactionQuery
   
      MDL reaction files are interpreted differently from MDL query files. 
      The usage of :oe:const:`OEChem::OEMDLQueryOpts::ReactionQuery` option is 
      necessary when a MDL reaction is imported with the
      :oe:func:`OEChem::OEReadMDLReactionQueryFile` function.     
   
      .. seealso::

         * :ref:`subsection_reactions_libgen_MDL` section
