def get_nn_info(self, structure, n):
        """
        Get all near-neighbor sites as well as the associated image locations
        and weights of the site with index n using the closest neighbor
        distance-based method.

        Args:
            structure (Structure): input structure.
            n (integer): index of site for which to determine near
                neighbors.
 
        Returns:
            siw (list of tuples (Site, array, float)): tuples, each one
                of which represents a neighbor site, its image location,
                and its weight.
        """

        site = structure[n]
        neighs_dists = structure.get_neighbors(site, self.cutoff)

        siw = []
        if self.get_all_sites == True:
            for s, dist in neighs_dists:
                    w = dist
                    siw.append({'site': s,
                                'image': self._get_image(structure, s),
                                'weight': w,
                                'site_index': self._get_original_site(structure,
                                                                  s)})
        else:
            min_dist = min([dist for neigh, dist in neighs_dists])
            for s, dist in neighs_dists:
                if dist < (1.0 + self.tol) * min_dist:
                    w = min_dist / dist
                    siw.append({'site': s,
                                'image': self._get_image(structure, s),
                                'weight': w,
                                'site_index': self._get_original_site(structure,
                                                                  s)})
        return siw