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

.. oe:namespace:: OEFF



.. meta::
   :keywords: OEComplexFF, ComplexFF


.. _OEFF_OEComplexFF:

.. oe:class:: OEComplexFF

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEComplexFF : public OEMolPotential::OEMolFunc2

   The :ref:`OEComplexFF <OEFF_OEComplexFF>` is a generic class for force-fields of complexes.  This
   class defines an interface for combining multiple :ref:`OEForceField <OEMolPotential_OEForceField>` to
   easily construct a force field for a host/guest or protein/ligand complex. The 
   :ref:`OEComplexFF <OEFF_OEComplexFF>` extends the :ref:`OEMolFunc2 <OEMolPotential_OEMolFunc2>` class to allow
   this being a collection of multiple force fields.

   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:`OEComplexFF <OEFF_OEComplexFF>` class defines the following public methods:
    * :oe:meth:`AdaptHostCoords<OEFF::OEComplexFF::AdaptHostCoords>`
    * :oe:meth:`GetLigandFF<OEFF::OEComplexFF::GetLigandFF>`
    * :oe:meth:`GetVar<OEFF::OEComplexFF::GetVar>`
    * :oe:meth:`Set<OEFF::OEComplexFF::Set>`
    * :oe:meth:`SetHostFlex<OEFF::OEComplexFF::SetHostFlex>`
    * :oe:meth:`SetNonBondCutoff<OEFF::OEComplexFF::SetNonBondCutoff>`
    * :oe:meth:`SetupHost<OEFF::OEComplexFF::SetupHost>`

   The following classes derive from this class:
    * :ref:`OEMMFFComplex <OEFF_OEMMFFComplex>`
    * :ref:`OESmirnoffComplex <OEFF_OESmirnoffComplex>`
    * :ref:`OEMMFFAmberComplex <OEFF_OEMMFFAmberComplex>`
    * :ref:`OEFF14SBSmirnoffComplex <OEFF_OEFF14SBSmirnoffComplex>`


   .. oe:method:: Constructors

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

         .. oe:api::

            OEComplexFF(const OEMolPotential::OEForceField& ligandFF,
                        const OEMolPotential::OEForceField& hostFF,
                        const OEMolPotential::OEInterMolFunc2& interFF)
            OEComplexFF(const OEComplexFF&)

      .. oe:language:: python

         .. oe:api:: python

            OEComplexFF(ligandFF: OEForceField, hostFF: OEForceField,
                        interFF: OEInterMolFunc2) -> OEComplexFF
            OEComplexFF(arg2: OEComplexFF) -> OEComplexFF

      Default and copy constructors.

      Construction of a :ref:`OEComplexFF <OEFF_OEComplexFF>` requires a :ref:`OEForceField <OEMolPotential_OEForceField>`
      for the guest or the ligand molecule, a :ref:`OEForceField <OEMolPotential_OEForceField>`
      for the host or the protein molecule, and an :ref:`OEInterMolFunc2 <OEMolPotential_OEInterMolFunc2>` for the
      inter-molecular interactions.

   .. oe:method:: AdaptHostCoords

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

         .. oe:api::

            bool AdaptHostCoords(double* coords, const double* var) const

      .. oe:language:: python

         .. oe:api:: python

            AdaptHostCoords(coords: OEDoubleArray, var: OEDoubleArray) -> bool

      Takes a set of variables as the second argument and provides the corresponding host molecule 
      coordinates into the first argument. This method is used to obtain optimized coordinates for 
      the flexible host or protein molecule.


.. _OEFF_OEComplexFF_GetLigandFF:

   .. oe:method:: GetLigandFF

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

         .. oe:api::

            const OEMolPotential::OEForceField& GetLigandFF() const

      .. oe:language:: python

         .. oe:api:: python

            GetLigandFF() -> OEForceField

      Returns reference to the underlying forcefield used for small molecules.

   .. oe:method:: GetVar

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

         .. oe:api::

            void GetVar(double* var, const double* coords)

      .. oe:language:: python

         .. oe:api:: python

            GetVar(var: OEDoubleArray, x: OEDoubleArray) -> None

      Takes reference coordinates of the molecule, and transforms them into the variable type or 
      coordinate system (``var``) that will be used during an optimization. The transfored variables
      here provides the combined host/guest coordinates, whenoptimization involves flexible host or 
      protein molecule.

   .. 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, and only applies to the guest or the 
      ligand molecule. 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 passes 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<OEFF::OEComplexFF::Set>` must be called before the 
      :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>` for it to be effective.


.. _OEFF_OEComplexFF_SetHostFlex:

   .. oe:method:: SetHostFlex

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

         .. oe:api::

            bool SetHostFlex(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase>& pred)

      .. oe:language:: python

         .. oe:api:: python

            SetHostFlex(pred: OEUnaryAtomPred) -> bool

      Set predicate to define the flexible portion of the host or protein molecule.  If no predicate
      is set to define flexibility, the host or protein is considered rigid. 

      :oe:meth:`SetHostFlex<OEFF::OEComplexFF::SetHostFlex>` must be called before the 
      :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>` for it to be effective.


.. _OEFF_OEComplexFF_SetNonBondCutoff:

   .. 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 non-bonded interactions cutoff.
      Setting a value of ``0.0`` or less assumes that all interactions should be
      included without any cutoff.
      
   .. oe:method:: SetupHost

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

         .. oe:api::

            bool SetupHost(const OEChem::OEMolBase& host)

      .. oe:language:: python

         .. oe:api:: python

            SetupHost(host: Union[OEGraphMol,OEMol,OEQMol]) -> bool

      This method defines the interface for initializing the host in the :ref:`OEComplexFF <OEFF_OEComplexFF>`.

      :oe:meth:`SetupHost<OEFF::OEComplexFF::SetupHost>` must be called before calling 
      :oe:meth:`Setup<OEMolPotential::OEMolFunc::Setup>` .

