Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - shanis

Pages: [1]
Support Forum / Particle count on multiple selected clusters
« on: May 09, 2019, 07:16:46 PM »
Dear Ovito users,

I am trying to do particle count by type of only specific clusters (lets say 3 out of 5 clusters). Here is the code I use to do the counting. However, currently the counting is executed on all clusters. Let me know how I can perform the counting only on selected clusters.

Code: [Select]
cluster = ClusterAnalysisModifier(sort_by_size=True)

num_particles = data.particle.count

def particle_counting(frame, data):
    cluster_sizes = np.zeros(num_particles, dtype=int)

    for pidx in range(num_particles):
        ptype = data.particles_['Particle Type'][pidx]

        if data.particles['Particle Type'].type_by_id(ptype).name == 'C':
            cluster_sizes[data.particles['Cluster'][pidx]] += 1

     data.particles_.create_property('ClusterSize_', data = cluster_sizes)
     data.attributes['ClusterSize'] = list(cluster_sizes)

Dear ovito users,

If I have 10 clusters, out of which I want to select only 5 of them and apply the ConstructSurfaceModifier to each of them to obtain volume of each cluster, how could I achieve this ? Currently I can only select one cluster and apply the modifier. I can't use python variable to change the SelectExpressionModifier so I am thinking of an alternative way. Following is a code snippet that I am using to construct the surface.

Code: [Select]
# select cluster
clusterselect_modifier = SelectExpressionModifier(expression = 'Cluster == 1')
data = pipeline.compute()

# apply surface mesh on selected cluster
pipeline.modifiers.append(ConstructSurfaceModifier(only_selected = True))
data = pipeline.compute()

volume = pipeline.output.attributes['ConstructSurfaceMesh.solid_volume']

Thanks a lot !

Support Forum / selecting certain frames of trajectory files
« on: February 28, 2019, 04:41:17 PM »
Hello Ovito users,

Is there a way to specifiy certain frames (say frames 400 -500 of a trajectory that contains 500 frames) so that I can apply modifiers only to those frames while feeding the whole trajectory file to ovito ?


Support Forum / 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 ?

Pages: [1]