OVITO Forum

OVITO => Support Forum => Topic started by: x.he on April 09, 2019, 10:13:41 AM

Title: error in "NeighborMode.Bonded" in cluster analysis
Post by: x.he on April 09, 2019, 10:13:41 AM
Dear everyone,

I want to perform cluster analysis by Python script. But when I set "neighbor_mode=ClusterAnalysisModifier.NeighborMode.Bonded", I got an error message:"ovito.plugins.Particles.Modifiers.NeighborMode' has no attribute 'Bonded' ".

The "NeighborMode.CutoffRange" does work。

the following is the code:

cluster=ClusterAnalysisModifier()
cluster.neighbor_mode=ClusterAnalysisModifier.NeighborMode.Bonded
node.modifiers.append(cluster)

error message:
AttributeError: type object 'ovito.plugins.Particles.Modifiers.NeighborMode' has no attribute 'Bonded'

Please help me to solove this problem??
Title: Re: error in "NeighborMode.Bonded" in cluster analysis
Post by: Constanze Kalcher on April 09, 2019, 12:26:33 PM
Dear x.he,

thank you for letting me know, it's actually a typo in the documentation. If you have imported or generated bonds (e.g. with the CreateBondsModifier or the VoronoiAnalysisModifier)
you can set the neighbor mode of the Cluster Analysis modifier like this:

Code: [Select]
cluster.neighbor_mode = ClusterAnalysisModifier.NeighborMode.Bonding
Does that solve your problem?
-Constanze
Title: Re: error in "NeighborMode.Bonded" in cluster analysis
Post by: x.he on April 09, 2019, 02:42:04 PM
Dear Constanze,

Many thanks for support. It is working and that's I need.

xinhe