.. # split from OESpicoliFunctions.rst:828


.. oe:namespace:: OESpicoli

.. meta::
   :keywords: OESurfaceToMoleculeDistance

.. oe:function:: OESurfaceToMoleculeDistance

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

      .. oe:api::

         bool OESurfaceToMoleculeDistance(OESurface& surf,
                                          const OEChem::OEMolBase& mol)

   .. oe:language:: python

      .. oe:api:: python

         OESurfaceToMoleculeDistance(surf: OESurface,
                                     mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

   Will calculate the minimum distance between every vertex in the
   surface (surf) and every atom in the molecule (mol). The molecule
   must have valid 3D coordinates assigned. The minimum
   distance for each vertex is then stored on the surface to be
   accessed via the :oe:meth:`OESpicoli::OESurface::GetDistance` and
   :oe:meth:`OESpicoli::OESurface::GetDistanceElement`
   methods. Distances are calculated as the euclidean distance between
   the vertex and atom center minus the atomic radii. Note that this
   can result in distances that are negative to denote that they are
   ``inside`` the molecule. If atomic radii are not specified on the
   molecule BondiVdWRadii will be used.

   This function will also reassign the atom indices associated with
   every vertex of the surface. To access these changes use the
   :oe:meth:`OESpicoli::OESurface::GetAtoms` and
   :oe:meth:`OESpicoli::OESurface::GetAtomsElement` methods.

