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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEGenericFF2, GenericFF


.. _OEMolPotential_OEGenericFF2:

.. oe:class:: OEGenericFF2

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEGenericFF2 : public OEMolPotential::OEForceField,  public OEMolPotential::OEMolFunc2

   The :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` class facilitates creation of a user defined
   force field of type :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>`. The force field instance can be
   extended by adding internally or externally defined potential functions.

   .. _figure_OEGenericFF2_Hierarchy:

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

   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:`Setup<OEMolPotential::OEMolFunc::Setup>`

   The following methods are publicly inherited from :ref:`OEForceField <OEMolPotential_OEForceField>`:
    * :oe:meth:`GetTitle<OEMolPotential::OEForceField::GetTitle>` and
      :oe:meth:`SetTitle<OEMolPotential::OEForceField::SetTitle>`
    * :oe:meth:`HasCoulomb<OEMolPotential::OEForceField::HasCoulomb>`
    * :oe:meth:`HasInternalCharges<OEMolPotential::OEForceField::HasInternalCharges>`
    * :oe:meth:`PrepMol<OEMolPotential::OEForceField::PrepMol>`
    * :oe:meth:`Set<OEMolPotential::OEForceField::Set>`
    * :oe:meth:`SetNonBondCutoff<OEMolPotential::OEForceField::SetNonBondCutoff>`

   The :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` class defines the following public methods:
    * :oe:meth:`AddMolFunc<OEMolPotential::OEGenericFF2::AddMolFunc>`
    * :oe:meth:`GetComponents<OEMolPotential::OEGenericFF2::GetComponents>`
    * :oe:meth:`RemoveMolFunc<OEMolPotential::OEGenericFF2::RemoveMolFunc>`          

   The following classes derive from this class:
    * :ref:`OEMMFF <OEMolMMFF_OEMMFF>`

   .. oe:method:: Constructors

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

         .. oe:api::

            OEGenericFF2()

      .. oe:language:: python

         .. oe:api:: python

            OEGenericFF2() -> OEGenericFF2
            OEGenericFF2(arg2: OEGenericFF2) -> OEGenericFF2

      Default and copy constructors.

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

      .. oe:api::

         OEGenericFF2 & operator=(const OEGenericFF2 &)

      Assignment operator.

   

   .. oe:method:: AddMolFunc

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

         .. oe:api::

            bool AddMolFunc(OEMolPotential::OEMolFunc2& f, bool own = false)

      .. oe:language:: python

         .. oe:api:: python

            AddMolFunc(f: OEMolFunc2, own: bool = False) -> bool

      This method defines the interface for adding externally declared functions 
      to an :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` derived instance. The second argument denotes
      whether the :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` derived instance is to take ownership of
      the memory occupied by the external function. If ownership is passed, then it would be 
      deleted during destruction of the :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` derived class. Any object
      derived from the :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>` may be added using this method. The method
      returns ``true`` if the object of :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>` is successfully added. Only
      one copy of a :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>` may be added to an :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>`
      instance. Subsequent attempts to add the same function object to already contained in a
      :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` derived class will fail with a return value of ``false``.

   .. oe:method:: GetComponents

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

         .. oe:api::

            std::vector<OEMolPotential::OEMolFunc2*> GetComponents() const

      .. oe:language:: python

         .. oe:api:: python

            GetComponents() -> OEMolFunc2Vector

      Method returns a vector of pointers to the currently contained :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>` instances on this :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>`.

   .. oe:method:: RemoveMolFunc

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

         .. oe:api::

            bool RemoveMolFunc(OEMolPotential::OEMolFunc2&)

      .. oe:language:: python

         .. oe:api:: python

            RemoveMolFunc(f: OEMolFunc2) -> bool

      Defines an interface to remove a function previously added to an :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>`
      instance. If the function is not contained in the :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>` instance
      then the method will return ``false``. If the function is found and removed successfully, then the 
      method will return ``true``.
