def Leaflet_finder(traj, i, j,len_atom, cutoff):
atom = np.load(traj)
g1 = atom[i:i+len_chunks]
g2 = atom[j:j+len_chunks]
block = np.zeros((len(g1),len(g2)),dtype=float)
block[:,:] = cdist(g1, g2) <= cutoff
S = scipy.sparse.dok_matrix((len_atom, len_atom))
S[i:i+len_chunks, j:j+len_chunks] = block
leaflet = sorted(nx.connected_components(nx.Graph(S>0)), key=len, reverse=True)
l_connected = [] # Keep only connected components
for lng in range(len(leaflet)):
if(len(leaflet[lng])>1):l_connected.append(leaflet[lng])
return list(l_connected)
leaflet-dask-delayed.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录