.. include:: ../substitutions
.. include:: ../../common/cookbook/cookbook-hyperlinks

.. oe:namespace:: OEMolProp

.. meta::
   :keywords: OEGetXLogPResult

.. _OEMolProp_OEGetXLogPResult:

.. oe:function:: OEGetXLogPResult

   .. oe:language:: c++

      .. oe:api:: c++

         OEXLogPResult OEGetXLogPResult(const OEChem::OEMolBase& mol,
                                        float* atomxlogps = 0)

   .. oe:language:: python

      .. oe:api:: python

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

   .. oe:language:: java

      .. oe:api:: java

         OEXLogPResult OEGetXLogPResult(OEMolBase mol, OEFloatArray atomxlogps)
         OEXLogPResult OEGetXLogPResult(OEMolBase mol)

   Returns an :ref:`OEXLogPResult <OEMolProp_OEXLogPResult>` object. The object contains
   the XLogP for the given molecule as described in the :ref:`molprops_logp`
   section and a boolean flag indicating whether or not the computation is
   valid.  The main reason the computation may fail is if one or more atoms
   are not parameterized.  The returned value will be equal to the sum on the
   individual atom contributions plus the linear regression
   constant ``-0.127``.

   .. hint::

      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.

   .. oe:language:: python java csharp

      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>`.

      This function exists to make the calling by wrapped languages more
      convenient.  This function should be **preferred over** the original
      :oe:func:`OEMolProp::OEGetXLogP` function for wrapped languages.

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

      ..    oe:language:: python

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

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

      .. oe:source:: XLogPAtomContributions.cs
         :language: csharp
         :noindent:
         :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**

   .. seealso::

      :ref:`OEXLogPResult <OEMolProp_OEXLogPResult>` class
      :ref:`molprops_logp` section

   .. admonition:: Code Example

      * `Depicting Atom Contributions of XLogP`_ **OpenEye Python Cookbook** recipe
      * `Depicting Fragment Contributions of XLogP`_ **OpenEye Python Cookbook** recipe
