def test_get_neighborhood_single(self):
     struct = CrystalStructure(elements='Al',
                               lattice_constants=4,
                               bravais_basis='fcc')
     neigh = struct.get_neighborhood(np.random.random(3), cutoff_radius=3)
     distances = neigh.distances.copy()
     neigh.allow_ragged = False
     self.assertTrue(np.array_equal(neigh.distances, distances))
     neigh.allow_ragged = True
     self.assertTrue(np.array_equal(neigh.distances, distances))
     neigh.allow_ragged = False
     self.assertTrue(np.array_equal(neigh.distances, distances))
 def test_get_neighborhood(self):
     struct = CrystalStructure(elements='Al',
                               lattice_constants=4,
                               bravais_basis='fcc')
     struct.positions += 0.01 * (
         2 * np.random.random(struct.positions.shape) - 1)
     struct = struct.center_coordinates_in_unit_cell()
     positions = np.random.random((2, 3)).dot(struct.cell)
     neigh = struct.get_neighborhood(positions)
     positions = np.random.random((2, 3)).dot(struct.cell)
     new_neigh = neigh.get_neighborhood(positions)
     self.assertTrue(
         np.array_equal(new_neigh.distances,
                        neigh.get_distances(positions)))
     self.assertTrue(
         np.array_equal(new_neigh.vecs, neigh.get_vectors(positions)))
     self.assertTrue(
         np.array_equal(new_neigh.indices, neigh.get_indices(positions)))