Esempio n. 1
0
def Qmapq6q4(M,L,count=14,crystal=6,verbose=False,rcut=30):
    #Find nearest neighbors for all particles and convert to spherical
    #######
    #neighbors[i][0]=index of neighbors
    #neighbors[i][1]=array[i][x,y,z] of distance between neighbors
    ########
    neighbors=[]
    print 'getting neighbors'
    for i in range(M.shape[0]):
        N = nn.count_neighbors_index(M,i,L,count=count, rcut=rcut,vectors=True)
        if len(N[0]) != count:
            print 'lenght of N', len(N[0])
        neighbors.append([N[0],xyz_to_spherical(N[1])])
        #include itself
        neighbors[-1][0].append(i)
        if verbose:
            print 'neighbors',len(N[0])
    #find qlm of each particle 
    #######
    #store as values m=-l-l in nparray
    #Qlm[i]=np.array(ql-m:ql+m) for particle i
    #Qlm[i]=qlm(i)
    ######
    print 'generating qlm matrix'
    l=4
    qlm_matrix=np.zeros((M.shape[0],2*l+1),dtype=complex)
    for i in range(M.shape[0]):
        for m in range(-l,l+1):
            qlm_matrix[i][m+l]=qlm(neighbors[i][1],l,m)
    Ql4=np.zeros((M.shape[0]),dtype=complex)
    print 'generating Ql_avg'
    for i in range(M.shape[0]):
        qlm_avg=np.zeros((2*l+1),dtype=complex)
        for m in range(-l,l+1):
            for k in neighbors[i][0]:
                qlm_avg[m+l] += qlm_matrix[k,m+l]
            qlm_avg[m+l]/=len(neighbors[i][0])
        Ql4[i]=ql(qlm_avg,l)
    print 'Ql4_avg=',l,Ql4.sum()/Ql4.shape[0]
    Ql6=np.zeros((M.shape[0]),dtype=complex)
    l=6
    qlm_matrix=np.zeros((M.shape[0],2*l+1),dtype=complex)
    for i in range(M.shape[0]):
        for m in range(-l,l+1):
            qlm_matrix[i][m+l]=qlm(neighbors[i][1],l,m)
    for i in range(M.shape[0]):
        qlm_avg=np.zeros((2*l+1),dtype=complex)
        for m in range(-l,l+1):
            for k in neighbors[i][0]:
                qlm_avg[m+l]+=qlm_matrix[k,m+l]
            qlm_avg[m+l]/=len(neighbors[i][0])
        Ql6[i]=ql(qlm_avg,l)
    print 'Ql6_avg=',l,Ql6.sum()/Ql6.shape[0]
    return Ql4,Ql6
Esempio n. 2
0
def steinhardt_order(M,L,l=6,rcut=17.5,count=14,verbose=False):
    print 'l',l
    #Find nearest neighbors for all particles and convert to spherical
    #######
    #neighbors[i][0]=index of neighbors
    #neighbors[i][1]=array[i][x,y,z] of distance between neighbors
    ########
    neighbors=[]
    for i in range(M.shape[0]):
        N = nn.count_neighbors_index(M,i,L,count=count,rcut=rcut,vectors=True)
        if i == 0:
            print i, N[1]
        neighbors.append([N[0],xyz_to_spherical(N[1])])
        if verbose:
            print 'neighbors',len(N[0])
    #find qlm of each particle 
    #######
    #store as values m=-l-l in nparray
    #Qlm[i]=np.array(ql-m:ql+m) for particle i
    #Qlm[i]=qlm(i)
    ######
    Qlm=np.zeros((M.shape[0],2*l+1),dtype=complex)
    qi=np.zeros((1,2*l+1),dtype=complex)
    for i in range(M.shape[0]):
        for m in range(-l,l+1):
            qi[0][m+l]=qlm(neighbors[i][1],l,m)
        Qlm[i][:]=qi
    Ql=[]
    for i in range(M.shape[0]):
        Ql.append(ql(Qlm[i],l))
    print sum(Ql)/len(Ql)
    return Ql
