Exemplo n.º 1
0
def n_neighbor_distance_list(v_pos_mat,inputfile):
     distance=[]
     for i in range(1,len(v_pos_mat)):
        min=10000
        for x in range(1,len(v_pos_mat)):
            if u.part_distance(v_pos_mat[i],v_pos_mat[x],inputfile)<min and i!=x:
                min=u.part_distance(v_pos_mat[i],v_pos_mat[x],inputfile)
        distance.append(min)
     return distance
Exemplo n.º 2
0
def n_neighbor_vector_list(v_pos_mat,inputfile):
    distance=[[0.0,0.0,0.0]]
    for i in range(1,len(v_pos_mat)):
        min=10000
        minvec=[0.0,0.0,0.0]
        for x in range(1,len(v_pos_mat)):
            if u.part_distance(v_pos_mat[i],v_pos_mat[x],inputfile)<min and i!=x:
                minvec=np.subtract(v_pos_mat[x],v_pos_mat[i])
                min=u.part_distance(v_pos_mat[i],v_pos_mat[x],inputfile)
        distance=np.append(distance,[minvec],axis=0)
    return distance
Exemplo n.º 3
0
def dist_v_timestep_lat_matrix(nfiles, file1, file2, length, totalnp,
                               nptocount):
    typs = ['S', 'O', 'OH']
    file1 = file1[11:-4]
    file2 = file2[11:-4]
    out = np.zeros((nfiles, nptocount * (length - 1) * 80))
    for c in range(0, nfiles):
        file0 = (int(file1) + (int(file2) - int(file1)) * c)
        toopen = 'atoms.'
        for v in range(0, 10 - len(str(file0))):
            toopen = toopen + '0'
        toopen = toopen + str(file0) + '.xml'
        print('Calculating Carbon Distance for ' + str(file0) + ' (' +
              str(c + 1) + '/' + str(nfiles) + ')')
        ch = chain_pos_lat_matrix(toopen, typs, totalnp, nptocount)
        #print ch
        spos = [0, 0, 0]
        cpos = [0, 0, 0]
        count = 0
        for i in range(1, len(ch)):
            if (ch[i][0] == typs[0]):
                spos = [float(ch[i][1]), float(ch[i][2]), float(ch[i][3])]
            else:
                cpos = [float(ch[i][1]), float(ch[i][2]), float(ch[i][3])]
                out[c][count] = u.part_distance(spos, cpos, toopen)
                count += 1
    return out
Exemplo n.º 4
0
def distance_array_V(inputfile):
    x = vd.v_pos_matrix(inputfile)
    d = [0.0, 0.0, 0.0]
    v = 0
    for i in range(1, len(x)):
        min = 100
        temp = u.part_distance(d, x[i], inputfile)
        if (temp < min):
            v = i
            min = temp
    distance_array = np.array([0.0])
    for b in range(1, len(x)):
        if b != i:
            c = u.part_distance(x[b], x[v], inputfile)
            distance_array = np.append(distance_array, [c], axis=0)
    distance_array = np.sort(distance_array)
    return distance_array
Exemplo n.º 5
0
def new_distance_to_nth_carbon_list(inputfile, nth):
    typs = ['S', 'O', 'OH']
    list = []
    x = nth_carbon_pos_matrix(inputfile, nth, typs)
    y = nth_carbon_pos_matrix(inputfile, 0, typs)
    for i in range(1, len(x)):
        xn = np.array([float(x[i][0]), float(x[i][1]), float(x[i][2])])
        yn = np.array([float(y[i][0]), float(y[i][1]), float(y[i][2])])
        list.append(u.part_distance(xn, yn, inputfile))
    return list
Exemplo n.º 6
0
def new_distance_to_nth_carbon(inputfile, nth):
    typs = ['S', 'O', 'OH']
    x = nth_carbon_pos_matrix(inputfile, nth, typs)
    y = nth_carbon_pos_matrix(inputfile, 0, typs)
    total = 0
    for i in range(1, len(y)):
        xn = np.array([float(x[i][0]), float(x[i][1]), float(x[i][2])])
        yn = np.array([float(y[i][0]), float(y[i][1]), float(y[i][2])])
        total += u.part_distance(xn, yn, inputfile)
    return float(total) / float(len(y) - 1)
Exemplo n.º 7
0
def max_radius(inputfile, n):
    typs = ['S', 'O', 'OH']
    x = nth_carbon_pos_matrix(inputfile, n, typs)
    y = v.v_pos_matrix(inputfile)
    max = 0
    for i in range(0, len(x)):
        d = u.part_distance(y[1], x[i], inputfile)
        if (d > max):
            max = d
    return max
Exemplo n.º 8
0
def distance_carbon_to_carbon(inputfile,first,last):
    typs=['S','CH2','CH3']
    x=nth_carbon_pos_matrix(inputfile,last,typs)
    y=nth_carbon_pos_matrix(inputfile,first,typs)
    total=0
    for i in range(1,len(y)):
        xn=np.array([float(x[i][0]),float(x[i][1]),float(x[i][2])])
        yn=np.array([float(y[i][0]),float(y[i][1]),float(y[i][2])])
        total+=u.part_distance(xn,yn,inputfile)
    return float(total)/float(len(y)-1)
Exemplo n.º 9
0
def closest_matrix(ppos_mat,Aupos_mat,inputfile):
    close_array=np.array([1000])
    for i in range(1,len(ppos_mat)):
        a=np.array([float(ppos_mat[i][1]),float(ppos_mat[i][2]),float(ppos_mat[i][3])])
        closest_distance=100000
        for x in range(1,len(Aupos_mat)):
            c=np.array([float(Aupos_mat[x][0]),float(Aupos_mat[x][1]),float(Aupos_mat[x][2])])
            distance=u.part_distance(a,c,inputfile)
            if(distance<closest_distance):
                closest_distance=distance
        close_array=np.append(close_array,[closest_distance],axis=0)
    return close_array
Exemplo n.º 10
0
def min_distance_between_nth_carbon(inputfile, n):
    typs = ['S', 'O', 'OH']
    chain = nth_carbon_pos_matrix(inputfile, n, typs)
    #print 'matrix'
    min = 10000
    for i in range(1, len(chain)):
        #print i
        for x in range(i + 1, len(chain)):
            d = u.part_distance(chain[i], chain[x], inputfile)
            if (d < min):
                min = d
    return min
Exemplo n.º 11
0
def np_volume(inputfile):
    au = vd.type_pos_matrix(inputfile, 'Au')
    v = vd.type_pos_matrix(inputfile, 'V')
    numau = (len(au) - 1) / (len(v) - 1)
    volume = 0
    for x in range(1, len(v)):
        for i in range(1 + (numau * x - 1), 1 + numau * x):
            r = u.part_distance(au[i], v[x], inputfile)
            if (r - float(int(r)) == 0.0):
                volume += 0.5 * r**3
            i = -1
            print i
    return volume
Exemplo n.º 12
0
def dist_v_timestep(nfiles,file1,file2):
    file1=file1[6:-4]
    file2=file2[6:-4]
    out=np.array([[0.0,0.0]])
    for c in range(0,nfiles):
        file0=(int(file1)+(int(file2)-int(file1))*c)
        toopen='atoms.'
        for v in range(0,10-len(str(file0))):
            toopen=toopen + '0'
        toopen=toopen + str(file0) + '.xml'
        x=v_pos_matrix(toopen)
        out=np.append(out,[[file0,u.part_distance(x[1],x[2],toopen)]],axis=0)
    return out