Asking for Python script to do the cluster analysis

Dear all lammps users and Steve:

I am sorry to send this email to all of you, for i am in trouble in analyzing the cluster for a few months, there is a compute cluster/atom command in lammps which can assign every atom a cluster ID(the atoms within the cutoff distance are belong to a same cluster), however, the clusterID will change over the time! I want to plot the relationship curve of cluster size(gyration radius) versus number of monomers in the cluster, but unfortunately, i am aware of lammps can not finish it.
The python language may has advantage on my problem. now,i can use python tool in lammps to do some simple work, and i found a written by Steve in Toolkit, but this is not what i want, does anyone has Python scripts to do the cluster analysis? or some other way to solve my problem? Any tips will be greatly appreciated! Thank you in advance!


You can contact

Alexander Vorontsov,
South Ural State University,
Chelyabinsk, Russia
sas at

who has written a compute to average cluster properties on the fly.

It’s not yet part of official LAMMPS, but maybe you can try
out what he has done and see if it helps with your problem.


Hi Xuepeng,

There’s a python library called scikit-learn that has clustering tools that you might find useful. -Vanessa

Hi, Steve,
Thank you for your guidance! Wish you all the best!

Hi, Vanessa,
Thank you very much for your helpful advice! wish you all the best!