# Calculate an order parameter for a given set of atomic coordinates

I have a box which contains a few thousand atoms, and I would like to be able to calculate a single number which gives some indication of how ordered their arrangement is in 3D.

For example, if they were totally crystalline, then the order would be 1. If the atoms were randomly arranged, the order parameter would be 0.

At this stage, I don't need to be able to differentiate between different types of order (eg bcc vs fcc), just the overall amount of order.

The system is an infinite network with identical atoms. The infinite network is built with periodic boundary conditions applied to the box.

.

What do I need to be reading? I'm currently reading on spatial autocorrelation and Moran’s I.

I would recommend calculating the structure factor $$S(\mathbf{q})$$ $$S(\mathbf{q}) = \frac{1}{N} \left| \sum_{j=1}^N \exp(-i \mathbf{q}\cdot\mathbf{r}_j) \right|^2$$ for a large number of wavevectors $$\mathbf{q}$$ and finding the maximum value of $$S$$, call it $$S_{\text{max}}$$, amongst those values, excluding $$\mathbf{q}=0$$. Then, as explained on that Wikipedia page, $$S_{\text{max}}/N$$ will be of order $$1$$ for a regular crystal, and of order $$1/N$$ for a disordered system, if you have $$N$$ atoms. The components of the wavevectors will be integer multiples of $$2\pi/L$$ assuming a cubic box of side $$L$$. You only need to consider components up to $$2\pi/a$$ where $$a$$ is the atomic diameter. There is no need to include atomic form factors in the calculation, since your atoms are identical.
Eqn 4.1 gives a crystal-independent measure of order $$T^* = \frac{ \int_{\rho^{1/3}\sigma}^{\xi_C} \left | h(\xi) \right | d\xi }{\xi_C - \rho^{1/3}\sigma}$$
where $$h(\xi) = g(\xi) - 1$$ where $$g(\xi)$$ is the radial distribution function, $$\xi=r\rho^{1/3}$$ where $$r$$ is the radial coordinate, $$\rho = \frac N V$$ is the number density, and $$\xi_C$$ is a cutoff limited by the size of the box.