Author Topic: CNA and bond-angle analysis criterion  (Read 113 times)

spar

  • Newbie
  • *
  • Posts: 7
CNA and bond-angle analysis criterion
« on: September 03, 2018, 04:42:21 PM »
Hi everyone,

I was wondering If there is a way to change the CNA or bond-angle analysis criterion for a certain atom.

For example a surface atom has not enough bonds to be recognized as FCC by the algorithms but I would like it to be counted as FCC if it has say 8 neighbors (vs the 12 which I imagine is the criterion for a bulk atom).

Thank you.

Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
Re: CNA and bond-angle analysis criterion
« Reply #1 on: September 04, 2018, 02:01:14 PM »
Dear spar,

The CNA and the bond-angle analysis (also known as Ackland-Jones structure identification method) both use fixed rules for identifying crystalline and fully coordinated bulk atoms. There is no way to change these rules without touching the source code of the actual algorithm.

The CNA, for example, requires an atom to have 12 nearest neighbors to be identified as FCC. Additionally, these 12 neighbors must be arranged in a particular way. In other words, the coordination number is not the only criterion used in the CNA.

If you are interested in identifying surface atoms just by the number of neighbors, you can do that in OVITO using its Coordination Analysis modifier, which counts the number of atomic neighbors within a given spherical range, followed by an Expression Selection modifier. The latter lets you select those atoms which have a coordination number within a certain range.

More sophisticated identification and selection schemes are possible to catch specific surface atoms. For example, you could combine the CNA and the coordination analysis. First use CNA to identify and select the bulk FCC atoms, then use the Expand Selection modifier to select their nearest neighbors and refine the selection based on the computed coordination numbers.

I am not sure what you are looking for exactly. If possible, please specify more precisely what you would like to do.

-Alex

spar

  • Newbie
  • *
  • Posts: 7
Re: CNA and bond-angle analysis criterion
« Reply #2 on: September 05, 2018, 10:20:59 AM »
Dear Alex,

Thank you for your time and your reply.

My issue is not with selecting the surface atoms. These are fixed during my simulations, e.g. I know that atoms 252 and 378 are on the surface.

My question is if there is a way (Python script maybe?) to include atom 252 in the FCC count despite them not meeting the exact criteria, i.e. if there is a way to "soften" the criteria for certain atoms.

Best,
Theo

Constanze Kalcher

  • Administrator
  • Jr. Member
  • *****
  • Posts: 62
Re: CNA and bond-angle analysis criterion
« Reply #3 on: September 05, 2018, 12:05:00 PM »
Dear Theo,

could you please give us a little bit more context what you are trying to do. It is not yet clear to us what question you are trying to answer. What is your setup? Do you have more than these two surface atoms? And what would  a "softer" criterium be in your case, e.g. only being a neighbor to 8 fcc atoms?

I'm happy to help with the python script then.

-Constanze

spar

  • Newbie
  • *
  • Posts: 7
Re: CNA and bond-angle analysis criterion
« Reply #4 on: September 05, 2018, 12:25:10 PM »
More sophisticated identification and selection schemes are possible to catch specific surface atoms. For example, you could combine the CNA and the coordination analysis. First use CNA to identify and select the bulk FCC atoms, then use the Expand Selection modifier to select their nearest neighbors and refine the selection based on the computed coordination numbers.

In the case I follow this, i.e.
-Common Neighbor Analysis first
-then Select particle type to FCC
-finally Expand Selection modifier set at 12 (it selects all the atoms I want it to select)

how do I export this number (the final count number) in a text file?
The expand selection result does now how up in the Export Settings window.

spar

  • Newbie
  • *
  • Posts: 7
Re: CNA and bond-angle analysis criterion
« Reply #5 on: September 05, 2018, 12:28:36 PM »
Dear Theo,

could you please give us a little bit more context what you are trying to do. It is not yet clear to us what question you are trying to answer. What is your setup? Do you have more than these two surface atoms? And what would  a "softer" criterium be in your case, e.g. only being a neighbor to 8 fcc atoms?

I'm happy to help with the python script then.

-Constanze

Hi Constanze,

My example is a nanoparticle of say 561 atoms.
The CNA recognizes 309 of them as FCC and the outer layer (252 atoms) as OTHER.
I would like to know if there is a way to include the outer layer in the FCC count, even though the atoms there do not have the required bonds to qualify as FCC.


Constanze Kalcher

  • Administrator
  • Jr. Member
  • *****
  • Posts: 62
Re: CNA and bond-angle analysis criterion
« Reply #6 on: September 05, 2018, 01:43:56 PM »
Hi Theo,

