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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEInterAdaptor, InterAdaptor


.. _OEMolPotential_OEInterAdaptor:

.. oe:class:: OEInterAdaptor

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEInterAdaptor : public OEMolAdaptor

   The :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` class provides the ability to optimize a molecule
   or conformation with the use of internal coordinates (bond lengths, bond angle bonds and
   dihedral angles) defined by the internal Z-matrix.

   .. _figure_OEInterAdaptor_Hierarchy:

   .. figure:: ../images/OEInterAdaptor.*
      :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:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` class defines the following public methods:
    * :oe:meth:`AdaptGrad<OEMolPotential::OEInterAdaptor::AdaptGrad>`
    * :oe:meth:`Set<OEMolPotential::OEInterAdaptor::Set>`

   .. oe:method:: Constructors

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

         .. oe:api::

            OEInterAdaptor(OEMolFunc1 &, bool dihedrals = true,
                           bool own = false)

      .. oe:language:: python

         .. oe:api:: python

            OEInterAdaptor(arg2: OEMolFunc1, dihedrals: bool = True,
                           own: bool = False) -> OEInterAdaptor

      The molecule function used for function evaluation must be provided as the first argument to 
      the constructor. The second argument allows to fix all dihedral angles. By default all
      dihedral angles are optimized. The third argument specifies whether the 
      :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` object takes ownership of the memory of the molecule
      function instance. By default the :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` instance does not take
      ownership of the molecule function, so the :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` destructor does
      not delete the molecule function instance. If ownership of the molecule function is transferred 
      to the :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` instance, the molecule function's delete operator
      will be called in the :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>` destructor.

      Default and copy constructors.

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

      .. oe:api::

         OEInterAdaptor & operator=(const OEInterAdaptor &)

      Assignment operator.

   

   .. oe:method:: AdaptGrad

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

         .. oe:api::

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

      .. oe:language:: python

         .. oe:api:: python

            AdaptGrad(ga: OEDoubleArray, g: OEDoubleArray) -> bool

      Transforms the set of Cartesian gradients passed as a second argument to the method, into
      a set of internal coordinates gradients and copies them into the array passed as a first
      argument.

   .. oe:method:: Set

      .. oe:api::

         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase>&,
                  unsigned int functype = OEFuncType::InterAdapt)
         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEBondBase>&,
                  unsigned int functype = OEFuncType::InterAdapt)

      Those two methods assign atom and bond predicates which are used to partially restrict molecules
      during optimization. First method specifies atoms which are to be held fixed in their starting
      positions. Second method is used to fix dihedral angles a1-a2-a3-a4 defined by a middle bond a2-a3.    
      Both methods :oe:meth:`Set<OEMolPotential::OEInterAdaptor::Set>` must be called before the method
      derived from :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>`. 