Esempio n. 3
0
def solid_particles(M,L,count=14,l=6,c_cut=0.15,crystal=6,verbose=False,rcut=30):
    #Find nearest neighbors for all particles and convert to spherical
    #######
    #neighbors[i][0]=index of neighbors
    #neighbors[i][1]=array[i][x,y,z] of distance between neighbors
    ########
    neighbors=[]
    for i in range(M.shape[0]):
        N = nn.count_neighbors_index(M,i,L,count=count,rcut=rcut, vectors=True)
        neighbors.append([N[0],xyz_to_spherical(N[1])])
        if verbose:
            print 'neighbors',len(N[0])
    #find qlm of each particle 
    #######
    #store as values m=-l-l in nparray
    #Qlm[i]=np.array(ql-m:ql+m) for particle i
    #Qlm[i]=qlm(i)
    ######
    Qlm=np.zeros((M.shape[0],2*l+1),dtype=complex)
    qi=np.zeros((1,2*l+1),dtype=complex)
    for i in range(M.shape[0]):
        for m in range(-l,l+1):
            qi[0][m+l]=qlm(neighbors[i][1],l,m)
        Qlm[i][:]=qi
    #for nearest neighbors find the Sij vector
    S=[]
    for i in range(M.shape[0]):
        S.append(Sij(Qlm[i],Qlm[neighbors[i][0]]))
    #for each particle lets counts its neighbors
    #if it has more than ccut we say it is a solid
    iscrystal=[0.0 for i in range(M.shape[0])]
    counter=0
    store_j = []
    for i in S:
        #if verbose:
        #    print i
        count=0
        for j in i:
            #this is the cutoff for declaring 2 particles connected
            if j.real>c_cut:
                store_j.append(j.real)
                count+=1
        if count >= crystal:
            iscrystal[counter]=1
        counter+=1
    try:
        print sum(store_j)/len(store_j)
    except:
        print 'no bonds'
    num=iscrystal.count(1)
    print 'crystals',num
    return num, iscrystal
Esempio n. 4
0
def Qmap(M,L,count=14,l=6,crystal=6,verbose=False,rcut=30):
    #Find nearest neighbors for all particles and convert to spherical
    #######
    #neighbors[i][0]=index of neighbors
    #neighbors[i][1]=array[i][x,y,z] of distance between neighbors
    ########
    neighbors=[]
    #otree = node(L,delta=(M.shape[0]/2)**0.333)
    #otree.add_particles(M)
    print 'getting neighbors'
    for i in range(M.shape[0]):
        #N = cn_tree_index(M,i,otree,L,count=count,rcut=rcut)
        N = nn.count_neighbors_index(M,i,L,count=count,rcut=rcut,vectors=True)
        neighbors.append([N[0],xyz_to_spherical(N[1])])
        #include itself
        neighbors[-1][0].append(i)
        if verbose:
            print 'neighbors',len(N[0])
    #find qlm of each particle 
    #######
    #store as values m=-l-l in nparray
    #Qlm[i]=np.array(ql-m:ql+m) for particle i
    #Qlm[i]=qlm(i)
    ######
    print 'generating qlm matrix'
    qlm_matrix=np.zeros((M.shape[0],2*l+1),dtype=complex)
    for i in range(M.shape[0]):
        for m in range(-l,l+1):
            qlm_matrix[i][m+l]=qlm(neighbors[i][1],l,m)
    Ql=np.zeros((M.shape[0]),dtype=complex)
    print 'generating Ql_avg'
    for i in range(M.shape[0]):
        qlm_avg=np.zeros((2*l+1),dtype=complex)
        for m in range(-l,l+1):
            for k in neighbors[i][0]:
                qlm_avg[m+l]+=qlm_matrix[k,m+l]
            qlm_avg[m+l]/=len(neighbors[i][0])
        Ql[i]=ql(qlm_avg,l)
    print 'Ql=',l,Ql.sum()/Ql.shape[0]
    return Ql