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

.. oe:namespace:: OEMolPotential



.. meta::
   :keywords: OEForceField, ForceField


.. _OEMolPotential_OEForceField:

.. oe:class:: OEForceField

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEForceField : public OEMolFunc1

   The :ref:`OEForceField <OEMolPotential_OEForceField>` is an abstract base class.  This class defines
   an interface for the collection of force field components. The :ref:`OEForceField <OEMolPotential_OEForceField>`
   extends the :ref:`OEMolFunc1 <OEMolPotential_OEMolFunc1>` class to allow this being a collection of multiple
   components. The collection of components into a force field needs to be done concomitant with one or
   more :ref:`OEFFParams <OEMolPotential_OEFFParams>` derived classes.

   .. _figure_OEForceField_Hierarchy:

   .. figure:: ../images/OEForceField.*
      :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 :ref:`OEForceField <OEMolPotential_OEForceField>` class defines the following public methods:
    * :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 following classes derive from this class:
    * :ref:`OEGenericFF <OEMolPotential_OEGenericFF>`
    * :ref:`OEGenericFF2 <OEMolPotential_OEGenericFF2>`
    * :ref:`OEMMFF <OEMolMMFF_OEMMFF>`
    * :ref:`OEMMFFIEFF <OEFF_OEMMFFIEFF>`

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

      .. oe:api::

         OEForceField & operator=(const OEForceField &)

      Assignment operator.



   .. oe:method:: GetTitle

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

         .. oe:api::

            std::string GetTitle() const

      .. oe:language:: python

         .. oe:api:: python

            GetTitle() -> str

      See :oe:meth:`SetTitle<OEMolPotential::OEForceField::SetTitle>`.

   .. _OEMolPotential_OEForceField_HasCoulomb:

   .. oe:method:: HasCoulomb

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

         .. oe:api::

            bool HasCoulomb() const

      .. oe:language:: python

         .. oe:api:: python

            HasCoulomb() -> bool

      Returns if coulombic interactions are currently turned on.


   .. _OEMolPotential_OEForceField_HasInternalCharges:


   .. oe:method:: HasInternalCharges

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

         .. oe:api::

            bool HasInternalCharges() const

      .. oe:language:: python

         .. oe:api:: python

            HasInternalCharges() -> bool

      Returns True if associated force field parameters has internal charges.


   .. oe:method:: PrepMol

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

         .. oe:api::

            bool PrepMol(OEChem::OEMolBase& mol, bool sweep = true,
                         bool warnOK = true) const

      .. oe:language:: python

         .. oe:api:: python

            PrepMol(mol: Union[OEGraphMol,OEMol,OEQMol], sweep: bool = True,
                    warnOK: bool = True) -> bool

      Defines the interface to prepare a molecule to be used for force field setup
      (:oe:meth:`OEMolPotential::OEMolFunc::Setup`). This method internally calls
      for all contained :ref:`OEFFParams <OEMolPotential_OEFFParams>` instances in the
      :ref:`OEForceField <OEMolPotential_OEForceField>` derived class to perform necessary preparation
      to enable using those parameters.

      The second argument to the method specifies
      whether a call to :oe:meth:`OEChem::OEMolBase::Sweep` is allowed during the preparation.
      By default, sweeping a molecule is allowed by the method. Methods that override
      :oe:meth:`OEMolPotential::OEFFParams::PrepMol` may alter the contents of the passed molecule.

      Method returns ``true`` if preparation is successful, and ``false`` otherwise.

      .. seealso::

         * :ref:`section_FFEnergy_example` example


   .. oe:method:: Set

      .. oe:api::

         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &pred,
                  unsigned int functype)
         bool Set(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &pred,
                  unsigned int functype)
         bool Set(const OESystem::OEBinaryPredicate<OEChem::OEAtomBase,OEChem::OEAtomBase> &pred,
                  unsigned int functype)
         bool Set(const OESystem::OEBinaryPredicate<OEChem::OEBondBase,OEChem::OEBondBase> &pred,
                  unsigned int functype)

      These methods assigns interaction-control predicates. The first argument is the predicate type to
      be passed to the interaction component.
      The second argument is a value or a set of binary OR'ed values taken from the :oe:const:`OEMolPotential::OEFuncType`
      namespace which specifies the intended target for the predicate assignment.

      The set method passed on the interaction-control predicates to the appropriate force field components contained. Method returns ``false`` if predicate was not set to any of the components contained by the force field.

      :oe:meth:`Set<OEMolPotential::OEForceField::Set>` must be called before the :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>` for it to be effective.


   .. oe:method:: SetNonBondCutoff

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

         .. oe:api::

            bool SetNonBondCutoff(const double)

      .. oe:language:: python

         .. oe:api:: python

            SetNonBondCutoff(arg2: float) -> bool

      Sets the non-bonded interactions cutoff, in angstroms.


   .. oe:method:: SetTitle

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

         .. oe:api::

            void SetTitle(const std::string&)

      .. oe:language:: python

         .. oe:api:: python

            SetTitle(argTitle: str) -> None

      Title for the force field.
