Example #1
0
def guess_bonds(r_array, type_array, threshold=0.01):
    covalent_radii = cdb.get('data', 'covalentdict')
    MAXRADIUS = 0.5
    
    # Find all the pairs
    ck = cKDTree(r_array)
    pairs = ck.query_pairs(MAXRADIUS)
    
    bonds = []
    for i,j in pairs:
        a, b = covalent_radii[type_array[i]], covalent_radii[type_array[j]]
        rval = a + b
        
        # print(rval)
        
        thr_a = rval - threshold
        thr_b = rval + threshold 
        
        #thr_a2 = thr_a * thr_a
        thr_b2 = thr_b * thr_b
        dr2  = ((r_array[i] - r_array[j])**2).sum()
        
        # print(dr2)
        
        if dr2 < thr_b2:
            bonds.append((i, j))
    return np.array(bonds)
Example #2
0
def guess_bonds(r_array, type_array, threshold=0.01):
    covalent_radii = cdb.get('data', 'covalentdict')
    MAXRADIUS = 0.5

    # Find all the pairs
    ck = cKDTree(r_array)
    pairs = ck.query_pairs(MAXRADIUS)

    bonds = []
    for i, j in pairs:
        a, b = covalent_radii[type_array[i]], covalent_radii[type_array[j]]
        rval = a + b

        # print(rval)

        thr_a = rval - threshold
        thr_b = rval + threshold

        #thr_a2 = thr_a * thr_a
        thr_b2 = thr_b * thr_b
        dr2 = ((r_array[i] - r_array[j])**2).sum()

        # print(dr2)

        if dr2 < thr_b2:
            bonds.append((i, j))
    return np.array(bonds)
Example #3
0
def find_bonds(sys):
    from chemlab.libs.ckdtree import cKDTree
    ck = cKDTree(sys.r_array)
    return np.unique(ck.query_pairs(0.15))
Example #4
0
def find_bonds(sys):
    from chemlab.libs.ckdtree import cKDTree
    ck = cKDTree(sys.r_array)
    return np.unique(ck.query_pairs(0.15))