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

.. oe:namespace:: OEConstr

.. meta::
   :keywords: OEHarmonicPotential, HarmonicPotential


.. _OEConstr_OEHarmonicPotential:

.. oe:class:: OEHarmonicPotential

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEHarmonicPotential : public OEMolPotential::OEMolFunc1

   The :ref:`OEHarmonicPotential <OEConstr_OEHarmonicPotential>` class defines harmonic constraint interactions between atoms.

   .. _figure_OEHarmonicPotential_Hierarchy:

   .. figure:: ../images/OEHarmonicPotential.*
      :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:`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>`
    * :oe:meth:`SetupConf<OEMolPotential::OEMolFunc::SetupConf>`

   The :ref:`OEHarmonicPotential <OEConstr_OEHarmonicPotential>` class defines the following public methods:
    * :oe:meth:`Get_dc<OEConstr::OEHarmonicPotential::Get_dc>`
    * :oe:meth:`Get_kc<OEConstr::OEHarmonicPotential::Get_kc>`
    * :oe:meth:`Set<OEConstr::OEHarmonicPotential::Set>`
    * :oe:meth:`Set_dc<OEConstr::OEHarmonicPotential::Set_dc>`
    * :oe:meth:`Set_kc<OEConstr::OEHarmonicPotential::Set_kc>`
   
   .. oe:method:: Constructors

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

         .. oe:api::

            OEHarmonicPotential(double _kc, double _dc)
            OEHarmonicPotential(const OEHarmonicPotential &)

      .. oe:language:: python

         .. oe:api:: python

            OEHarmonicPotential(kc: float, dc: float) -> OEHarmonicPotential
            OEHarmonicPotential(arg2: OEHarmonicPotential) -> OEHarmonicPotential

      Default and copy constructors. Parameters passed in the first constructor correspond
      to k and d in the harmonic potential :math:`V = k(r-d)^2`.

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

      .. oe:api::

         OEHarmonicPotential &operator=(const OEHarmonicPotential&)

      Assignment operator.


   .. oe:method:: Get_dc

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

         .. oe:api::

            double Get_dc() const

      .. oe:language:: python

         .. oe:api:: python

            Get_dc() -> float

      Returns the current value of parameter d (constraining distance) in constraining potential
      :math:`V = k(r-d)^2`.

   .. oe:method:: Get_kc

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

         .. oe:api::

            double Get_kc() const

      .. oe:language:: python

         .. oe:api:: python

            Get_kc() -> float

      Returns the current value of parameter k (force constant) in constraining potential
      :math:`V = k(r-d)^2`. 

   .. oe:method:: Set

      .. oe:api::

         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase>&,
                  unsigned int flag = OEFuncType::HarmonicPot);

      The Set function can be used to set the unary atomic predicate used for the selective 
      constraining of atoms. This function has to be used before Setup(const OEChem::OEMolBase&). 

   .. oe:method:: Set_dc

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

         .. oe:api::

            void Set_dc(double d)

      .. oe:language:: python

         .. oe:api:: python

            Set_dc(dc: float) -> None

      Sets d parameter in :math:`V = k(r-d)^2`.

   .. oe:method:: Set_kc

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

         .. oe:api::

            void Set_kc(double k)

      .. oe:language:: python

         .. oe:api:: python

            Set_kc(kc: float) -> None

      Sets k parameter in :math:`V = k(r-d)^2`.
 

