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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEInteraction, Interaction


.. _OEMolPotential_OEInteraction:

.. oe:class:: OEInteraction

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEInteraction

   The :ref:`OEInteraction <OEMolPotential_OEInteraction>` class provides a general mechanism to report individual
   interactions calculated within a function or force field component. For instance, pairwise atom 
   interactions in an intramolecular VdW component calculation can be obtained by the 
   :oe:meth:`OEMolPotential::OEMolFunc::GetInteractions` method that returns an iterator over 
   the :ref:`OEInteraction <OEMolPotential_OEInteraction>` instances.

   The :ref:`OEInteraction <OEMolPotential_OEInteraction>` class defines the following public methods:
    * :oe:meth:`GetAtoms<OEMolPotential::OEInteraction::GetAtoms>`
    * :oe:meth:`GetName<OEMolPotential::OEInteraction::GetName>`
    * :oe:meth:`GetValues<OEMolPotential::OEInteraction::GetValues>`
    * :oe:meth:`NumAtoms<OEMolPotential::OEInteraction::NumAtoms>`
    * :oe:meth:`NumValues<OEMolPotential::OEInteraction::NumValues>`
   
   .. oe:method:: Constructors

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

         .. oe:api::

            OEInteraction(OEInteractImpl &)
            OEInteraction(const OEInteraction &)

      .. oe:language:: python

         .. oe:api:: python

            OEInteraction(arg2: OEInteractImpl) -> OEInteraction
            OEInteraction(arg2: OEInteraction) -> OEInteraction

      Default and copy constructors.

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

      .. oe:api::

         OEInteraction &operator=(const OEInteraction &)

      Assignment operator.


   .. oe:method:: GetAtoms

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

         .. oe:api::

            OESystem::OEIterBase<OEChem::OEAtomBase>* GetAtoms() const

      .. oe:language:: python

         .. oe:api:: python

            GetAtoms() -> OEAtomIter

      Returns an iterator over the atoms involved in the calculated interaction.

   .. oe:method:: GetName

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

         .. oe:api::

            const char* GetName() const

      .. oe:language:: python

         .. oe:api:: python

            GetName() -> str

      Returns a clear text human readable identifier for the type of interaction.

   .. oe:method:: GetValues

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

         .. oe:api::

            double GetValues(double* grads = 0) const

      .. oe:language:: python

         .. oe:api:: python

            GetValues(grads: OEDoubleArray = None) -> float

      Returns the energy associated with the calculated interaction. The associated gradients may also 
      be obtained by passing in an array of the length returned by the 
      :oe:meth:`OEMolPotential::OEInteraction::NumValues` method. The derivatives correspond to the atom 
      ordering returned by the :oe:meth:`OEMolPotential::OEInteraction::GetAtoms` method.

   .. oe:method:: NumAtoms

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

         .. oe:api::

            unsigned NumAtoms() const

      .. oe:language:: python

         .. oe:api:: python

            NumAtoms() -> int

      Returns the number of atoms involved in the calculated interactions. One-body interactions, 
      such as an atom in a field, will only have one atom involved in the interaction. VdW interactions 
      will consist of two atoms.  Torsions are composed of four interacting atoms.

   .. oe:method:: NumValues

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

         .. oe:api::

            unsigned NumValues() const

      .. oe:language:: python

         .. oe:api:: python

            NumValues() -> int

      Returns the number of gradients associated with the particular interaction. For interactions 
      calculated from Cartesian coordinates of atoms, this method will typically return three times 
      the number of atoms involved in the interaction as x, y, and z gradient values are calculated 
      for each atom.

