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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEGenericFF, GenericFF


.. _OEMolPotential_OEGenericFF:

.. oe:class:: OEGenericFF

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEGenericFF : public OEMolPotential::OEForceField

   The :ref:`OEGenericFF <OEMolPotential_OEGenericFF>` class facilitates creation of a user defined
   force field. The force field instance can be extended by 
   adding internally or externally defined potential functions.

   .. _figure_OEGenericFF_Hierarchy:

   .. figure:: ../images/OEGenericFF.*
      :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:`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:`OEGenericFF <OEMolPotential_OEGenericFF>` class defines the following public methods:
    * :oe:meth:`AddMolFunc<OEMolPotential::OEGenericFF::AddMolFunc>`
    * :oe:meth:`GetComponents<OEMolPotential::OEGenericFF::GetComponents>`
    * :oe:meth:`RemoveMolFunc<OEMolPotential::OEGenericFF::RemoveMolFunc>`          

   The following classes derive from this class:
    * :ref:`OEMMFFIEFF <OEFF_OEMMFFIEFF>`

   .. oe:method:: Constructors

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

         .. oe:api::

            OEGenericFF()

      .. oe:language:: python

         .. oe:api:: python

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

      Default and copy constructors.

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

      .. oe:api::

         OEGenericFF & operator=(const OEGenericFF &)

      Assignment operator.

   

   .. oe:method:: AddMolFunc

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

         .. oe:api::

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

      .. oe:language:: python

         .. oe:api:: python

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

      This method defines the interface for adding externally declared functions 
      to an :ref:`OEGenericFF <OEMolPotential_OEGenericFF>` derived instance. The second argument denotes
      whether the :ref:`OEGenericFF <OEMolPotential_OEGenericFF>` 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:`OEGenericFF <OEMolPotential_OEGenericFF>` derived class. Any object
      derived from the :ref:`OEMolFunc1 <OEMolPotential_OEMolFunc1>` may be added using this method. The method
      returns ``true`` if the object of :ref:`OEMolFunc1 <OEMolPotential_OEMolFunc1>` is successfully added. Only
      one copy of a :ref:`OEMolFunc1 <OEMolPotential_OEMolFunc1>` may be added to an :ref:`OEGenericFF <OEMolPotential_OEGenericFF>`
      instance. Subsequent attempts to add the same function object to already contained in a
      :ref:`OEGenericFF <OEMolPotential_OEGenericFF>` derived class will fail with a return value of ``false``.

   .. oe:method:: GetComponents

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

         .. oe:api::

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

      .. oe:language:: python

         .. oe:api:: python

            GetComponents() -> OEMolFunc1Vector

      Method returns a vector of pointers to the currently contained :ref:`OEMolFunc1 <OEMolPotential_OEMolFunc1>` instances on this :ref:`OEGenericFF <OEMolPotential_OEGenericFF>`.

   .. oe:method:: RemoveMolFunc

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

         .. oe:api::

            bool RemoveMolFunc(OEMolPotential::OEMolFunc1&)

      .. oe:language:: python

         .. oe:api:: python

            RemoveMolFunc(f: OEMolFunc1) -> bool

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