Modify Example M2: Custom order parameter calculatio

I want to modify the example M2 on python scripting such that, instead of squared_deviations, the order parameter is defined based on the structure type for the neighbor atoms. Therefore, I wanted to add the CommonNeighborAnalysis modifier on the data before the neigh_finder command. So, I added:


But it gives the following error :
‘ovito.plugins.PyScript.DataCollection’ object has no attribute ‘modifiers’

I appreciate your help how I should add ovito’s default modifier to a new modifier I develop by python scripting.

Hello Sepi,
Your question has already been answered here: