Example #1
0
def species_mixing(V,W,L,n_finish=1,n_start=0,delta=100,rcut=False):
    #The total number of frames we are going to look at
    if rcut == False:
        rcut=min_particle_distance(V[-1:],W[-1:],L)+6
    print rcut
    #rcut = 19
    rcut = 22
    n_frames = (n_finish-n_start)/delta
    x = np.arange(n_start,n_finish,delta)
    s = []
    o = []
    for k in x:
        Same = 0
        Other = 0
        print k
        for i in range(V[k].shape[0]):
            Same += len(nearest_neighbors_point(V[k],V[k][i],L,rcut)[0])
            Same += len(nearest_neighbors_point(W[k],W[k][i],L,rcut)[0])
            Other += len(nearest_neighbors_point(W[k],V[k][i],L,rcut)[0])
            Other += len(nearest_neighbors_point(V[k],W[k][i],L,rcut)[0])
        s.append(float(Same)/(W[k].shape[0]+V[k].shape[0]))
        o.append(float(Other)/(V[k].shape[0]+W[k].shape[0]))
    print s
    print o
    util.pickle_dump([x,s,o],'mix.pkl')
    pyplot.plot2(x, s, x, o, label1='Same',
            label2='other', save=('mixing_avg_cut%.1f'%rcut), showleg=True)
Example #2
0
def mixing_frame(V,W,L,frame,rcut=False):
    #The total number of frames we are going to look at
    #rcut = 19
    rcut = 22
    k = frame
    Same = []
    Other = []
    print k
    for k in range(frame,frame+10):
        for i in range(V[k].shape[0]):
            Same.append(len(nearest_neighbors_point(V[k],V[k][i],L,rcut)[0]))
            Same.append(len(nearest_neighbors_point(W[k],W[k][i],L,rcut)[0]))
            Other.append(len(nearest_neighbors_point(W[k],V[k][i],L,rcut)[0]))
            Other.append(len(nearest_neighbors_point(V[k],W[k][i],L,rcut)[0]))
    hist_same, x_s = histogram_reg(Same,8)
    hist_other, x_o = histogram_reg(Other,8)
    pyplot.plot_bar(x_o, hist_other, label='other', save=('mix_other%i'%k), showleg=True)
    pyplot.plot_bar(x_s, hist_same, label='Same',
            save=(('mix_same_frame%i_rcut%.1f')%(k,rcut)), showleg=True,color='r')