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

.. oe:namespace:: OEOpt



.. meta::
   :keywords: OEFunc1, Func1


.. _OEOpt_OEFunc1:

.. oe:class:: OEFunc1

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEFunc1 : public OEFunc0

   The :ref:`OEFunc1 <OEOpt_OEFunc1>` is an abstract base class. This class defines the
   interface for functions which take a set of variables and compute a function value 
   and gradients. Classes derived from :ref:`OEFunc1 <OEOpt_OEFunc1>` are intended for use
   with optimizers which require gradients.

   .. _figure_OEFunc1_Hierarchy:

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

  The following methods are publicly inherited from :ref:`OEFunc0 <OEOpt_OEFunc0>`:
   * :oe:meth:`operator()<OEOpt::OEFunc0::operator()>`         
   * :oe:meth:`GetFComponents<OEOpt::OEFunc0::GetFComponents>` 
   * :oe:meth:`NumVar<OEOpt::OEFunc0::NumVar>`

  The :ref:`OEFunc1 <OEOpt_OEFunc1>` class defines the following additional public methods:
   * :oe:meth:`operator()<OEOpt::OEFunc1::operator()>`

  The following classes derive from this class:
    * :ref:`OEFunc2 <OEOpt_OEFunc2>`
    * :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* x, double* g)

      .. oe:language:: python

         .. oe:api:: python

            __call__(x: OEDoubleArray, g: OEDoubleArray) -> float

      This method defines the interface for function evaluation along with the gradients. 
      An array of variables is passed as an argument, and a function 
      value is returned. The corresponding gradients for the given
      set of variable is returned in the second argument. All classes derived 
      from :ref:`OEFunc1 <OEOpt_OEFunc1>` implements this method.

      There should be a one to one correspondence between the elements of the variable 
      and gradient arrays. Methods that override this operator method must not 
      initialize the gradient array, but rather assume the array has already been 
      initialized.

    
