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

.. oe:namespace:: OEChem

.. meta::
   :keywords: OECount

.. oe:function:: OECount

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

      .. oe:api::

         unsigned int OECount(const OEMolBase& mol, const OESubSearch& ss,
                              bool uniquematch = false)

   .. oe:language:: python

      .. oe:api:: python

         OECount(arg1: Union[OEGraphMol,OEMol,OEQMol], arg2: OESubSearch,
                 uniquematch: bool = False) -> int

   Returns the number of substructure search matches for the given molecule.

   *uniquematch*
      If ``true`` then only the unique matches will be counted.
      See more details in :oe:meth:`OEChem::OESubSearch::Match` method.

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

      .. oe:api::

         unsigned int OECount(const OEMolBase& mol,
                              const OESystem::OEUnaryPredicate<OEAtomBase> &)

   .. oe:language:: python

      .. oe:api:: python

         OECount(arg1: Union[OEGraphMol,OEMol,OEQMol], arg2: OEUnaryAtomPred) -> int

   Returns the number of atoms (:ref:`OEAtomBase <OEChem_OEAtomBase>`) matching
   the given predicate.

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

      .. oe:api::

         unsigned int OECount(const OEAtomBondSet& abset,
                              const OESystem::OEUnaryPredicate<OEAtomBase> &)

   .. oe:language:: python

      .. oe:api:: python

         OECount(abset: OEAtomBondSet, atompred: OEUnaryAtomPred) -> int

   Returns the number of atoms (:ref:`OEAtomBase <OEChem_OEAtomBase>`) matching
   the given predicate from the provided container.

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

      .. oe:api::

         unsigned int OECount(const OEMolBase& mol,
                              const OESystem::OEUnaryPredicate<OEBondBase> &)

   .. oe:language:: python

      .. oe:api:: python

         OECount(arg1: Union[OEGraphMol,OEMol,OEQMol], arg2: OEUnaryBondPred) -> int

   Returns the number of bonds (:ref:`OEBondBase <OEChem_OEBondBase>`) matching
   the given predicate.

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

      .. oe:api::

         unsigned int OECount(const OEAtomBondSet& abset,
                              const OESystem::OEUnaryPredicate<OEBondBase> &)

   .. oe:language:: python

      .. oe:api:: python

         OECount(abset: OEAtomBondSet, bondpred: OEUnaryBondPred) -> int

   Returns the number of bonds (:ref:`OEBondBase <OEChem_OEBondBase>`) matching
   the given predicate from the provided container.

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

      .. oe:api::

         unsigned int OECount(const OEMolBase& mol,
                              const OESystem::OEUnaryPredicate<OEGroupBase> &)

   .. oe:language:: python

      .. oe:api:: python

         OECount(arg1: Union[OEGraphMol,OEMol,OEQMol], arg2: OEUnaryGroupPred) -> int

   Returns the number of groups (:ref:`OEGroupBase <OEChem_OEGroupBase>`) matching
   the given predicate.

   .. seealso::

      * :oe:func:`OESystem::OECount` functions in **OESystem TK**

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

      .. oe:api::

         unsigned OECount(const OEMonomerSet& monomers,
                          const OESystem::OEUnaryPredicate<OEMonomer>& pred)

   .. oe:language:: python

      .. oe:api:: python

         OECount(monomers: OEMonomerSet, pred: OEUnaryMonomerPred) -> int

   .. attention::

      |PRELIMINARY-API|

   Returns the number of groups (:ref:`OEMonomer <OEChem_OEMonomer>`) matching
   the given predicate.

   .. seealso::

      * :oe:cls:`OEChem::OEMonomerSet` class