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

.. oe:namespace:: OEOpt



.. meta::
   :keywords: OEFunc0, Func0


.. _OEOpt_OEFunc0:

.. oe:class:: OEFunc0

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEFunc0

   The :ref:`OEFunc0 <OEOpt_OEFunc0>` is an abstract base class. This class defines the interface
   for functions which take a set of variables and compute a function value, but have no 
   defined analytical gradients. Classes derived from :ref:`OEFunc0 <OEOpt_OEFunc0>` are intended
   for use with optimizers which do not require gradients.

   .. _figure_OEFunc0_Hierarchy:

   .. figure:: ../images/OEFunc0.*
      :align:  center

   The :ref:`OEFunc0 <OEOpt_OEFunc0>` class defines the following public methods:
    * :oe:meth:`operator()<OEOpt::OEFunc0::operator()>`         
    * :oe:meth:`GetFComponents<OEOpt::OEFunc0::GetFComponents>` 
    * :oe:meth:`NumVar<OEOpt::OEFunc0::NumVar>`

   The following classes derive from this class:
    * :ref:`OEFunc1 <OEOpt_OEFunc1>`
    * :ref:`OEFunc2 <OEOpt_OEFunc2>`
    * :ref:`OEMolFunc0 <OEMolPotential_OEMolFunc0>`
    * :ref:`OEMolFunc1 <OEMolPotential_OEMolFunc1>`
    * :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>`
    * :ref:`OEForceField <OEMolPotential_OEForceField>`
    * :ref:`OEGenericFF <OEMolPotential_OEGenericFF>`
    * :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>`
    * :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>`
    * :ref:`OEMolAdaptor <OEMolPotential_OEMolAdaptor>`
    * :ref:`OEQuatAdaptor <OEMolPotential_OEQuatAdaptor>`
    * :ref:`OESubsetAdaptor <OEMolPotential_OESubsetAdaptor>`
    * :ref:`OETorAdaptor <OEMolPotential_OETorAdaptor>`
    * :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>`
    * :ref:`OENumericMolFunc2 <OEMolPotential_OENumericMolFunc2>`
    * :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>`
    * :ref:`OEFFPotential <OEMolPotential_OEFFPotential>`
    * :ref:`OEStretchPotential <OEMolPotential_OEStretchPotential>`
    * :ref:`OEBendPotential <OEMolPotential_OEBendPotential>`
    * :ref:`OETorsionPotential <OEMolPotential_OETorsionPotential>`
    * :ref:`OEOutOfPlanePotential <OEMolPotential_OEOutOfPlanePotential>`
    * :ref:`OENonBondPotBase <OEMolPotential_OENonBondPotBase>`
    * :ref:`OEVdwPotential <OEMolPotential_OEVdwPotential>`
    * :ref:`OECoulombPotential <OEMolPotential_OECoulombPotential>`
    * :ref:`OEInterMolFunc1 <OEMolPotential_OEInterMolFunc1>`
    * :ref:`OEInterMolFunc2 <OEMolPotential_OEInterMolFunc2>`
    * :ref:`OEInterNonBondPotBase <OEMolPotential_OEInterNonBondPotBase>`
    * :ref:`OEInterNonBondPotential <OEMolPotential_OEInterNonBondPotential>`
    * :ref:`OEInterVdwPotential <OEMolPotential_OEInterVdwPotential>`
    * :ref:`OEInterCoulombPotential <OEMolPotential_OEInterCoulombPotential>`
    * :ref:`OEHarmonicPotential <OEConstr_OEHarmonicPotential>`
    * :ref:`OEMMFF <OEMolMMFF_OEMMFF>`
    * :ref:`OEMMFFStretchBend <OEMolMMFF_OEMMFFStretchBend>`
    * :ref:`OEMMFFIEFF <OEFF_OEMMFFIEFF>`
    * :ref:`OESheffield <OESheff_OESheffield>`
    * :ref:`OEOverlapFuncBase <OEShape_OEOverlapFuncBase>`
    * :ref:`OEOverlapFunc <OEShape_OEOverlapFunc>`
    * :ref:`OEShapeFunc <OEShape_OEShapeFunc>`
    * :ref:`OEExactShapeFunc <OEShape_OEExactShapeFunc>`
    * :ref:`OEAnalyticShapeFunc <OEShape_OEAnalyticShapeFunc>`
    * :ref:`OEHermiteShapeFunc <OEShape_OEHermiteShapeFunc>`
    * :ref:`OEGridShapeFunc <OEShape_OEGridShapeFunc>`
    * :ref:`OEColorFunc <OEShape_OEColorFunc>`
    * :ref:`OEExactColorFunc <OEShape_OEExactColorFunc>`
    * :ref:`OEAnalyticColorFunc <OEShape_OEAnalyticColorFunc>`
    * :ref:`OEGridColorFunc <OEShape_OEGridColorFunc>`

   .. oe:method:: operator()

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

         .. oe:api::

            double operator()(const double*)

      .. oe:language:: python

         .. oe:api:: python

            __call__(x: OEDoubleArray) -> float

      This method defines the interface for function evaluation. 
      An array of variables is passed as an argument, and a function value is returned.
      All classes derived from :ref:`OEFunc0 <OEOpt_OEFunc0>` implements this method.

   .. oe:method:: GetFComponents

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

         .. oe:api::

            OESystem::OEIterBase<OEFComponent>* GetFComponents(const double *)

      .. oe:language:: python

         .. oe:api:: python

            GetFComponents(arg0: float) -> Iterable[OEFComponent]

      This method defines the interface for retrieving information 
      about function names and associated function values, given a set of variables. The 
      method takes an array of variables, and returns an iterator over the names and 
      component values (typically energies).

      All OE classes derived from :ref:`OEFunc0 <OEOpt_OEFunc0>`, implements this method.
      However, due to the unique construct of the return value from this method, it
      is not possible to implement this in a user derived class.  It is suggested to
      return a NULL for user derived classes and handle things accordingly.

   .. oe:method:: NumVar

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

         .. oe:api::

            unsigned int NumVar() const

      .. oe:language:: python

         .. oe:api:: python

            NumVar() -> int

      This method defines the interface for returning the number of function variables.
      All classes derived from :ref:`OEFunc0 <OEOpt_OEFunc0>` implements this method.


