In the “XANSONS for COD” project, x-ray and neutron powder diffraction patterns are calculated for two different types of model samples: (a) *isolated* spherical crystalline *particle* of a given size (diameter), *D*, (b) *solid* crystalline *material* with long-range order broken on the distances greater than a given value, *D*. These two samples are referred as isolated particle and solid material below. For both cases, the value of *D* varies in the range from 6 nm to 30 nm with the step of 3 nm resulting in 18 powder diffraction patterns in total for a given structure from the COD and for a given type of incident radiation source (x-ray or neutron). Notwithstanding that the shape of the nanocrystals affects the diffraction pattern (especially at small scattering angles), the variation of crystallite shape in addition to the variation of its size is out of the scope of this project. Note that during the alpha-testing of the project, which took place in November 2016, only isolated particles were considered.

For both types of model sample, the calculation algorithm is the same and consists of 3 steps. Each step, however, performs slightly different for an isolated particle and a solid material. These steps are:

calculating the atomic ensemble using the lattice parameters and unit cell configuration extracted from the Crystallography Information File (CIF),

calculating the histogram of interatomic distances for this atomic ensemble,

calculating the scattering intensity using the histogram of interatomic distances.

The step 1 performs on a CPU and is not parallelized. It has computational complexity O(*N*), where *N* is the total number of atoms in atomic ensemble. For both types of model samples, the atomic ensemble is a spherical nanoparticle of radius *R*. While for an isolated particle, *R* equals to *D*/2, for a solid material, *R* equals to *R*_{BS} + *D*, where *R*_{BS} is the radius of “bounding sphere” (by analogy with bounding box). The radius of bounding sphere is set to 6 nm for all values of *D*. Creating such a big atomic ensemble for a solid material sample guarantees that any atom from the bounding sphere is surrounded by other atoms on any distance less than *D*. This emulates the periodic boundary conditions which are not supported in XaNSoNS.

The step 2 has complexity O(*N*^{2}) for an isolated particle and O(*N*·*N*_{BS}) for a solid material, where *N*_{BS} is the number of atoms in the bounding sphere. The width of histogram bin, *Δ*_{bin}, is set to 0.001Å (see Eq. (2) in [4]). This step is parallelized with OpenMP in the CPU version of the application. In the CUDA and OpenCL versions it performs on a GPU. Since the total number of atoms in the isolated particle or in the correlation sphere could be up to 10^{7}, the histogram of interatomic distances must be a 64-bit integer array. Not being a problem when computing on a CPU, this becomes the main factor affecting the performance when computing on a GPU because each read-modify-write (RMW) operation applied to this array must be synchronized between all parallel threads. For AMD and Nvidia GPUs, atomic operations on 64-bit integers are used for synchronized writing in GPU memory. These operations are not supported by Intel GPUs and therefore 32-bit atomic operations, performed separately for two halves of a 64-bit integer, are used for Intel. The GPU-specific implementation of the atomic operations and the GPU memory throughput strongly influence the performance. Despite all the limitations, calculation of the histogram of interatomic distances performs 20-40 times faster on high-end GPU than on high-end CPU (if all CPU cores are loaded).

The computational complexity of step 3 is O(*N*_{bin} · *N*_{DP}), where *N*_{bin} is the number of histogram bins and *N*_{DP} is the resolution of diffraction pattern. This step is also parallelized in the CPU version of the application and performs on a GPU in the CUDA and OpenCL versions. For an isolated particle, Eq. (3) from [4] is used to calculate the scattering intensity. For a solid material, this equation is modified as follows:

$$\begin{array}{}{\displaystyle S(q)=4\pi \rho ({R}_{cut}{)}^{3}({f}_{av}(q){)}^{2}\frac{\mathrm{sin}(q{R}_{cut})}{q{R}_{cut}((q{R}_{cut}{)}^{2}-{\pi}^{2})}}\\ {\displaystyle \phantom{\rule{2em}{0ex}}+\frac{1}{{N}_{BS}}\sum _{e{l}_{i}-1}^{{N}_{el}}(({f}_{e{l}_{i}}(q){)}^{2}{N}_{e{l}_{i}}^{"at"}}\\ {\displaystyle \phantom{\rule{2em}{0ex}}+\sum _{e{l}_{j}=e{l}_{i}}^{{N}_{el}}{f}_{e{l}_{i}}(q){f}_{e{l}_{j}}(q)\sum _{k=0}^{{N}_{bin}-1}\phantom{\rule{thinmathspace}{0ex}}[{H}_{e{l}_{i},e{l}_{j}}{]}_{k}\frac{\mathrm{sin}(\pi {r}_{k/{R}_{cut}})}{\pi {r}_{k/{R}_{cut}}}\frac{\mathrm{sin}(q{r}_{k})}{q{r}_{k}}),}\end{array}$$(1)

where *S* is the scattering intensity, *q* is the scattering vector magnitude, *ρ* is the average atomic density of the model sample, *R*_{cut} = *D* is the cutoff radius (the longest distance at which the atoms are still correlated), *f*_{av} is the average atomic form-factor of the model sample, *el*_{i} and *el*_{j} are the indexes of chemical elements, *N*_{el} is the total number of different chemical elements in the model sample, *f*_{eli} is the atomic from-factor of the chemical element with the index *el*_{i},

$\begin{array}{}{N}_{e{l}_{i}}^{\u201dat\u201d}\end{array}$

is the total number of atoms of the element *el*_{i}in the bounding sphere, *H*_{eli, elj} is the histogram of interatomic distances, *k* is the index of histogram bin, and *r*_{k} = (*k* + 0.5) *Δ*_{bin}.

The factor

$\begin{array}{}{\displaystyle \frac{\mathrm{sin}(\pi {r}_{k}/{R}_{cut})}{\pi {r}_{k}/{R}_{cut}}}\end{array}$

is the weight coefficient that smoothly suppresses the contribution of long-range interatomic correlations. This weight coefficient is also used in [5]. The effect of this coefficient on the scattering intensity is shown in Figure 1 in [6]. The first term in (1) describes the contribution of a continuous sphere with atomic density

$\begin{array}{}{\displaystyle \rho \frac{\mathrm{sin}(\pi r/{R}_{cut})}{\pi r/{R}_{cut}}}\end{array}$

and radius *R*_{cut}.

Figure 1 X-ray powder diffraction pattern calculated for nanocrystallites of AlCsF_{4} (COD ID number: 1000106). The model samples are: (a) an isolated spherical nanoparticle with diameter *D* = 9 nm and *D* = 15 nm, (b) the solid nanocrystalline material with long-range order broken on the distances greater than *R*_{cut} = 9 nm and *R*_{cut} = 15 nm

Figure 1 shows the comparison of x-ray powder diffraction patterns calculated for an isolated particle (a) and a solid material (b) of AlCsF_{4} [7] (COD ID number: 1000106).

The behavior of simulated powder diffraction patterns for these two types of the sample is different at small values of *q*. Notice that the large sinusoid seen on the plot “a” is gone on the plot “b”. The diffraction peaks are always broader for the isolated nanoparticles of the diameter *D* than for the material with interatomic distances cutoff at the *R*_{cut} = *D*. Artificially cutting off the interatomic distances results in negative values of scattering intensity at some values of *q*. However, this should not significantly reduce the accuracy of interpretation of experimental data where the simulated diffraction patterns are used.

## Comments (0)

General note:By using the comment function on degruyter.com you agree to our Privacy Statement. A respectful treatment of one another is important to us. Therefore we would like to draw your attention to our House Rules.