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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEScaledMolFunc, ScaledMolFunc


.. _OEMolPotential_OEScaledMolFunc:

.. oe:class:: OEScaledMolFunc

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEScaledMolFunc : public OEMolFunc2

   The :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>` class allows scaling energies, gradients and hessians of
   a molecule function, with a specified constant.

   .. _figure_OEScaledMolFunc_Hierarchy:

   .. figure:: ../images/OEScaledMolFunc.*
      :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 following methods are publicly inherited from :ref:`OEFunc2 <OEOpt_OEFunc2>`:
    * :oe:meth:`operator()<OEOpt::OEFunc2::operator()>`
   
   The following methods are publicly inherited from :ref:`OEMolFunc <OEMolPotential_OEMolFunc>`:
    * :oe:meth:`Clear<OEMolPotential::OEMolFunc::Clear>`   
    * :oe:meth:`ClearPredicates<OEMolPotential::OEMolFunc::ClearPredicates>`
    * :oe:meth:`GetInteractions<OEMolPotential::OEMolFunc::GetInteractions>`
    * :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>`

   The :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>` class defines the following public methods:
    * :oe:meth:`Set<OEMolPotential::OEScaledMolFunc::Set>`

   .. oe:method:: Constructors

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

         .. oe:api::

            OEScaledMolFunc(OEMolFunc1 &, const double factor, bool own = false)
            OEScaledMolFunc(OEMolFunc2 &, const double factor, bool own = false)

      .. oe:language:: python

         .. oe:api:: python

            OEScaledMolFunc(argFunc: OEMolFunc1, argFactor: float,
                            argOwn: bool = False) -> OEScaledMolFunc
            OEScaledMolFunc(argFunc: OEMolFunc2, argFactor: float,
                            argOwn: bool = False) -> OEScaledMolFunc

      Default and copy constructors.

      The molecule function used for function evaluation and to be scaled must be provided as the first argument to
      the constructor. The second argument specifies the scaling factor. The third argument specifies whether the 
      :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>` object takes ownership of the memory of the molecule
      function instance. By default that does not happen, so the :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>`
      destructor does not delete the molecule function instance. If ownership of the molecule function 
      is transferred to the :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>` instance, the molecule function's
      delete operator will be called in the :ref:`OEScaledMolFunc <OEMolPotential_OEScaledMolFunc>` destructor.

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

      .. oe:api::

         OEScaledMolFunc & operator=(const OEScaledMolFunc &)

      Assignment operator.

   

   .. oe:method:: Set

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

         .. oe:api::

            bool Set(const OESystem::OEUnaryPredicate<OEChem::OEBondBase>& pred,
                     unsigned int functype)
            bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase>& pred,
                     unsigned int functype)
            bool Set(const OESystem::OEBinaryPredicate<OEChem::OEAtomBase, OEChem::OEAtomBase>& pred,
                     unsigned int functype)
            bool Set(const OESystem::OEBinaryPredicate<OEChem::OEBondBase, OEChem::OEBondBase>& pred,
                     unsigned int functype)

      .. oe:language:: python

         .. oe:api:: python

            Set(pred: OEUnaryBondPred, functype: int) -> bool
            Set(pred: OEUnaryAtomPred, functype: int) -> bool
            Set(pred: OEBinaryAtomPred, functype: int) -> bool
            Set(pred: OEBinaryBondPred, functype: int) -> bool

      Predicates are passed directly to the molecule function that is to be scaled.

