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

.. oe:namespace:: OEEon

.. meta::
   :keywords: OEChargeFunc, ChargeFunc


.. _OEEon_OEChargeFunc:

.. oe:class:: OEChargeFunc

   .. attention::

      |PRELIMINARY-API|

   .. oe:api::

      class OEChargeFunc : public OEShape::OEColorFunc



The :ref:`OEChargeFunc <OEEon_OEChargeFunc>` abstract class defines the following public methods:
    * :oe:meth:`SetupRef<OEEon::OEChargeFunc::SetupRef>`
    * :oe:meth:`Setup<OEEon::OEChargeFunc::Setup>`
    * :oe:meth:`Overlap<OEEon::OEChargeFunc::Overlap>`
    * :oe:meth:`operator()<OEEon::OEChargeFunc::operator()>`


The link to the parent method shows public methods that are inherited from :ref:`OEShape::OEColorFunc <OEShape_OEColorFunc>`.


The following classes are derived from this class:   
    * :ref:`OEExactChargeFunc <OEEon_OEExactChargeFunc>`
    * :ref:`OEGridChargeFunc <OEEon_OEGridChargeFunc>`


   .. _OEEon_OEChargeFunc_SetupRef:

   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OEChargeFunc & operator=(const OEChargeFunc & argFunc)

      Assignment operator.


   .. oe:method:: SetupRef

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

         .. oe:api::

            bool SetupRef(const OEChem::OEMolBase&)

      .. oe:language:: python

         .. oe:api:: python

            SetupRef(refMol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

      This method defines the interface for setting up the reference system for the
      :ref:`OEChargeFunc <OEEon_OEChargeFunc>` derived instance with a molecule.
      The molecule must have 3D coordinates and partial charges assigned.



   .. _OEEon_OEChargeFunc_Setup:

   .. oe:method:: Setup

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

         .. oe:api::

            bool Setup(const OEChem::OEMolBase& fitMol)

      .. oe:language:: python

         .. oe:api:: python

            Setup(fitMol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

      Sets up a database molecule for further electrostatic overlap calculations
      with its conformations. The molecule must have 3D coordinates and partial
      charges assigned.
  

   .. _OEEon_OEChargeFunc_Overlap:

   .. oe:method:: Overlap

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

         .. oe:api::

            bool Overlap(const double* coords, OEEonOverlapScore& results)
            bool Overlap(const OEChem::OEMolBase& fitMol,
                         OEEonOverlapScore& results)

      .. oe:language:: python

         .. oe:api:: python

            Overlap(coords: OEDoubleArray, results: OEEonOverlapScore) -> bool
            Overlap(fitMol: Union[OEGraphMol,OEMol,OEQMol],
                    results: OEEonOverlapScore) -> bool


      These methods calculate the charge density overlap between the reference and
      the fit molecules. The reference molecule must be set using the
      :oe:meth:`SetupRef<OEEon::OEChargeFunc::SetupRef>` method. The
      first overload assumes that the fit molecule has been set using the
      :oe:meth:`Setup<OEEon::OEChargeFunc::Setup>` method and uses
      the specified coordinates for the fit molecule. The second overlap
      takes the specified fit molecule and its current coordinates.


   .. _OEEon_OEChargeFunc_operator:

   .. oe:method:: operator()

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

         .. oe:api::

            double operator()(const double*, double*)

      .. oe:language:: python

         .. oe:api:: python

            __call__(coords: OEDoubleArray, grads: OEDoubleArray = None) -> float


      This public method implements the function value and gradient of overlap as a function of database conformer/start coordinates.
      It is assumed that the reference has been already set via the :oe:meth:`SetupRef<OEEon::OEChargeFunc::SetupRef>` method. The database
      molecule has been set with :oe:meth:`Setup<OEEon::OEChargeFunc::Setup>`.
