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

.. oe:namespace:: OEConstr

.. meta::
   :keywords: OEDihedralQuadPenalty, DihedralQuadPenalty


.. _OEConstr_OEDihedralQuadPenalty:

.. oe:class:: OEDihedralQuadPenalty

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEDihedralQuadPenalty : public OEMolPotential::OEMolFunc2

   The :ref:`OEDihedralQuadPenalty <OEConstr_OEDihedralQuadPenalty>` class defines harmonic restraints to dihedrals or torsions.
   The restraint is applied on the cosine of the angle, in the form of :math:`K*(cos(\alpha) - cos(\alpha_0))^2`.


   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>`
    * :oe:meth:`SetupConf<OEMolPotential::OEMolFunc::SetupConf>`

   The :ref:`OEDihedralQuadPenalty <OEConstr_OEDihedralQuadPenalty>` class defines the following public methods:
    * :oe:meth:`GetPenaltyConstant<OEConstr::OEDihedralQuadPenalty::GetPenaltyConstant>`
    * :oe:meth:`GetSpecifiedAngle<OEConstr::OEDihedralQuadPenalty::GetSpecifiedAngle>`
   
   .. oe:method:: Constructors

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

         .. oe:api::

            OEDihedralQuadPenalty(const OEChem::OEAtomBase& a1,
                                  const OEChem::OEAtomBase& a2,
                                  const OEChem::OEAtomBase& a3,
                                  const OEChem::OEAtomBase& a4, double alpha0,
                                  double fc = 1e4)
            const OEChem::OEAtomBase& a1, const OEChem::OEAtomBase& a2, const OEChem::OEAtomBase& a3, const OEChem::OEAtomBase& a4, double alpha0, double K)
            OEDihedralQuadPenalty(const OEDihedralQuadPenalty &)

      .. oe:language:: python

         .. oe:api:: python

            OEDihedralQuadPenalty(a1: OEAtomBase, a2: OEAtomBase,
                                  a3: OEAtomBase, a4: OEAtomBase,
                                  alpha0: float, fc: float = 1e4) -> OEDihedralQuadPenalty
            OEDihedralQuadPenalty(arg2: OEDihedralQuadPenalty) -> OEDihedralQuadPenalty

      Default and copy constructors.
      Arguments `a1-a4` correspond to the four atoms that define the dihedral to be restrained, `alpha0`
      corresponds to the specified angle, and `K` corresponds to the penalty force constant. 

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

      .. oe:api::

         OEDihedralQuadPenalty &operator=(const OEDihedralQuadPenalty&)

      Assignment operator.


   .. oe:method:: GetPenaltyConstant

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

         .. oe:api::

            double GetPenaltyConstant() const

      .. oe:language:: python

         .. oe:api:: python

            GetPenaltyConstant() -> float

      Returns the current value of the penalty force constant.

   .. oe:method:: GetSpecifiedAngle

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

         .. oe:api::

            double GetSpecifiedAngle() const

      .. oe:language:: python

         .. oe:api:: python

            GetSpecifiedAngle() -> float

      Returns the current value of the specified angle `alpha0`.
