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

.. oe:namespace:: OEOpt



.. meta::
   :keywords: OEAdaptor, Adaptor


.. _OEOpt_OEAdaptor:

.. oe:class:: OEAdaptor

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEAdaptor

   The :ref:`OEAdaptor <OEOpt_OEAdaptor>` class is a pure virtual base class which defines the interface for
   classes which adapt or transform variables and gradients during an optimization.
   Adaptors are useful in cases where function evaluations are performed in a different 
   coordinate system than the variables being optimized (for example polar coordinates
   are optimized but the function is evaluated in Cartesian coordinates).  

   .. _figure_OEAdaptor_Hierarchy:

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

  The :ref:`OEAdaptor <OEOpt_OEAdaptor>` class defines the following public methods:
   * :oe:meth:`AdaptVar<OEOpt::OEAdaptor::AdaptVar>`         
   * :oe:meth:`GetVar<OEOpt::OEAdaptor::GetVar>`
   
  The following classes derive from this class:   
   * :ref:`OEInterAdaptor <OEMolPotential_OEInterAdaptor>`
   * :ref:`OEMolAdaptor <OEMolPotential_OEMolAdaptor>`
   * :ref:`OEMolAdaptor2 <OEMolPotential_OEMolAdaptor2>`
   * :ref:`OEQuatAdaptor <OEMolPotential_OEQuatAdaptor>`
   * :ref:`OESubsetAdaptor <OEMolPotential_OESubsetAdaptor>`
   * :ref:`OETorAdaptor <OEMolPotential_OETorAdaptor>`
   * :ref:`OETorQuatAdaptor <OEMolPotential_OETorQuatAdaptor>`

   .. oe:method:: AdaptVar

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

         .. oe:api::

            bool AdaptVar(double* ca, const double *) const

      .. oe:language:: python

         .. oe:api:: python

            AdaptVar(ca: OEDoubleArray, arg3: OEDoubleArray) -> bool

      Takes a set of variables as the second argument and copies a set of transformed variables 
      into the first argument. This method is commonly used to transform optimized variables back into 
      the coordinate system of the original reference variables.

   .. oe:method:: GetVar

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

         .. oe:api::

            void GetVar(double* var, const double* refVar)

      .. oe:language:: python

         .. oe:api:: python

            GetVar(var: OEDoubleArray, x: OEDoubleArray) -> None

      Takes reference variables as an argument (``refVar``), and transforms them into the variable type or 
      coordinate system (``var``) that will be used during an optimization. Reference variables normally 
      use the same coordinate system as the function evaluations that will be performed in an 
      optimization.  Many adaptors take Cartesian coordinates as the argument to the method, 
      and return an array of variables containing the initial adapted state, such as torsion angles
      or a quaternion.



