.. oe:namespace:: OEMolProp

.. meta::
   :keywords: OEGetXLogP

.. _OEMolProp_OEGetXLogP:

.. oe:function:: OEGetXLogP

   .. oe:language:: c++

      .. oe:api:: c++

         bool OEGetXLogP(const OEChem::OEMolBase& mol, float& xlogp,
                         float* atomxlogps = 0)

   .. oe:language:: python

      .. oe:api:: python

         OEGetXLogP(mol: Union[OEGraphMol,OEMol,OEQMol],
                    atomxlogps: OEFloatArray = None) -> bool

   .. oe:language:: java

      .. oe:api:: java

         float OEGetXLogP(OEMolBase mol, OEFloatArray atomxlogps)
         float OEGetXLogP(OEMolBase mol)

   Returns the XLogP for a given molecule as described in the
   :ref:`molprops_logp` section. The returned value will be equal to
   the sum on the individual atom contributions plus the linear
   regression constant ``-0.127``.

   .. oe:language:: python java csharp

      .. note::

         The C++ version of this function uses a pointer-to-argument to indicate
         the success or failure of the computation. This idiom doesn't map
         directly to the wrapped languages, so the wrapped versions of
         :oe:func:`OEMolProp::OEGetXLogP`
         use exceptions to signal failure.  This is not optimal. Hence, for the
         wrapped languages, the **preferred method for computing XLogP** is
         :oe:func:`OEMolProp::OEGetXLogPResult`.
         It does not use exceptions and is much cleaner to use in the wrapped languages.

   .. oe:language:: c++

      The ``atomxlogps`` parameter can be used to retrieve the contribution
      of each atom to the total XLogP as shown in
      :oe:src:`Listing 2<XLogPAtomContributions>`.
      See example in :ref:`Figure: Example of depicting the atom contributions
      of the XLogP<figure_OEGetXLogP>`.

      .. oe:source:: XLogPAtomContributions.cpp
         :language: c++
         :frag:     SNIPPET-ATOMS
         :caption: Example of retrieving individual atom contributions to XLogP
         :refnum: 2

      .. _figure_OEGetXLogP:

      .. figure:: ../../../common/images/molprop/OEGetXLogP.*
         :align:  center

         **Example of depicting the atom contributions of the XLogP**

   .. note::

      XLogP should be calculated on the neutral form of the molecule.
      Therefore, calling the :oe:func:`OEProton::OERemoveFormalCharge` function
      of **Quacpac TK** is highly recommended prior to the XLogP calculation.

   .. seealso::

      * :oe:func:`OEMolProp::OEGetXLogPResult` function
      * :ref:`molprops_logp` section
