# OEGetNearestNbrs¶

OESystem::OEIterBase<OENbrs> *
OEGetNearestNbrs(const OEMolBase &mol, double maxdist,
unsigned int method=OENearestNbrsMethod::Default)


Returns an iterator over all atom pairs of the given molecule that are closer to each other than the given limit.

maxdist
The maximum distance between two atoms.
method
Determines the algorithm that is used to find the nearest neighbors. This value has to be from the OENearestNbrsMethod namespace.
OESystem::OEIterBase<OENbrs> *
OEGetNearestNbrs(const OEMolBase &mol,
const OEAtomBase *atom,
double maxdist,
unsigned int method=OENearestNbrsMethod::Default);


Returns an iterator over all neighbors of the given atom that is closer than the given limit.

atom
This atom does not have to belong to the given molecule.
maxdist
The maximum distance between two atoms.
method
Determines the algorithm that is used to find the nearest neighbors. This value has to be from the OENearestNbrsMethod namespace.
OESystem::OEIterBase<OENbrs> *
OEGetNearestNbrs(const OEMolBase &mol,
const float *coords,
double maxdist,
unsigned int method=OENearestNbrsMethod::Default)

OESystem::OEIterBase<OENbrs> *
OEGetNearestNbrs(const OEMolBase &mol,
const double *coords,
double maxdist,
unsigned int method=OENearestNbrsMethod::Default)


Returns an iterator over all atom pairs of the given molecule that are closer to each other than the given limit. When calculating the distances the coordinates passed as a parameter are utilized rather then the coordinates stored in the molecule.

maxdist
The maximum distance between two atoms.
method
Determines the algorithm that is used to find the nearest neighbors. This value has to be from the OENearestNbrsMethod namespace.
OESystem::OEIterBase<OENbrs> *
OEGetNearestNbrs(const OEMolBase &mol1,
const OEMolBase &mol2, double maxdist,
unsigned int method=OENearestNbrsMethod::Default,
const bool sorting = false)


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

maxdist
The maximum distance between two atoms.
method
Determines the algorithm that is used to find the nearest neighbors. This value has to be from the OENearestNbrsMethod namespace.
sorting
If the value is set to true, the returned atom pairs are sorted based on the distance from the shortest to the longest. The default value is false.