def anim(x,y,z): f = mlab.gcf() plt = mlab.points3d(x,y,z, colormap="copper", scale_factor=.25) while(True): # TODO: Paralelize md.evolve(25) x,y,z = md.get_positions() stats = md.system_stats() print('Temp',stats[-1]) plt.mlab_source.set(x=x, y=y, z=z) f.scene.render() yield
t_max = np.max(t) # Oth step stats = md.system_stats() Ek[0] = stats[0] V[0] = stats[1] Vs[0] = stats[2] P[0] = stats[3] T[0] = stats[4] # perform simulation and count statistics for s in xrange(snapshots): print("step",s*steps_per_snapshot) s += 1 md.evolve(steps_per_snapshot) stats = md.system_stats() Ek[s] = stats[0] V[s] = stats[1] Vs[s] = stats[2] P[s] = stats[3] T[s] = stats[4] # PLOTING STATS np.savetxt('stats.txt',np.array([t,Ek,V,Vs,P,T]).T) #px,py,pz = md.get_momenta() #plt.hist(np.sqrt(px**2+py**2+pz**2)/m,label='|p|',normed=True)