コード例 #1
0
ファイル: dna.py プロジェクト: cdknorow/MD
def find_lifetime(M):
    import MD.analysis.lifetime as lifetime
    conn = _connections(M)
    life = []
    for i in range(3):
        life.append(lifetime.lifetime(conn[i:])[:len(conn)-3])
    life_avg = []
    for i in range(len(life[0])):
        avg = 0
        for j in range(len(life)):
            avg += life[j][i]/float(len(life))
        life_avg.append(avg)
    pyplot.plot(range(len(life_avg)),life_avg,xlabel='Time',
            ylabel='remain connections', save='lifetime')
コード例 #2
0
ファイル: NP_sphere.py プロジェクト: cdknorow/MD
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()