def end_end(V,W,M,L): T=M.cord_auto(['T']) K=M.cord_auto(['K']) V=M.cord_auto(['V']) W=M.cord_auto(['W']) ndna = T.shape[1]/V.shape[1] #K-V #W-T VK=[] WT=[] last = V.shape[0] #find center-ssdna particle distance for k in range(last-5,last): for i in range(V.shape[1]): for j in range(ndna): VK.append(points.dist(V[k][i],K[k][j+i*ndna],L)[0]-3) WT.append(points.dist(W[k][i],T[k][j+i*ndna],L)[0]-3) hist_K,xK,max_k=histogram(VK,10) hist_T,xT,max_T=histogram(WT,10) plt.close() pyplot.plot_bar(xK,hist_K,save='VK_distance') plt.close() pyplot.plot_bar(xT,hist_T,save='WT_distance') plt.close() #find the length of the polymer KT=M.cord_auto(['K','T']) S=M.cord_auto(['M']) edge=[] for k in range(last-5,last): for i in range(S.shape[1]): edge.append(points.dist(KT[k][i],S[k][i],L)[0]) hist_edge,xedge,max_edge=histogram(edge,50) pyplot.plot_bar(xedge,hist_edge,save='polymer_length') plt.close()
def msd_jump_average(VW,L): reload(diffuse) try: jump_d = util.pickle_load('jump_d.pkl') jump_t = util.pickle_load('jump_t.pkl') except: fid = open('large.xyz','r') M = readxyz.ReadCord(trajectory = 'large.xyz',frames = 777) crystal = M.cord_auto(['V','W']) bcc = np.zeros((777,432,1)) for frame in range(bcc.shape[0]): for i in range(bcc.shape[1]): if crystal[frame][i][0] > L[0]: bcc[frame][i]=0 else: bcc[frame][i]=1 jump_d, jump_t = diffuse.crystal_jump(VW,bcc,L) util.pickle_dump(jump_d,'jump_d.pkl') util.pickle_dump(jump_t,'jump_t.pkl') pyplot.plot(jump_t,jump_d,'','s',xlabel='time',ylabel='jump distance',save='msd_jump') hist_s,xs,max_hist=histogram(jump_d,bins=20) pyplot.plot(xs,hist_s,xlabel='distance',ylabel='count',save='jump_hist')
def hist(M1,M2,save_name,label): distance=particle_distance(M1,M2,L) hist_s,xs,max_hist=histogram(distance,bins=50) return xs,hist_s