Skip to content

Python tool to analyze clustering of molecules in MD simulations. Uses MDanalysis and Numpy. Also tqdm for progress control, but it can be removed if needed.

Notifications You must be signed in to change notification settings

mriopedre/clustering_analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Clustering of fragments in MD trajectory

Python code to calculate clustering of fragments (chains, molecules...) in MD trajectories.

#Initialize the class with the info of the trajectory
#Use a topology file with bond information (e.g., `.tpr`) and a trajectory file.
fol = 'example_folder/'
cluster = ClusteringAnalysis(fol+'X.tpr', fol+'X.xtc')

#Make the selection of the fragments - can be done by doing a selection of the residues and using the select_fragments method
sel = cluster.u.select_atoms('resname A B')
sel = cluster.select_fragments(sel)

#Perform the clustering analysis
#The cutoff is the distance in Angstroms to consider a contact
#The output is a matrix with the time, size of the largest cluster and number of clusters
cluster_data = cluster.clustering_analysis(sel, cutoff = 3.5)

#Stores the data in a xvg file, ready to plot with xmgrace or matplotlib
cluster.save_clusters_to_xvg(cluster_data, output_file=fol+'fragments_data.xvg')

About

Python tool to analyze clustering of molecules in MD simulations. Uses MDanalysis and Numpy. Also tqdm for progress control, but it can be removed if needed.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages