.. oe:namespace:: OEPB



.. meta::
   :keywords: OEArea, Area


.. _OEPB_OEArea:

.. oe:class:: OEArea

   .. oe:api::


      class OEArea

   Calculates surface area using the same grid-based Gaussians that
   Zap uses. Mostly used for calculating the area term
   in solvation calculations or the buried area term in bind
   calculations.

   
   .. oe:method:: Constructors

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

         .. oe:api::

            OEArea()
            OEArea(const OEArea &)

      .. oe:language:: python

         .. oe:api:: python

            OEArea() -> OEArea
            OEArea(arg2: OEArea) -> OEArea

      Default and copy constructors.

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

      .. oe:api::

         OEArea &operator=(const OEArea &)

      Assignment operator.

.. _OEPB_OEArea_GetArea:

   .. oe:method:: GetArea

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

         .. oe:api::

            float GetArea(const OEChem::OEMolBase& mol)
            bool GetArea(const OEChem::OEMolBase& mol, float* atomArea)
            float GetArea(const OEChem::OEMolBase& mol,
                          const OEChem::OEResidue& res)
            float GetArea(const OEChem::OEMolBase& mol, const float* atomArea,
                          const OEChem::OEResidue& res)

      .. oe:language:: python

         .. oe:api:: python

            GetArea(mol: Union[OEGraphMol,OEMol,OEQMol]) -> float
            GetArea(mol: Union[OEGraphMol,OEMol,OEQMol], atomArea: OEFloatArray) -> bool
            GetArea(mol: Union[OEGraphMol,OEMol,OEQMol], res: OEResidue) -> float
            GetArea(mol: Union[OEGraphMol,OEMol,OEQMol],
                    atom_area: OEFloatArray, res: OEResidue) -> float

      Calculate the surface area of the passed-in molecule. The first
      version calculates the surface area of the entire molecule. The
      second version takes an array sized by ``OEMolBase::GetMaxAtomIdx`` to return the contribution of each
      atom to the total surface area. The third and fourth versions calculates and returns the surface area of the residue passed into the function. 
      The fourth version differs from the third version by taking a already calculated atom area array, which avoids calculating atom area repeatedly.

      Note that whether or not hydrogens are included in these calculations is 
      controlled by :oe:meth:`OEPB::OEArea::SetUseHydrogens` which is set to ``false`` by default.

      The following demonstrates how to calculate
      the area of a molecule:

      .. oe:source:: OEArea_GetArea.cpp
         :language: c++
         :noindent:
         :frag:     SNIPPET-GetArea-Molecule
         :caption:  Example of calculating the surface area of a molecule

      .. oe:source:: OEArea_GetArea.py
         :language: python
         :noindent:
         :frag:     SNIPPET-GetArea-Molecule
         :caption:  Example of calculating the surface area of a molecule

      .. oe:language:: python

        :ref:`Full listing. <listing-OEArea_GetArea.py>`



      .. oe:source:: OEArea_GetArea.java
         :language: java
         :noindent:
         :frag:     SNIPPET-GetArea-Molecule
         :caption:  Example of calculating the surface area of a molecule

      .. oe:source:: OEArea_GetArea.cs
         :language: csharp
         :noindent:
         :frag:     SNIPPET-GetArea-Molecule
         :caption:  Example of calculating the surface area of a molecule

      The following demonstrates how to retrieve the individual atom
      contributions to the surface area:

      .. oe:source:: OEArea_GetArea.cpp
         :language: c++
         :noindent:
         :frag:     SNIPPET-GetArea-Atoms
         :caption:  Example of calculating the surface area contribution of individual atoms

      .. oe:source:: OEArea_GetArea.py
         :language: python
         :noindent:
         :frag:     SNIPPET-GetArea-Atoms
         :caption:  Example of calculating the surface area contribution of individual atoms

      .. oe:language:: python

        :ref:`Full listing. <listing-OEArea_GetArea.py>`

      .. oe:source:: OEArea_GetArea.java
         :language: java
         :noindent:
         :frag:     SNIPPET-GetArea-Atoms
         :caption:  Example of calculating the surface area contribution of individual atoms

      .. oe:source:: OEArea_GetArea.cs
         :language: csharp
         :noindent:
         :frag:     SNIPPET-GetArea-Atoms
         :caption:  Example of calculating the surface area contribution of individual atoms


      The following demonstrates how to retrieve the per residue contributions to the surface area:

      .. oe:source:: OEArea_GetArea.cpp
         :language: c++
         :noindent:
         :frag:     SNIPPET-GetArea-Residues
         :caption:  Example of calculating the surface area contribution of indivdual residues

      .. oe:source:: OEArea_GetArea.py
         :language: python
         :noindent:
         :frag:     SNIPPET-GetArea-Residues
         :caption:  Example of calculating the surface area contribution of indivdual residues


      .. oe:language:: python

        :ref:`Full listing. <listing-OEArea_GetArea.py>`

      .. oe:source:: OEArea_GetArea.java
         :language: java
         :noindent:
         :frag:     SNIPPET-GetArea-Residues
         :caption:  Example of calculating the surface area contribution of indivdual residues

      .. oe:source:: OEArea_GetArea.cs
         :language: csharp
         :noindent:
         :frag:     SNIPPET-GetArea-Residues
         :caption:  Example of calculating the surface area contribution of indivdual residues

      The following demonstrates how to retrieve the per residue contributions to the surface area,
      in an optimized way where the per atom contributions are pre-calculated and used for the residue
      based calculation. This is particularly important if this calculation is done on a large set of residues:

      .. oe:source:: OEArea_GetArea.cpp
         :language: c++
         :noindent:
         :frag:     SNIPPET-GetArea-Residues-Optimized
         :caption:  Example of calculating the surface area contribution of indivdual residues

      .. oe:source:: OEArea_GetArea.py
         :language: python
         :noindent:
         :frag:     SNIPPET-GetArea-Residues-Optimized
         :caption:  Example of calculating the surface area contribution of indivdual residues


      .. oe:language:: python

        :ref:`Full listing. <listing-OEArea_GetArea.py>`

      .. oe:source:: OEArea_GetArea.java
         :language: java
         :noindent:
         :frag:     SNIPPET-GetArea-Residues-Optimized
         :caption:  Example of calculating the surface area contribution of indivdual residues

      .. oe:source:: OEArea_GetArea.cs
         :language: csharp
         :noindent:
         :frag:     SNIPPET-GetArea-Residues-Optimized
         :caption:  Example of calculating the surface area contribution of indivdual residues

