# Common neighbor analysis

This analysis modifier performs the Common Neighbor Analysis (CNA) [Honeycutt and Andersen, J. Phys. Chem. 91, 4950] to assign a structure type (FCC, BCC, HCP etc.) to every particle. The algorithm is based on a nearest-neighbor graph that encodes the bond connectivity among neighbors of a given central particle.

Which pairs of particle are considered nearest neighbors (bonded) is determined by the cutoff radius parameter: Particles closer to each other than the cutoff radius are considered bonded. Since it is sometimes difficult to choose this cutoff radius correctly, in particular in the case of multiphase systems, an adaptive version of the CNA has been developed that works without a fixed cutoff radius. 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.

When using the conventional CNA, the fixed cutoff 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 neighbor shell of neighbors. For body-centered cubic (BCC) materials the cutoff radius should lie 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 radii can be accessed via the Presets drop-down list.

In addition to assigning colors to particles, the modifier stores its results in the `Structure Type` particle property. The coordination structure 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

- 5 = DIA, cubic diamond structure

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