.. oe:namespace:: OEBio


.. _OEBio_OEIsWater:

.. oe:class:: OEIsWater

   .. oe:api::

      class OEIsWater : public OESystem::OEUnaryPredicate<OEChem::OEAtomBase>

   This class represents :ref:`OEIsWater <OEBio_OEIsWater>` functor that
   determines if an atom (:ref:`OEAtomBase <OEChem_OEAtomBase>`) is in a water molecule.

   .. seealso::

      * :ref:`section_predicates_reside_data_functors` section

   The following methods are publicly inherited from :ref:`OEUnaryPredicate <OESystem_OEUnaryPredicate>`:

   ============================================================================== ============================================================================== ===============================================================================
   :oe:meth:`operator()<OESystem::OEUnaryPredicate::operator()>`                  :oe:meth:`CreateCopy<OESystem::OEUnaryPredicate::CreateCopy>`                  :oe:meth:`CreatePredicateCopy<OESystem::OEUnaryPredicate::CreatePredicateCopy>`
   ============================================================================== ============================================================================== ===============================================================================

   The following methods are publicly inherited from :ref:`OEUnaryFunction <OESystem_OEUnaryFunction>`:

   ============================================================ ============================================================ ===========================================================
   :oe:meth:`operator()<OESystem::OEUnaryFunction::operator()>` :oe:meth:`CreateCopy<OESystem::OEUnaryFunction::CreateCopy>`
   ============================================================ ============================================================ ===========================================================

   .. oe:method:: Constructors

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

         .. oe:api::

            OEIsWater(bool checkHydrogens = false, bool allowIons = false)

      .. oe:language:: python

         .. oe:api:: python

            OEIsWater(checkHydrogens: bool = False, allowIons: bool = False) -> OEIsWater

      Constructs the functor to determine if an atom is part of a water molecule.
      If the optional argument ``checkHydrogens`` is set to ``true``, the function checks whether
      hydrogen atoms are part of a water molecule and returns ``true``. The default behavior
      only returns ``true`` for water oxygen atoms, which is useful for counting water molecules in a system.
      If optional argument ``allowIons`` is set to ``true``, the function allows checking for
      the water ions :math:`OH^{-}` and :math:`H_{3}O^{+}`.

   .. oe:method:: operator()

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

         .. oe:api::

            bool operator()(const OEChem::OEAtomBase& atom) const

      .. oe:language:: python

         .. oe:api:: python

            __call__(atom: OEAtomBase) -> bool

      Returns ``true``, if the atom

      * read from a :file:`pdb` file with the following pdb residue names:
        `HOH`, `H2O`, `DOD`, `D2O`, `WAT`, `TIP`, `SOL`, `OH2`, `OD2`.
      * is an oxygen and has no heavy atom neighbor

      otherwise it returns ``false``.

   .. oe:method:: CreateCopy

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

         .. oe:api::

            OESystem::OEUnaryFunction<OEChem::OEAtomBase, bool>* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEIsWater

      Deep copy constructor that returns a copy of the object.
      The memory for the returned :ref:`OEIsWater <OEBio_OEIsWater>`
      object is dynamically allocated  and owned by the caller.

      .. oe:language:: c++

         The returned copy should be deallocated using C++
         delete operator in order to prevent a memory leak.
