Author Topic: Coordination Modifier To determine Types of Bonded Atoms  (Read 1359 times)

jhart

  • Newbie
  • *
  • Posts: 22
Coordination Modifier To determine Types of Bonded Atoms
« on: May 25, 2017, 12:30:39 AM »
Hi,

I am using the Coordination Analysis Modifier but I am having trouble using it to identify which atoms are bonded to which. It is great for determining the coordination number, but how do I determine the type of atoms that are bonded?

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 638
Re: Coordination Modifier To determine Types of Bonded Atoms
« Reply #1 on: May 25, 2017, 09:12:23 AM »
Hi,

The Coordination Analysis modifier doesn't allows you to take into account the types of the neighbours when counting them. But there is another modifier in OVITO which can do it: the Compute Property modifier

http://ovito.org/manual/particles.modifiers.compute_property.html

This modifier can mimic the coordination number calculation. For example, to calculate the coordination number using the Compute Property modifier, you simply enter "0" as central expression and "1" as neighbour expression. In other words, the central atom itself contributes nothing to the coordination number while each neighbour within the cutoff radius contributes 1 to the final sum.

Now it is possible to perform a filtering of the neighbours based on their type. For example, if you want only neighbours of type 2 to contribute the coordination number, you would use this if-then-else neighbour expression:

    ParticleType==2 ? 1 : 0

Does that solve your problem already? Note that you could apply the Compute Property modifier multiple times to compute several type-specific coordination numbers.

jhart

  • Newbie
  • *
  • Posts: 22
Re: Coordination Modifier To determine Types of Bonded Atoms
« Reply #2 on: May 25, 2017, 06:07:24 PM »
So, I choose "Compute Property," choose to output the property "Coordination," enter 0 into "Expression" and enter ParticleType==2? 1:0 into the "Neighbor Expression"?

When I do this, and use a cutoff of say 2.1 Angstroms, I do not see any results.

Is it at this point, I should just histrogram the data and choose coordination for the histogram?

Can you explain the meaning behind 1:0?

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 638
Re: Coordination Modifier To determine Types of Bonded Atoms
« Reply #3 on: May 25, 2017, 09:44:37 PM »
Note that the Compute Property modifier, unlike the Coordination Analysis modifier, does not compute the radial distribution function (RDF). The RDF is displayed in the Coordination Analysis panel.

However, because you specifically asked for coordination numbers, I assumed you are not interested in the RDF.

The coordination number computed by the Coordination Analysis modifier for each particle is stored in the "Coordination" output particle property. You can inspect all properties a particle has using the Particle Inspection utility of OVITO. Or you can use the Color Coding modifier, for example, to assign a color to each particle based on one of their property values (in your case the Coordination property).

The Compute Property modifier also outputs the computed values as new particle properties that are attached to each particle. This output data is stored but not immediately visible. You have to make it visible, e.g. using the Color Coding modifier.

In the math expression "ParticleType==2 ? 1 : 0" the ?: denotes a so-called ternary operator. The first table on the documentation page of the Compute Property modifier explains what it does:

A ? B : C   
If A differs from 0 (i.e. is true), the resulting value of this expression is B, else C.

In other words, the expression evaluate to the value 1 if the ParticleType property has the value 2. Otherwise it evaluates to 0. Thus, neighbours of types other than "2" do not contribute to the computed sum.