code: public static IAtom getClosestAtom(IAtomContainer atomCon, IAtom atom) {
          IAtom closestAtom = null;
          double min = Double.MAX_VALUE;
          Point2d atomPosition = atom.getPoint2d();
          for (int i = 0; i < atomCon.getAtomCount(); i++) {
              IAtom currentAtom = atomCon.getAtom(i);
              if (!currentAtom.equals(atom)) {
                  double d = atomPosition.distance(currentAtom.getPoint2d());
                  if (d < min) {
                      min = d;
                      closestAtom = currentAtom;
                  }
              }
          }
          return closestAtom;
      }
docs: Returns the atom of the given molecule that is closest to the given atom
  (excluding itself).
  
  @param atomCon The molecule that is searched for the closest atom
  @param atom    The atom to search around
  @return        The atom that is closest to the given coordinates