alright, in that case you could add a Python Script modifier after the Expand Selection modifier. The following modifier function counts the number of selected atoms (=fcc atoms + 12 nearest neighbors of each fcc atom) and adds a global attribute "my_fcc_count" to your data collection.
Code: [Select]
from ovito.data import *
import numpy as np

def modify(frame, input, output):
    output.attributes["my_fcc_count"] = np.count_nonzero(input.particles["Selection"])

Global attributes appear in the Attributes Section in the Data Inspector and  can be exported using the Export File - Table of Values Option. Does that work for you?

-Constanze

spar

  • Newbie
  • *
  • Posts: 7
Re: CNA and bond-angle analysis criterion
« Reply #7 on: September 05, 2018, 02:46:16 PM »
I get:

The Python script has exited with an error.
Traceback (most recent call last):
  File "<string>", line 5, in modify
  File "C:\Program Files\Ovito\plugins\python\ovito\data\__init__.py", line 74, in _DataCollection__getattr__
    raise AttributeError("DataCollection does not have an attribute named '%s'." % name)
AttributeError: DataCollection does not have an attribute named 'particles'.

Constanze Kalcher

  • Administrator
  • Jr. Member
  • *****
  • Posts: 62
Re: CNA and bond-angle analysis criterion
« Reply #8 on: September 05, 2018, 03:05:33 PM »
I assumed you are using the latest version of OVITO 3, where the python API has been updated, as explained here:
http://ovito.org/manual_testing/python/introduction/version_changes.html.

If you'd rather use OVITO 2.9, you need to adapt line 5 like this:
Code: [Select]
output.attributes["my_fcc_count"] = np.count_nonzero(input.particle_properties["Selection"])

The Data inspector panel is only available in OVITO 3, however, in OVITO2.9 the global attribute "my_fcc_count" will be visible under Attributes to Export when you choose the file format "Calculation Results File" in the Export File function.

-Constanze

spar

  • Newbie
  • *
  • Posts: 7
Re: CNA and bond-angle analysis criterion
« Reply #9 on: September 05, 2018, 03:30:00 PM »
Works like a charm.

Thank you for the help!  :)

spar

  • Newbie
  • *
  • Posts: 7
Re: CNA and bond-angle analysis criterion
« Reply #10 on: September 14, 2018, 12:03:16 PM »
Going back to relaxing the criteria for CNA: is there a way to do it with a Python script?

I want to achieve something like what they did in this paper: http://dx.doi.org/10.1088/0957-4484/19/41/415701

Here they use the "bond-orientational order parameter (BOP)" analysis to find FCC atoms. As they state:

"Since surface atoms have fewer neighboring bonds than inner atoms do, instead of using Wolde et al’s criterion of ‘seven or more crystal-like bonds’ to define solid-like states for inner atoms, we define the surface atom to be ‘solid-like’ if it has six or more ‘crystal-like’ bonds; if it has less than six ‘crystal-like’ bonds it is considered ‘liquid-like’."

Is there a way to do something similar in OVITO for CNA or bond-angle analysis?

Alexander Stukowski

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
Re: CNA and bond-angle analysis criterion
« Reply #11 on: September 15, 2018, 08:53:28 AM »
The CNA is essentially based on a per-bond classification. In proceeds in three steps:

1. Generate the network of neighbor bonds, for example using a distance-based cutoff criterion.
2. Compute a triplet of integers for each bond in the network, which represents a fingerprint of the local topology of the network surrounding the bond.
3. Classify each atom based on the types of the bonds it has.

For example, those atoms which have exactly 12 bonds of type "4-2-1" are taken as FCC in the standard CNA method.

What you could do in OVITO is the following: The CNA modifier has a "bond-based mode". When activated, the modifier will skip step 1 above and instead use the existing explicit bond network. For instance, you could create the bonds explicitly by adding the Create Bonds modifier of OVITO before the CNA modifier. Furthermore, the CNA modifier will output the computed triplets for each bond as a new bond property. This gives you the opportunity to perform step 3 in the algorithm above yourself and implement different classification schemes. For this step, you'll have to write a user-defined modifier function in Python which gets executed after the CNA modifier.

I'm not sure how well it will work and what would be a good "relaxed" criterion for FCC atoms. For example, you could require them to have at least eight 4-2-1 bonds instead of exactly 12. It's probably a good idea to first manually inspect the CNA fingerprints computed for the bonds of atoms at the surface for which you think they should be classified as FCC and then derive appropriate criteria from that observation.
« Last Edit: September 15, 2018, 08:55:02 AM by Alexander Stukowski »