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

Coordination Analysis


I am new to OVITO and new to structure visualization in general.

I have been playing around with the interface and there are few things that I am particularly interested in, and would like some clarity on what/how I should go about it.

The structure I have is a well-mixed bimetallic cluster (2-3 nm) with surface disorder and I am looking extract information on A-A, A-B, B-B and B-A coordination number (CN) at core, surface and average. Cut-off radius I am interested in is 3A.

For clarity of my question, assume A and B as particle type 1 and 2 respectively

  1. To calculate the average coordination number, I could just use the coordination analysis with compute property function, where neighbor expression would be (@particletype==1) && (@particletype==1). The output will be the CN per atom of interest. Is there a function to calculate or export these individual CN so that we can calculate the average CN? Also, it seems the above code does not hold true for A-B and B-A CN, which logically it should if I change (@particletype==1) && (@particletype==2) to get A-B or B-A CN unless I am missing something here.
  2. Is there a way to calculate the average coordination numbers for core and surface separately?
  3. From a visualization perspective, could OVITO support visualization of just the core and full cluster separately?

Thanks in advance.


welcome to the OVITO community then! Let me try to answer your questions,

1. I think there might be a misunderstanding on how the Compute Property Modifier works. The @-symbol is used within the neighbor expression term, to refer to properties of the central particle i (by prepending the @-symbol to the property name).  To refer to the particle properties of the neighboring atoms use the particle property name but leave out the @-symbol.
To create a new particle property "A-A coordination", you would need to check if the central particle is of particle type 1 and for every neighboring particle found within the cutoff range you would have to check if it also is of particle type 1. Thus, you can use the following settings:

Output property: "A-A CN"
Expression: "0"
NeighborExpression: "@ParticleType==1 && ParticleType==1"
CutoffRadius: 3

If you open the Data Inspector below the viewport windows, you can see that a new column "A-A CN" appeared. Only A-atoms should have a non-zero entry.

Add another Compute property modifier to the pipeline and repeat these steps to calculate the coordination number of B atoms around A atoms "A-B CN".

Output property: "A-B CN"
Expression: "0"
NeighborExpression: "@ParticleType==1 && ParticleType==2"
CutoffRadius: 3

Add two more Compute property modifiers for "B-B" and "B-A" using "@ParticleType==2 && ParticleType==2" and "@ParticleType==2 && ParticleType==1", respectively.

Then, in a next step you can calculate the average of these coordination numbers. Averaging of any particle property can be done with a Python script modifier. In your case, you want to only average over all non-zero elements of the "A-A CN" property, e.g. like this:

import numpy 

def modify(frame, data):
    aa_cn = data.particles["A-A CN"]
    data.attributes["Average A-A CN"] = numpy.mean(aa_cn[aa_cn != 0] )

Note that this short modifier script stores the result in a global attribute called "Average A-A CN", which will become visible in the Data Inspector after executing this script. Global attributes (and their time-evolution) can be easily exported by using OVITO's export function "Table of Values".

2.Yes, you can use one of the Selection Modifiers to select all core/surface atoms and then adapt your python script in a way that only the properties of selected atoms will be used:

import numpy 
def modify(frame, data): 
    aa_cn = data.particles["A-A CN"] 
    selection = data.particles["Selection"]
    data.attributes["Average A-A CN surface"] = numpy.mean( aa_cn[(aa_cn != 0) & (selection == 1)])

3. Yes, again, here the way to go would be to use one of the Selection Modifiers to select a group of atoms and apply the Delete Selected modifier to remove these atoms from the Scene. There are a lot of options to visualize this, you could e.g. clone your pipeline and show only the core atoms and the full cluster side-by-side.

I have linked a couple of manual entries for you which you might find helpful.


Hi Constanze,

Thanks so much for the warm welcome and the comprehensive explanation and resources. I should be able to process the information you have provided. If anything-related to this matter comes up, I will come back to this thread 🙂

- Bijil

Very informative