Example #1
0
def index_msd(VW,index,L,t,save='msd_index'):
    #skip = VW.shape[0]/len(surface)
    skip = 1
    spheres = np.zeros((t,len(index),3))
    for f in range(t):
        for i,j in enumerate(index):
            spheres[f][i] = VW[f*skip][j]
    x, MSD = msd_no_drift(spheres,L)
    pyplot_eps.plot(x,MSD,xlabel='t',ylabel=r'$\sqrt{<(r(t)-r(0))^2>}$',save=save)
    return x,MSDj
Example #2
0
def find_lifetime(M,L,steps,temp,step_range=30,delta=4,rcut=1.0,step=5e4):
    import MD.analysis.lifetime as life
    try:
        C = util.pickle_load('C.pkl')
        G = util.pickle_load('G.pkl')
    except:
        C=M.cord_auto(['C'])
        G=M.cord_auto(['G'])
        util.pickle_dump(C,'C.pkl')
        util.pickle_dump(G,'G.pkl')
    #The total number of frames we are going to look at
    for i in steps:
        try:
            print 'Frame',i,'Temp',temp[i]
        except:
            print i
        x=np.arange(i,step_range+i,delta)
        #Find he number of connections at specific points x
        remain = life.lifetime(C[x],G[x],L)
        x=np.arange(i,step_range+i,delta)*50000
        print remain
        pyplot_eps.plot(x,remain,xlabel='time', ylabel='remaining connections',
                save='lifetime%i'%i)
        plt.close()
Example #3
0
def find_networks(M, VW, L, n_finish=1, n_start=0, delta=30, rcut=1.0, ndna=25):
    #The total number of frames we are going to look at
    x=np.arange(n_start,n_finish,delta)
    print len(x)
    #Find the number of connections at specific points x
    import MD.canalysis.connections as con
    import MD.analysis.connections as conn
    import MD.analysis.graph as graph
    try:
        connections = util.pickle_load('con.pkl')
    except:
        try:
            C = util.pickle_load('C.pkl')
            G = util.pickle_load('G.pkl')
        except:
            G=M.cord_auto(['G'])
            C=M.cord_auto(['C'])
            util.pickle_dump(C,'C.pkl')
            util.pickle_dump(G,'G.pkl')
        connections = con.connections(C[x],G[x],L,rcut=rcut)
        util.pickle_dump(connections,'con.pkl')
    #plot total number of connections
    num_connections=conn.num_connections(connections,VW.shape[1])
    con_all = []
    for i in range(len(connections)):
        con_all.append(len(connections[i])/2.)
    pyplot.plot(x,num_connections,xlabel='Time',
            ylabel='hyrbid. density', save='connections')
    pyplot.plot(x,con_all,xlabel='Time',
            ylabel='hyrbid', save='connections_all')
    plt.close()
    #get the info
    networks, num_networks, deg, neighbors, num_n, gr = graph.grapher(connections,VW.shape[1],ndna)
    util.pickle_dump(networks,'net.pkl')
    #plot the number of neighbors at each timesteps
    pyplot_eps.plot(x,num_n,xlabel='Time',
            ylabel='num neighbors', save='neighbors')
    plt.close()
    print 'making plot'
    net = []
    for i in networks:
        net.append(len(i))
    pyplot_eps.plot(x,net,xlabel='t',ylabel='networks',save='net')
    label = ['networks','1','2','3','4','5','6','7','8','9']
    pyplot_eps.plot(x,networks,xlabel='t',ylabel='Networks',save='net')
    pyplot.plot_multi(x,deg,label,xlabel='time',ylabel='number',save='con_net')
    return x, networks, connections