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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEMolAdaptor2, MolAdaptor2


.. _OEMolPotential_OEMolAdaptor2:

.. oe:class:: OEMolAdaptor2

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEMolAdaptor2 : public OEMolPotential:: OEMolAdaptor, public OEMolPotential:: OEMolFunc2

   The :ref:`OEMolAdaptor2 <OEMolPotential_OEMolAdaptor2>` class is a pure virtual base class which defines the interface for
   classes which adapt or transform molecular coordinates, gradients, and hessians of a given 
   :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>` during an optimization.
   Adaptors are useful in cases where energy, gradients and hessians evaluation for a molecule or conformation
   are performed in Cartesian coordinates, but the optimization is done in different coordinate
   system.

   .. _figure_OEMolAdaptor2_Hierarchy:

   .. figure:: ../images/OEMolAdaptor2.*
      :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:`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:`Set<OEMolPotential::OEMolFunc::Set>`
    * :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:`OEMolAdaptor2 <OEMolPotential_OEMolAdaptor2>` class defines the following public methods:
    * :oe:meth:`SetMolFunc2<OEMolPotential::OEMolAdaptor2::SetMolFunc2>`

   The following classes derive from this class:  
    * :ref:`OESubsetAdaptor <OEMolPotential_OESubsetAdaptor>`


   .. oe:method:: SetMolFunc2

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

         .. oe:api::

            bool SetMolFunc2(OEMolFunc2& molfunc, bool own)=0

      .. oe:language:: python

         .. oe:api:: python

            SetMolFunc2(molfunc: OEMolFunc2, own: bool) -> bool

      Defines the interface for resetting the molecule function, :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>`, within a
      :ref:`OEMolAdaptor2 <OEMolPotential_OEMolAdaptor2>` derived instance. Any molecule functions which are
      "owned" at the time of calling this method will be deleted. If the value of a second argument 
      passed to the method is ``true``, the adaptor derived from :ref:`OEMolAdaptor2 <OEMolPotential_OEMolAdaptor2>`
      will take ownership of the memory of the molecule function, and will call the molecule function's 
      delete operator when either the destructor or the current method is called.  

 
