Result from Python scripy is different from GUI

Dear Sir/madam:
I am using OVITO version of 2.9.0.
I found the CommonNeighborAnalysis results from python script is different from GUI.
Anyone meet this problem and how to solve?

Hi HeXin,
Can you describe what makes you think the results are different and what exact settings you have used in the GUI and in your python script?
-Constanze

Hi Constanze,

I want to use “CommonNeighborAnlysis” to compute the number of defect atoms of a FCC crystal from Lammps. The Python Script I used:

node=import_file(filename)
node.compute()
node.modifiers.append(CommonNeighborAnalysisModifier(
mode =CommonNeighborAnalysisModifier.Mode.AdaptiveCutoff,
only_selected=False))
node.compute()
Counts_other=node.output.attributes[‘CommonNeighborAnalysis.counts.OTHER’]

And I got the number of the “other” type is 40.
In GUI, I selected the option of “Adaptive CNA (variable cutoff)” and the option of “use only selected particles” was not selected. But the output of the “other” type is 42.

I have test different lammps input files, the problem remains.

Any wrong of my settings?

Thank you so much

-Xin

The code snippet you posted gives me the same result as using the Common Neighbor Analysis Modifier in the GUI of ovito 2.9. I can’t reproduce the problem, for me everything works as expected with an example dump file.
I’m wondering, did you add any other modifiers to your pipeline or did you change any other settings, e.g. the cell or the periodic boundary conditions?

If you like you can save your current scene from the GUI as an ovito-state file (*.state) and send it to me with an example lammps file via email at [email protected].

Hi Constanze,
Thanks for your help.
I check the code carefully, and found a typos. Now the problem has been solved.

Thanks again and I want to say sorry for disturbing you

-HeXin

Ok, good to hear that it’s working for you now.
-Constanze