{'fraction_non_alphanumeric': 0.01954692556634304, 'fraction_numerical': 0.013592233009708738, 'mean_word_length': 4.631195335276968, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Practical approaches to the accurate modelling of EELS edges using density functional theory

The density functional theory (DFT) code WJEN2k is one of the principle codes used for the simulation of electron energy loss spectra. As DFT codes scale poorly with increasing complexity of calculation, it is important to choose input parameters in such a way as to minimise computational time and produce spectra reliable enough to interpret experimental data. Using graphite as an example, we discuss the effects of these input parameters on the timing of the calculation and the spectrum produced.


Introduction
The ability to interpret and extract chemical state and bonding information from electron energy loss (EEL) spectra obtained in the (S)TEM is becoming increasingly important as a result of improvements in the quality of experimental data; aberration correction has pushed the spatial resolution to sub-Å lengthscales and monochromation has improved the spectral energy resolution to 0.1 eV. A combination of both modelling and experiment is therefore needed to get the most information from this important materials characterisation technique.
Over recent years there has been much work on modelling EEL spectra. WIEN2k [1] is one of the principle codes that has been used. WIEN2k is an all electron density functional theory (DFT) code which can simulate EEL spectra. Core-hole effects can be taken into account by the construction of a supercell. DFT codes scale poorly with increasing complexity of the structure, the calculation time being approximately proportional to the cube of the number of atoms. However, continuing advances in high performance parallel computing enable these computationally expensive methods to be used. Using graphite as an example, we will discuss the importance of choosing input parameters in such a way as to minimise computational time and produce spectra reliable enough to interpret experimental data.

Method
All calculations have been carried out using the WIEN2k code. Graphite, with experimentally determined lattice parameter, a = 2.456 Å and c = 6.708 Å [2], has been used as an example structure. The main input parameters which affect both the accuracy and the computational time of a simulation are RK max (the radius of the muffin tin multiplied by the plane wave cut off), the convergence criteria and the number of k-points. First, the effect of all three parameters was investigated for calculations carried out on a single processor to study the effect on the spectrum and the computational time. Spectra were simulated using the TELNES.2 part of the WIEN2k code, and energy dependent broadening was included along with a spectrum broadening of 0.8 eV using the BROADENING part of the code. There are two inequivalent atoms in graphite, and the total spectrum is the sum of the spectra from both atoms. Here, the spectrum for only one of the atoms is plotted. The effect of parallelisation of the code on unit cells of two and sixteen inequivalent atoms was then investigated by carrying out calculations on 1, 2, 4 and 8 processors. Figure 1a shows the effect on the spectrum of changing RK max . The spectra have been simulated using a 18x18x5 k-mesh with a spacing of 0.023 Å -1 in the a* direction and 0.030 Å -1 in the c* direction. The calculation was converged until the difference in the charge between successive iterations was less than 0.0001 electrons. Spectra have been plotted for values of RK max of 4 to 8. The effect on the timing and total energy of each calculation are shown in Figure 1b. As expected, the total energy decreases as RK max increases, as increasing RK max also increases the size of the basis set. For total energy calculations, RK max has to be controlled very carefully, but spectra simulated with an RK max value of 5.0 and over are very similar. The effect of the convergence criteria on the spectrum is shown in Figure 2a. Energy convergence criteria (ec) and charge convergence criteria (cc) have been varied between 0.1 and 0.0001. Calculations have been carried out with an RK max of 7 and an 18x18x5 k-mesh. Surprisingly, the convergence criterion has little effect on the spectrum. Table 1 shows the timings and number of cycles of each calculation. From the table we can see that each calculation has taken at least three cycles. This is due to the program performing several iterations before comparing the output from successive cycles. This means that an energy convergence value of 0.1 Rydbergs actually converges the energy to 0.002 Rydbergs. Figure 2b shows the effect of varying the k-points on the spectrum. The spectra have been simulated with an RK max value of 7 and the calculations have been converged until the difference in the charge between successive iterations is less than 0.0001 electrons. The different meshes are summarised in Table 2 along with the timings and total energy of each calculation. The total energy converges with the total number of k-points, but not in a smoothly decreasing way. This is because, unlike the total energy, the number of k-points is not a variational parameter in DFT [3]. The relationship between the number of irreducible k-points and the time taken per cycle is approximately linear.

The effect of parallelisation
In order to investigate the efficiency of parallelisation of the code, calculations were run on 1, 2, 4 and 8 processors. As well as the standard graphite unit cell that has been used for the single processor investigations, calculations were done for a graphite 2x2x1 supercell with 16 inequivalent atoms. The creation of supercells is important for studying the effect of the corehole on the EEL spectrum, as well as looking at vacancies and substitutions. The constructed supercell needs to large enough for the core-holes (or vacancies or substitution atoms) to be spaced so that they do not interact with each other. The 'scale up' for a parallel calculation is defined as the time taken for the single processor job divided by the time taken for the multiprocessor job. This means that for an ideal case, the scale up would be equal to the number of processors. Figure 3a shows the scale up as the number of processors increases for both unit cells. As can be seen from the figure, the scale up is almost ideal in the case of 16 atoms. For the unit cell with 2 atoms, the time taken decreases as the number of processors is increase to 4, and then starts to increase again. This can be understood by looking at Figure 3b which shows the percentage of time that the code spends in the computationally intensive part a b of the code, lapw1. The relative amount of time spent performing the lapw1 part of the code decreases and most of the time is spent in combining and summing the results from each of the processors. The calculation time for the two atom unit cell was 88 seconds compared with 28797 seconds in the sixteen atom case. This is consistent with the 'rule of thumb' that the time is proportional to the number of atoms cubed.

Summary
In this paper, we have looked at the effects of RK max , k-points, convergence criteria and parallelisation on graphite EEL spectra simulations performed with WIEN2k. We have shown that choosing the parameters carefully can greatly reduce the time taken for the simulation and that the code has excellent parallelisation scaling given a computationally intensive calculation. We have also shown the futility of naively running a calculation on as many processors as possible due to the percentage of time that ends up being spent on the computationally intensive part of the code decreasing and the amount of time being spent combining and summing the results of the calculations increasing.