.. oe:namespace:: OEPB

.. meta::
   :keywords: OEZap, Zap


.. _OEPB_OEZap:

.. oe:class:: OEZap

   .. oe:api::

      class OEZap

   The principal interface for Poisson-Boltzmann electrostatics calculations.
   Stores a molecule and computes solvation energies, potential grids, and
   atomic potentials using an implicit solvent model. See
   :oe:meth:`OEPB::OEZap::SetMolecule` for molecule preparation requirements.
   
   .. oe:method:: Constructors

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

         .. oe:api::

            OEZap()
            OEZap(const OEZap& rhs)

      .. oe:language:: python

         .. oe:api:: python

            OEZap() -> OEZap
            OEZap(rhs: OEZap) -> OEZap

      Default and copy constructors.

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

      .. oe:api::

         OEZap &operator=(const OEZap &rhs)

      Assignment operator.

   .. oe:method:: CalcAtomPotentials

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

         .. oe:api::

            bool CalcAtomPotentials(float* pot, bool no_grid = false)

      .. oe:language:: python

         .. oe:api:: python

            CalcAtomPotentials(pot: OEFloatArray, no_grid: bool = False) -> bool

      Calculates the atom potentials and fills the ``float`` array
      with their values.  The ``float`` array should be of length
      ``N``, where ``N`` is the number of atoms.

   .. oe:method:: CalcForces

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

         .. oe:api::

            bool CalcForces(float* forces)

      .. oe:language:: python

         .. oe:api:: python

            CalcForces(forces: OEFloatArray) -> bool

      Calculates the forces on the atoms and fills the ``float``
      array with the values of their x, y, and z components.  The
      ``float`` array should be of length ``3N``, where ``N``
      is the number of atoms.

   .. oe:method:: CalcPotentialGrid

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

         .. oe:api::

            bool CalcPotentialGrid(OESystem::OEScalarGrid& grid)

      .. oe:language:: python

         .. oe:api:: python

            CalcPotentialGrid(grid: OEScalarGrid) -> bool

      Calculates the potential grid and updates the ``OEScalarGrid``
      with the values. The calculated electrostatic potential is
      a dimensionless value defined as eV/kT where eV is the electric work,
      in kcal/mol, of bringing an electron charge to the point with
      potential V, and kT = 0.59 kcal/mol (value of kT at room temperature).

   .. oe:method:: CalcSolvationEnergy

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

         .. oe:api::

            float CalcSolvationEnergy()

      .. oe:language:: python

         .. oe:api:: python

            CalcSolvationEnergy() -> float

      Returns the solvation energy in kT of the molecule that has been set.
      This result does not include an area term.

   .. oe:method:: ClearFocusTarget

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

         .. oe:api::

            void ClearFocusTarget()

      .. oe:language:: python

         .. oe:api:: python

            ClearFocusTarget() -> None

      Clears the target setting for focusing.

   .. oe:method:: GetBoundarySpacing

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

         .. oe:api::

            float GetBoundarySpacing() const

      .. oe:language:: python

         .. oe:api:: python

            GetBoundarySpacing() -> float

      Returns the boundary spacing setting, which is the amount of
      distance between the molecule and the edge of the grid.  The
      default setting is 4.0.

   .. oe:method:: GetDielectricModel

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

         .. oe:api::

            unsigned int GetDielectricModel() const

      .. oe:language:: python

         .. oe:api:: python

            GetDielectricModel() -> int

      Returns an ``int`` representing the dielectric model being
      used.  The two available models are
      :oe:const:`OEPB::OEZapDielectricModel::Gaussian` and
      :oe:const:`OEPB::OEZapDielectricModel::Molecular`.

   .. oe:method:: GetError

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

         .. oe:api::

            float GetError() const

      .. oe:language:: python

         .. oe:api:: python

            GetError() -> float

      Returns the error setting.  See :oe:meth:`OEPB::OEZap::SetError`.

   .. oe:method:: GetFocusTarget

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

         .. oe:api::

            const OEChem::OEMolBase* GetFocusTarget() const

      .. oe:language:: python

         .. oe:api:: python

            GetFocusTarget() -> OEGraphMol

      Returns a pointer to the molecule that has been set as the focus target.

   .. oe:method:: GetGridSpacing

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

         .. oe:api::

            float GetGridSpacing() const

      .. oe:language:: python

         .. oe:api:: python

            GetGridSpacing() -> float

      Returns the setting for the grid spacing.  The default value is 0.5.

   .. oe:method:: GetInnerDielectric

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

         .. oe:api::

            float GetInnerDielectric() const

      .. oe:language:: python

         .. oe:api:: python

            GetInnerDielectric() -> float

      Returns the setting for the internal dielectric constant.  The default value is 1.0.

   .. oe:method:: GetIterations

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

         .. oe:api::

            unsigned int GetIterations() const

      .. oe:language:: python

         .. oe:api:: python

            GetIterations() -> int

      Returns the maximum number of iterations allowed for the zap
      calculation. The default value is 10.

   .. oe:method:: GetMolecule

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

         .. oe:api::

            const OEChem::OEMolBase* GetMolecule() const

      .. oe:language:: python

         .. oe:api:: python

            GetMolecule() -> OEGraphMol

      Returns a pointer to the molecule that has been set to Zap.

   .. oe:method:: GetOuterDielectric

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

         .. oe:api::

            float GetOuterDielectric() const

      .. oe:language:: python

         .. oe:api:: python

            GetOuterDielectric() -> float

      Returns the setting for the outer dielectric constant.  The default value is 80.0.

   .. oe:method:: GetProbeRadius

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

         .. oe:api::

            float GetProbeRadius() const

      .. oe:language:: python

         .. oe:api:: python

            GetProbeRadius() -> float

      Returns the setting for the probe radius.  The default value is 1.4.

   .. oe:method:: GetVerbose

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

         .. oe:api::

            bool GetVerbose() const

      .. oe:language:: python

         .. oe:api:: python

            GetVerbose() -> bool

      Returns the setting for very low-level verbosity.  The default value is false.


   .. oe:method:: GetSaltConcentration

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

         .. oe:api::

            float GetSaltConcentration() const

      .. oe:language:: python

         .. oe:api:: python

            GetSaltConcentration() -> float

      Returns the setting for the salt concentration.  The default value is 0.0.

   .. oe:method:: IsFocusTargetSet

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

         .. oe:api::

            bool IsFocusTargetSet()

      .. oe:language:: python

         .. oe:api:: python

            IsFocusTargetSet() -> bool

      Returns a ``bool`` for whether the focus target is currently
      set.  See the section of focusing for more information.

   .. oe:method:: SetBoundarySpacing

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

         .. oe:api::

            bool SetBoundarySpacing(float spacing)

      .. oe:language:: python

         .. oe:api:: python

            SetBoundarySpacing(spacing: float) -> bool

      Sets the boundary spacing, which is the amount of distance
      between the molecule and the edge of the grid.  The default
      setting is 4.0.

   .. oe:method:: SetDielectricModel

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

         .. oe:api::

            bool SetDielectricModel(unsigned int model)

      .. oe:language:: python

         .. oe:api:: python

            SetDielectricModel(model: int) -> bool

      Sets the dielectric model.  The two available models are
      :oe:const:`OEPB::OEZapDielectricModel::Gaussian` and
      :oe:const:`OEPB::OEZapDielectricModel::Molecular`.  The default is the
      Gaussian model.

   .. oe:method:: SetError

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

         .. oe:api::

            bool SetError(float zaperr)

      .. oe:language:: python

         .. oe:api:: python

            SetError(zaperr: float) -> bool

      Rather than setting the grid spacing, the acceptable error may
      be set instead using this method.  The default value is set to
      0.0, which means that the grid spacing is set explicitly.

   .. oe:method:: SetFocusTarget

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

         .. oe:api::

            bool SetFocusTarget(const OEChem::OEMolBase& mol)

      .. oe:language:: python

         .. oe:api:: python

            SetFocusTarget(mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

      Sets the focus target.  See the section of :ref:`section_focusing` for more information.

   .. oe:method:: SetGridSpacing

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

         .. oe:api::

            bool SetGridSpacing(float spacing)

      .. oe:language:: python

         .. oe:api:: python

            SetGridSpacing(spacing: float) -> bool

      Sets the grid spacing.  The default value is 0.5.

   .. oe:method:: SetInnerDielectric

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

         .. oe:api::

            bool SetInnerDielectric(float epsin)

      .. oe:language:: python

         .. oe:api:: python

            SetInnerDielectric(epsin: float) -> bool

      Sets the internal dielectric constant.  The default value is 1.0.

   .. oe:method:: SetIterations

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

         .. oe:api::

            bool SetIterations(unsigned int iters)

      .. oe:language:: python

         .. oe:api:: python

            SetIterations(iters: int) -> bool

      Sets the maximum number of iterations allowed for the zap
      calculation.  The default value is 10

   .. oe:method:: SetMolecule

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

         .. oe:api::

            bool SetMolecule(const OEChem::OEMolBase& mol)

      .. oe:language:: python

         .. oe:api:: python

            SetMolecule(mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

      Sets the molecule to Zap.  Partial charges, 3-D coordinates, and
      radii need to be set to the molecule before the molecule is set
      to Zap.

   .. oe:method:: SetOuterDielectric

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

         .. oe:api::

            bool SetOuterDielectric(float epsout)

      .. oe:language:: python

         .. oe:api:: python

            SetOuterDielectric(epsout: float) -> bool

      Sets the external dielectric constant.  The default value is 80.0.

   .. oe:method:: SetProbeRadius

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

         .. oe:api::

            bool SetProbeRadius(float radius)

      .. oe:language:: python

         .. oe:api:: python

            SetProbeRadius(radius: float) -> bool

      Sets the probe radius, the default value is 1.4.

   .. oe:method:: SetSaltConcentration

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

         .. oe:api::

            bool SetSaltConcentration(float conc)

      .. oe:language:: python

         .. oe:api:: python

            SetSaltConcentration(conc: float) -> bool

      Sets the salt concentration.  The default value is 0.0.

   .. oe:method:: SetVerbose

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

         .. oe:api::

            bool SetVerbose(bool verbose)

      .. oe:language:: python

         .. oe:api:: python

            SetVerbose(verbose: bool)

      Sets very low-level verbosity.  The default value is false.

