def test_list(self): particle_positions = np.array([[19, -18]]) box_space = np.array([4, 4]) cutoff = 1 s1 = Neighbourlist(particle_positions, box_space, cutoff) print(s1.calculate_index(np.array([-1, 1]))) print(s1.cell_neighbour_list_2D())
def test_cnlist2d_1(self): particle_positions = np.array([[9, 6], [4, 5], [1, 3]]) box_space = np.array([12, 13]) cutoff = 3 s1 = Neighbourlist(particle_positions, box_space, cutoff) reference_CnList = np.array([ [13, 14, 15, 12, 1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8], [1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12], [5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12, 1, 2, 3, 0], [12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3], [15, 12, 13, 14, 3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10], [3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, 10, 15, 12, 13, 14], [7, 4, 5, 6, 11, 8, 9, 10, 15, 12, 13, 14, 3, 0, 1, 2] ]) cnlist = s1.cell_neighbour_list_2D() sorted_referenceCnList = np.sort(reference_CnList, axis=0) sorted_outputCnList = np.sort(cnlist[:, :, 0], axis=0) npt.assert_equal(sorted_referenceCnList, sorted_outputCnList, 'Failed', verbose=True)