Author Topic: error in "NeighborMode.Bonded" in cluster analysis  (Read 218 times)

x.he

  • Newbie
  • *
  • Posts: 2
error in "NeighborMode.Bonded" in cluster analysis
« 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??

Constanze Kalcher

  • Administrator
  • Sr. Member
  • *****
  • Posts: 299
Re: error in "NeighborMode.Bonded" in cluster analysis
« Reply #1 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

x.he

  • Newbie
  • *
  • Posts: 2
Re: error in "NeighborMode.Bonded" in cluster analysis
« Reply #2 on: April 09, 2019, 02:42:04 PM »
Dear Constanze,

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

xinhe