def compute_rdf(outfile, beadtype, nbins=30): """Compute RDF from the xyz frame uusing Fortran routine, distance matrix and binning""" A = read_outfile(outfile) xyz = A[A[:, 0] == beadtype][:, 1:] rdf_raw, r = f_rdf.pair_dist_hist(xyz, nbins) # key routine r = r[:-1] + np.diff(r)/2.0 dr = r[1] - r[0] rdf = rdf_raw/(4*pi*r**2 * dr) return r, rdf
def compute_rdf_water(outfile, nbins=30): """Compute radial dist'n fcn from the xyz frame using Fortran routine, both distance matrix and binning""" A = read_outfile(outfile) xyz_C = A[A[:, 0] == 3][:, 1:] xyz_W = A[A[:, 0] == 4][:, 1:] rdf_raw_C, r = f_rdf.pair_dist_hist(xyz_C, nbins) # print " Bead C pair dist and binning beads done" rdf_raw_W, r = f_rdf.pair_dist_hist(xyz_W, nbins) # print " Bead W pair dist and binning beads done" rdf_raw_CW, r = f_rdf.pair_dist_hist2(xyz_C, xyz_W, nbins) # print " Beads C and W pair dist and binning beads done" rdf_raw = rdf_raw_C * 3**2 + rdf_raw_W * 6**2 + rdf_raw_CW * 3*6 r = r[:-1] + np.diff(r)/2.0 dr = r[1] - r[0] rdf = rdf_raw/(4*pi*r**2 * dr) return r, rdf