# Common neighbor analysis

This analysis modifier performs the Common Neighbor Analysis (CNA) [Honeycutt and Andersen, J. Phys. Chem. 91, 4950] for a particle system. The CNA is an algorithm to compute a fingerprint for pairs of atoms, which is designed to characterize the local structural environment. Typically, the CNA is used as an effective filtering method to classify atoms in crystalline systems [Faken and Jonsson, Comput. Mater. Sci. 2, 279], with the goal to get a precise understanding of which atoms are associated with which phases, and which are associated with defects.

The modifier supports three different modes of operation:

Conventional CNA (with fixed cutoff)

  Here, a threshold distance criterion is used to determine whether a pair of atoms is bonded or not. The cutoff distance must be chosen according to the crystal structure at hand. For face-centered cubic (FCC) and hexagonal close-packed (HCP) structures the cutoff radius must lie midway between the first and the second shell of neighbors. For body-centered cubic (BCC) structures the cutoff radius should be positioned between the second and the third neighbor shell. OVITO provides a list of optimal cutoff distances for FCC and BCC crystal structures formed by common pure elements. These optimal radii can be found in the Presets drop-down list.

Adaptive CNA (with variable cutoff)

  Sometimes it may be difficult to choose the right cutoff radius for the conventional CNA, in particular in the case of multiphase systems. This is why an adaptive version of the CNA has been developed that works without a fixed cutoff. The Adaptive Common Neighbor Analysis (a-CNA) method [Stukowski, Modell. Simul. Mater. Sci. Eng. 20, 045021] determines the optimal cutoff radius automatically for each individual particle.

Bond-based CNA (without cutoff)

  The modifier also supports a bond-based mode of operation. Then the CNA indices are computed based on the existing network of bonds between particles (without using a cutoff radius and irrespective of the distance between particles). This mode requires that bonds between particles have previously been defined, for example using a Create Bonds modifier or by loading them from a data file. Furthermore, in the bond-based mode, the modifier outputs the computed per-bond CNA indices as a new bond property named `CNA indices`, which can be used for further statistical analyses. The computed CNA bond indices may be accessed from a Python script, see this example.

The modifier classifies each particle according to its structural environment and stores the results in a new particle property named `Structure Type`. This allows you to subsequently select and filter out particles of a certain structural type, e.g. by using the Select Particle Type modifier. The structural types are encoded as integer values:

- 0 = Other, unknown coordination structure

- 1 = FCC, face-centered cubic

- 2 = HCP, hexagonal close-packed

- 3 = BCC, body-centered cubic

- 4 = ICO, icosahedral coordination

To identify diamond lattice structures, please use the Identify Diamond Structure modifier instead.

The CNA modifier requires access to the complete set of input particles to perform the analysis. It should therefore be placed at the beginning of the processing pipeline, preceding any modifiers that delete particles.

The Use only selected particles option restricts the analysis to the currently selected particles. If this option is activated, unselected particles will be ignored (as if they did not exist) and will be assigned the structure type "Other". This option can be useful if you want to identify defects in a crystal structure not supported by the CNA method, but which has a sublattice that can be identified by the CNA (and you do not want to delete particles belonging to the other sublattice(s) for some reason). This option has no effect in bond-based mode.