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

.. oe:namespace:: OEOpt



.. meta::
   :keywords: OEFunc2, Func2


.. _OEOpt_OEFunc2:

.. oe:class:: OEFunc2

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEFunc2 : public OEFunc1

   The :ref:`OEFunc2 <OEOpt_OEFunc2>` is an abstract base class. This class defines the
   interface for functions which take a set of variables and compute a function value, 
   gradients and second derivatives. 

   .. _figure_OEFunc2_Hierarchy:

   .. figure:: ../images/OEFunc2.*
      :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 following methods are publicly inherited from :ref:`OEFunc1 <OEOpt_OEFunc1>`:
    * :oe:meth:`operator()<OEOpt::OEFunc1::operator()>` 

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

   The following classes derive from this class:
    * :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>`
    * :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>`
    * :ref:`OESubsetAdaptor <OEMolPotential_OESubsetAdaptor>`
    * :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:`OEInterMolFunc2 <OEMolPotential_OEInterMolFunc2>`
    * :ref:`OEInterNonBondPotBase <OEMolPotential_OEInterNonBondPotBase>`
    * :ref:`OEInterNonBondPotential <OEMolPotential_OEInterNonBondPotential>`
    * :ref:`OEInterVdwPotential <OEMolPotential_OEInterVdwPotential>`
    * :ref:`OEInterCoulombPotential <OEMolPotential_OEInterCoulombPotential>`
    * :ref:`OEMMFF <OEMolMMFF_OEMMFF>`
    * :ref:`OEMMFFStretchBend <OEMolMMFF_OEMMFFStretchBend>`
    * :ref:`OESheffield <OESheff_OESheffield>`
    * :ref:`OEHermiteShapeFunc <OEShape_OEHermiteShapeFunc>`

   .. oe:method:: operator()

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

         .. oe:api::

            bool operator()(const double* x, double* h, double* g)

      .. oe:language:: python

         .. oe:api:: python

            __call__(x: OEDoubleArray, h: OEDoubleArray, g: OEDoubleArray) -> bool

      This method defines the interface for function evaluation 
      along with gradients and second derivatives. The corresponding second derivatives 
      for the given set of variable is returned in the second argument, and the gradients 
      are returned in the third argument.

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