OVITO > Support Forum

Counting specific particle types inside a cluster

(1/1)

shanis:
I have a trajectory with four types of beads, two of them (A, B) form clusters and the other two are distributed inside and outside the clusters (C, D). Is there a way to count the number of C and D inside the clusters formed by A and B ?

Constanze Kalcher:
Hi,
a possible way to do this could be to apply the cluster analysis modifier,
https://ovito.org/manual/particles.modifiers.cluster_analysis.html
which assigns a cluster-ID to every found cluster. Then you could select clusters based on their IDs and count the different particle types it contains, e.g. using
the Expression Selection modifier, or a Python Script modifier, or even a Compute Property modifier. There are several possibilities.
To get more specific I would need to see an example file, which you can upload here if you like.

Let me know if this works for you.

-Constanze

shanis:
Thanks Constanze. Tried with both Python Script modifier and Expression Select modifier after applying Cluster Select modifier. Both worked ! I also see that ovito takes care of the PBC while doing cluster analysis, which is nice.

One issue I am trying to get around (only for visualization purposes) is to not have part of my molecules appear on the other side of the box due to the PBC. Is there something I can do with ovito, so my molecules don't look wierd when I make images ?

Best,

Constanze Kalcher:
Hi,

if you're using the latest developer version of OVITO the Unwrap trajectories modifier could be of interest to you.
http://www.ovito.org/manual_testing/particles.modifiers.unwrap_trajectories.html

In other cases I've also worked with a combination of the Replicate, Affine Transformation (apply a translation to only the particles not the simulation cell) and Wrap at periodic boundaries modifiers.

It depends on if the molecules are already split at a boundary in the initial frame or not.
Does that work for you?

-Constanze
 

Navigation

[0] Message Index

Go to full version