# Pair distribution functions#

The pair distribution function describes the spatial correlation between particles.

## Two-dimensional (planar) pair distribution function#

Here, we present the two-dimensional pair distribution function $$g_{\text{2d}}(r)$$, which restricts the distribution to particles which lie on the same surface $$S_\xi$$.

Let $$g_1$$ be the group of particles which are centered, and $$g_2$$ be the group of particles whose density around a $$g_1$$ particle is calculated. Furthermore, we define a parametric surface $$S_\xi$$ as a function of $$\xi$$,

$S_\xi = \{ \mathbf{r}_{\xi} (u, v) | u_{\text{min}} < u < u_{\text{max}}, v_{\text{min}} < v < v_{\text{max}} \}$

which consists of all points $$\mathbf{r}_\xi$$. By varying $$u, v$$ we can reach all points on one surface $$\xi$$. Let us additionally consider a circle on that plane $$S_{i, r}$$ with radius $$r$$ around atom $$i$$ given by

$S_{i, r} = \{ \mathbf{r}_{i, r} | \; || ( \mathbf{r}_{i, r} - \mathbf{x_i} || = r ) \land ( \mathbf{r}_{i, r} \in S_{\xi, i} ) \}$

where $$S_{\xi, i}$$ is the plane in which atom $$i$$ lies.

Then the two-dimensional pair distribution function is

$g_{\text{2d}}(r) = \left \langle \sum_{i}^{N_{g_1}} \frac{1}{L(r, \xi_i)} \frac{\sum_{j}^{N_{g_2}} \delta(r - r_{ij}) \delta(\xi_{ij})} {\vert \vert \frac{\partial \mathbf{f}_i}{\partial r} \times \frac{\partial \mathbf{f}_i}{\partial \xi} \vert \vert _{\phi = \phi_j}} \right \rangle$

where $$L(r, \xi_i)$$ is the contour length of the circle $$S_{i, r}$$. $$\mathbf{f}_i(r, \gamma, \phi)$$ is a parametrization of the circle $$S_{i, r}$$.

Discretized for computational purposes we consider a volume $$\Delta V_{\xi_i}(r)$$, which is bounded by the surfaces $$S_{\xi_i - \Delta \xi}$$, $$S_{\xi_i + \Delta \xi}$$ and $$S_{r - \frac{\Delta r}{2}}, S_{r + \frac{\Delta r}{2}}$$. Then our two-dimensional pair distribution function is

$g_{\text{2d}}(r) = \left \langle \frac{1}{N_{g_1}} \sum_i^{N_{g_1}} \frac{\text{count} \; ({g_2}) \; \text{in} \;\Delta V_{\xi_i}(r)} {\Delta V_{\xi_i}(r)} \right \rangle$

### Derivation#

Let us introduce cylindrical coordinates $$r, z, \phi$$ with the origin at the position of atom $$i$$.

\begin{split}\begin{aligned} x &= r \cdot \cos \phi \\ y &= r \cdot \sin \phi \\ z &= z \\ \end{aligned}\end{split}

Then the two-dimensional pair distribution is given by

$g_{\text{2d}}(r, z=0) = \left \langle \sum_{i}^{N_{g_1}} \frac{1}{2 \pi r} \sum_{j}^{N_{g2}} \delta(r - r_{ij}) \delta(z_{ij}) \right \rangle$

where we have followed the general derivations given above.

For discretized calculation we count the number of atoms per ring as illustrated below

The sketch shows an atom $$i$$ from group $$g_1$$ at the origin in blue. Around the atom a ring volume with average distance $$r$$ from atom i is shaded in light red. Atoms $$j$$ from group $$g_2$$ are counted in this volume.

## One-dimensional (cylindrical) pair distribution functions#

Here, we present the one-dimensional pair distribution functions $$g_{\text{1d}}(\phi)$$ and $$g_{\text{1d}}(z)$$, which restricts the distribution to particles which lie on the same cylinder along the angular and axial directions respectively.

Let $$g2$$ be the group of particles whose density around a $$g1$$ particle is to be calculated and let $$g1, g2$$ lie in a cylinderical coordinate system $$(R, z, \phi)$$.

Then the angular pair distribution function is

$g_{\text{1d}}(\phi) = \left \langle \sum_{i}^{N_{g_1}} \sum_{j}^{N_{g2}} \delta(\phi - \phi_{ij}) \delta(R_{ij}) \delta(z_{ij}) \right \rangle$

And the axial pair distribution function is

$g_{\text{1d}}(z) = \left \langle \sum_{i}^{N_{g_1}} \sum_{j}^{N_{g2}} \delta(z - z_{ij}) \delta(R_{ij}) \delta(\phi_{ij}) \right \rangle$

Discretized for computational purposes we consider a volume $$\Delta V_{z_i,R_i}(\phi)$$, which is bounded by the surfaces $$S_{z_i - \Delta z}$$, $$S_{z_i + \Delta z}$$, $$S_{R_i - \Delta R}$$, $$S_{R_i + \Delta R}$$ and $$S_{\phi - \frac{\Delta \phi}{2}}, S_{\phi + \frac{\Delta \phi}{2}}$$. Then our the angular pair distribution function is

$g_{\text{1d}}(\phi) = \left \langle \frac{1}{N_{g_1}} \sum_i^{N_{g_1}} \frac{\text{count} \; ({g_2}) \; \text{in} \;\Delta V_{z_i,R_i}(\phi)} {\Delta V_{z_i,R_i}(\phi)} \right \rangle$

Similarly,

$g_{\text{1d}}(z) = \left \langle \frac{1}{N_{g_1}} \sum_i^{N_{g_1}} \frac{\text{count} \; ({g_2}) \; \text{in} \;\Delta V_{\phi_i,R_i}(z)} {\Delta V_{\phi_i,R_i}(z)} \right \rangle$