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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OETorQuatAdaptor, TorQuatAdaptor


.. _OEMolPotential_OETorQuatAdaptor:

.. oe:class:: OETorQuatAdaptor

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OETorQuatAdaptor : public OEMolAdaptor

   The :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>` class provides the ability to optimize a molecule
   in coordinate space by a combination of rotation, translation and torsion changes.
   This class combines the functionality of both :ref:`OEQuatAdaptor <OEMolPotential_OEQuatAdaptor>` and
   :ref:`OETorAdaptor <OEMolPotential_OETorAdaptor>` classes. Its main application is optimization of ligands
   in the potential generated by protein-receptor, in the case when ligand's bond lengths and 
   bond angles are chosen to be fixed.

   .. _figure_OETorQuatAdaptor_Hierarchy:

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

   The following methods are publicly inherited from :ref:`OEAdaptor <OEOpt_OEAdaptor>`:
    * :oe:meth:`AdaptVar<OEOpt::OEAdaptor::AdaptVar>` 
    * :oe:meth:`GetVar<OEOpt::OEAdaptor::GetVar>`

   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>`

   The following methods are publicly inherited from :ref:`OEMolAdaptor <OEMolPotential_OEMolAdaptor>`:
    * :oe:meth:`SetMolFunc<OEMolPotential::OEMolAdaptor::SetMolFunc>`

   The :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>` class defines the following public methods:
    * :oe:meth:`AdaptGrad<OEMolPotential::OETorQuatAdaptor::AdaptGrad>`
    * :oe:meth:`Set<OEMolPotential::OETorQuatAdaptor::Set>`

   .. oe:method:: Constructors

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

         .. oe:api::

            OETorQuatAdaptor(OEMolFunc1 &, bool own = false,
                             bool excludeInteract = true)

      .. oe:language:: python

         .. oe:api:: python

            OETorQuatAdaptor(arg2: OEMolFunc1, own: bool = False,
                             excludeInteract: bool = True) -> OETorQuatAdaptor

      Default and copy constructors.

      The molecule function used for function evaluation must be provided as the first argument to the 
      constructor. The second argument specifies whether the :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>`
      object takes ownership of the memory of the molecule function instance. By default the
      :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>` instance does not take ownership of the molecule function,
      so the :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>` destructor does not delete the molecule function
      instance. If ownership of the molecule function is transferred to the
      :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>` instance, the molecule function's delete operator will
      be called in the :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>` destructor. The third argument
      controls the inclusion of invariant molecule function interactions. By default, interactions
      which remain constant during the torsion minimization are excluded from calculation (for
      example  bond stretch interactions). If the third calling argument is ``false`` then all
      interactions will be computed during every function evaluation.

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

      .. oe:api::

         OETorQuatAdaptor & operator=(const OETorQuatAdaptor &)

      Assignment operator.

   

   .. oe:method:: AdaptGrad

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

         .. oe:api::

            bool AdaptGrad(double *, const double *, const double *) const

      .. oe:language:: python

         .. oe:api:: python

            AdaptGrad(arg2: OEDoubleArray, arg3: OEDoubleArray,
                      arg4: OEDoubleArray) -> bool

      Transforms a set of the input Cartesian gradients passed to the method as a second argument,
      into torsional-rotational-translational gradients which are copied to the first argument array.
      The third argument to the method is an array of the current quaternion and translational vector. 

   .. oe:method:: Set

      .. oe:api::

         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &p,
                  unsigned int f = OEFuncType::TorAdapt)
         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &p,
                  unsigned int f = OEFuncType::TorAdapt)

      The first method assigns an atom predicate which is used to specify atoms which are to be held fixed in their starting positions during an optimization. The second method assigns a bond predicate which is used to determine which bonds of a molecule are to be rotated during an optimization. Both the :oe:meth:`Set<OEMolPotential::OETorQuatAdaptor::Set>` methods must be called before the :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>` for it to be effective.


