Forum Navigation
You need to log in to create posts and topics.

coordination information from voronoi analysis

Hi Ovito developers,

I know that by using the voronoi analysis modifier we can get to know the coordination number of a particle. I am wondering if it's possible to know the identity of the nearest neighbors of a particle so that I can do further analysis regarding the coordination.

A simple example could be that I would like to know the partial coordination number if there are more than one particle types. For this, I would not use the coordination analysis modifier since one has to adjust the cutoff radius if the sample or the pair under consideration is changed. I suppose that voronoi tessellation is a more suitable approach to find the first-nearest neighbors of a particle.

Thank you in advance for your help.

Zhen

Hi Zhen,

Yes, that can be easily done with a custom python script modifier in OVITO Pro. If you activate the option "Generate neighbor bonds" in the Voronoi analysis modifier, you can later iterate over all bonds connected to each center atom to find and look up the particle types of the neighboring atoms.

https://www.ovito.org/docs/current/python/modules/ovito_data.html#ovito.data.Bonds

-Constanze

Hi Constanze,

Thank you for your help. Now I've basically realized my goal with a customed python script.

Just one more additional question regarding the python script:

In order to count the number of neighboring atoms of a given type, I defined two arrays:

values = numpy.zeros(data.particles.count, dtype = int)
my_count1 = data.particles_.create_property("CN 1", data = values)
my_count2 = data.particles_.create_property("CN 2", data = values)

Now I am having problem to output these two newly defined properties via the export_file command, e.g., using the "lammps/dump" format together with other properties computed from the VoronoiAnalysisModifier. Do you have suggestions on exporting the two properties?

Thank you in advance.

Zhen

 

Hi Zhen,

Ok great. You should specify the particle properties to export using the columns keyword parameter of the export_file() function  as shown in the code example here (section "File columns").

-Constanze

Hi Constanze,

Thank you for your quick response. Following your suggestion I added the following line to my script for data export:

export_file(pipeline, "voro.dump", "lammps/dump", frame=1,
columns = ["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z", "Coordination", "CN 1", "Atomic Volume", "Voronoi Index.3", "Voronoi Index.4", "Voronoi Index.5", "Voronoi Index.6", "Max Face Order"])

But I ended up with the error message:

RuntimeError: The specified list of output file columns is invalid. The property 'CN 1', which is needed to write file column 7, does not exist or could not be computed.
ERROR: The Python script has exited with an error.

Without the column "CN 1", the script works perfectly. It seems that the new property is not recognized by the pipeline. How should I correct this?

Zhen

One reason that this happens could be that you didn't create the new particle properties within the scope of a modifier function and/or forgot to append this modifier to your pipeline.

https://www.ovito.org/docs/current/python/introduction/custom_modifiers.html#

If you need more support, please purchase a license for OVITO Pro and contact us through our official email support. We'll be happy to help.

 

Hi Constanze,

OK. Thank you for your help.

Zhen

新的OVITO微信频道!
New for our users in China: OVITO on WeChat 

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.