.. _OEPB_OEArea_GetMethod:

   .. oe:method:: GetMethod

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

         .. oe:api::

            unsigned int GetMethod() const

      .. oe:language:: python

         .. oe:api:: python

            GetMethod() -> int

      Returns an ``int`` indicating the method that is used to model
      the area of the molecule.  The two possible return values are
      :oe:const:`OEPB::OEAreaMethod::Gaussian` and :oe:const:`OEPB::OEAreaMethod::Discrete`.

.. _OEPB_OEArea_GetUseHydrogens:

   .. oe:method:: GetUseHydrogens

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

         .. oe:api::

            bool GetUseHydrogens() const

      .. oe:language:: python

         .. oe:api:: python

            GetUseHydrogens() -> bool

      Returns a ``bool`` where ``true`` means explicit hydrogens are
      turned on and ``false`` means they are turned off for the area
      calculation.

.. _OEPB_OEArea_SetMethod:

   .. oe:method:: SetMethod

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

         .. oe:api::

            bool SetMethod(const unsigned int method)

      .. oe:language:: python

         .. oe:api:: python

            SetMethod(method: int) -> bool

      Takes an ``int`` with the value of
      :oe:const:`OEPB::OEAreaMethod::Gaussian` of
      :oe:const:`OEPB::OEAreaMethod::Discrete`

.. _OEPB_OEArea_SetUseHydrogens:


   .. oe:method:: SetUseHydrogens

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

         .. oe:api::

            bool SetUseHydrogens(bool state)

      .. oe:language:: python

         .. oe:api:: python

            SetUseHydrogens(state: bool) -> bool

      This method takes a ``bool`` where ``true`` turns on explicit
      hydrogens for calculating area and ``false`` turn them off.
