.. oe:namespace:: OEChem

.. meta::
   :keywords: OENearestNbrs, NearestNbrs


.. _OEChem_OENearestNbrs:

.. oe:class:: OENearestNbrs

   .. oe:api::

      class OENearestNbrs

   This class represents `OENearestNbrs`.
   
   .. oe:method:: Constructors

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

         .. oe:api::

            OENearestNbrs(const OEMolBase& mol, double maxdist,
                          unsigned int method = OENearestNbrsMethod::Default)

      .. oe:language:: python

         .. oe:api:: python

            OENearestNbrs(mol: Union[OEGraphMol,OEMol,OEQMol], maxdist: float,
                          method: int) -> OENearestNbrs

      Creates an :ref:`OENearestNbrs <OEChem_OENearestNbrs>` object for nearest neighbor
      search.

      method
        Determines the algorithm that is used to find the nearest neighbors.
        This value has to be from the :oe:const:`OEChem::OENearestNbrsMethod` namespace.

   .. oe:method:: GetNbrs

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

         .. oe:api::

            OESystem::OEIterBase<OENbrs>* GetNbrs(const float* coords) const

      .. oe:language:: python

         .. oe:api:: python

            GetNbrs(coords: float) -> OENbrsIter

      Returns an iterator over all atom pairs of the molecule that are closer
      to each other than the **maxdist** limit.
      When calculating the distances the coordinates passed as a parameter are
      utilized rather then the coordinates stored in the molecule of which
      the :ref:`OENearestNbrs <OEChem_OENearestNbrs>` was initialized.

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

         .. oe:api::

            OESystem::OEIterBase<OENbrs>* GetNbrs(const OEMolBase& mol) const

      .. oe:language:: python

         .. oe:api:: python

            GetNbrs(mol: Union[OEGraphMol,OEMol,OEQMol]) -> OENbrsIter

      Returns an iterator over all atoms that are closer to the given atom than
      the **maxdist** limit.

      Returns an iterator over all atom pairs of the two molecules that are closer
      to each other than the **maxdist** limit.
      This function calculates **intra-molecular** distances.

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

         .. oe:api::

            OESystem::OEIterBase<OENbrs>* GetNbrs(const OEAtomBase* atom) const

      .. oe:language:: python

         .. oe:api:: python

            GetNbrs(atom: OEAtomBase) -> OENbrsIter

      Returns an iterator over all atoms that are closer to the given atom than
      the **maxdist** limit.

   .. seealso::

      * :oe:func:`OEChem::OEGetNearestNbrs` function
      * :oe:func:`OEChem::OENbrs` class
