def get_rdf_list(pos, r, nbin, frames, elements): """ pos: a list of atoms object r: the radial length nbin: the bin number in the radial range frames: how much pos number will you consider elements: the atom pair """ tmp_info = Analysis(pos) # this wil get a rdf for every snapshot tmp_rdf_list = tmp_info.get_rdf(r, nbin, imageIdx=slice(0, frames, 1), elements=elements) return tmp_rdf_list
crystal1 = read(filename1) corrdinates = crystal.get_positions() cell_length = crystal.get_cell_lengths_and_angles() cell_length = cell_length[0:3] # only select the cell length dr = 0.01 # shperical shell radius dr min_length_cell = min(cell_length) # select the smalles length in cell rmax = (min_length_cell / 2) - 0.1 # 2*rmax < min_length_cell bins = np.rint((min_length_cell / 3) * 100) bins = bins.astype(int) rdf = Analysis(crystal) rdf2 = Analysis(crystal1) g = rdf.get_rdf(rmax, bins) g_r = rdf.get_rdf(rmax, bins) r = np.linspace(0, rmax, bins) y1 = np.array(g) y = np.array(g_r) y1 = np.transpose(y1) y = np.transpose(y) print(np.count_nonzero(y)) plt.figure() plt.plot(r, y, color='black') plt.plot(r, y1, color='blue') plt.xlabel('r') plt.ylabel('g(r)') plt.xlim((0, rmax))