Author Topic: Counting specific particle types inside a cluster  (Read 487 times)

shanis

  • Newbie
  • *
  • Posts: 11
Counting specific particle types inside a cluster
« on: January 25, 2019, 04:04:42 AM »
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

  • Administrator
  • Sr. Member
  • *****
  • Posts: 301
Re: Counting specific particle types inside a cluster
« Reply #1 on: January 25, 2019, 11:44:17 AM »
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

  • Newbie
  • *
  • Posts: 11
Re: Counting specific particle types inside a cluster
« Reply #2 on: February 07, 2019, 05:42:19 PM »
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

  • Administrator
  • Sr. Member
  • *****
  • Posts: 301
Re: Counting specific particle types inside a cluster
« Reply #3 on: February 07, 2019, 08:44:28 PM »
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
 
« Last Edit: February 07, 2019, 08:50:09 PM by Constanze Kalcher »

jaguarjom123

  • Newbie
  • *
  • Posts: 9
Re: Counting specific particle types inside a cluster
« Reply #4 on: May 13, 2019, 05:48:20 AM »
Hi Constanze Kalcher
Can you please give an example how can we use expression select modifier to only show the clusters and delete other atoms, I have counted my structure have 3 or 2 clusters but i want to only visualize those cluster,
like can I use
"ClusterAnalysis.cluster_count > = 1" , then "delete atoms", but it not working for me any suggestion please,

Constanze Kalcher

  • Administrator
  • Sr. Member
  • *****
  • Posts: 301
Re: Counting specific particle types inside a cluster
« Reply #5 on: May 13, 2019, 11:34:28 AM »
Hi,
the attribute "ClusterAnalysis.cluster_count" gives you the total number of Clusters produced by the modifier. What you probably meant to do is select Clusters based on their Cluster-ID's. For that you should use the particle property "Cluster", e.g. use the Expression selection modifier with:
Code: [Select]
Cluster > 3and then delete these atoms to show only Clusters 1 to 3.

See also
http://www.ovito.org/manual_testing/python/modules/ovito_modifiers.html#ovito.modifiers.ClusterAnalysisModifier
Does that work for you?

-Constanze