Fourier Transforms and Plane-Wave Expansions¶
Authors:Guoyuan Liu, Dou Du and Giovanni Pizzi
Source code: https://github.com/osscar-org/quantum-mechanics/blob/master/notebook/band-theory/FFT_and_planewaves.ipynb
This notebook shows interactively how a discrete Fourier series can be used to represent a function with a limited number of plane-wave components. A common way to represent a wavefunction when solving the Kohn-Sham equations for a periodic solid is via its expansion in plane waves. This notebook focuses on a simple example (much simpler than a complete DFT calculation) in order to help the reader focus on the essential aspects of such a representation.
Goals¶
- Understand how a plane-wave basis is directly related to a Fourier series.
- Learn how to decompose a function using an FFT algorithm.
- Examine how a function is reconstructed from a finite (possibly not complete) set of plane waves.
- Understand the impact of the basis-set size on the convergence of the integral of the reconstructed function.
Background theory¶
Tasks and exercises¶
- Background theory: prove that plane waves form an orthogonal basis set.
Solution
We have to prove that $\langle w_N^j, w_N^k \rangle =\langle w_N^k, w_N^j \rangle= 0 $ for integer $j \neq k$. We can simply carry out the inner product
$$ \langle w_N^j, w_N^k \rangle = \langle w_N^k, w_N^j \rangle = \int_{-\pi}^{\pi} e^{ijx} e^{-ikx}dx = \int_{-\pi}^{\pi} e^{i(j-k)x} dx = \frac 1 {i(j-k)} [e^{i(j-k)x}]_{-\pi}^{\pi} = \begin{cases} 0 & \text{if j $\neq$ k} \\ 2\pi & \text{if j = k}\end{cases}$$ - How does the number of plane waves affect the approximation of the target function? Move the $N_{fft}$ slider to modify the number of Fourier components used in the approximation. Will a function with more "oscillations" require more components to be accurately represented? You can change the objective function (from a relatively smooth function to a more oscillatory one) via the drop-down menu.
Solution
Observe whether the FFT interpolation approximates well the original function and if the integral of the square modulus is close to the converged value indicated by the red horizontal line. Generally, increased sampling yields a more accurate representation of the objective function. For functions with more oscillations (higher frequency components), more Fourier components are needed to reach the same level of accuracy. - Background theory: how can we reduce the number of plane waves needed in a DFT calculation, without sacrificing the accuracy of the representation?
Solution
Wavefunctions have the strongest oscillations near nucleus, and a very large number of plane waves is needed to accurately represent this region. Fortunately, core electrons are less relevant in chemical bonding, so we can simplify the problem and obtain a much smoother (pseudo)wavefunction by excluding the core electrons. To learn more about this approach, please check our notebook on pseudopotentials. In general, the combination of pseudopotentials and a plane-wave expansion enables fast and accurate calculation of materials and their properties.
- Background theory: in a DFT calculation, how can we control the number of plane waves used in the basis set?
Solution
The kinetic energy of a plane wave of momentum $\mathbf G$ is given by $\frac {\hbar^2}{2m} \lvert \mathbf G \rvert^2$. By setting a cutoff energy, we can limit the size of the plane-wave basis set. The value of the required cutoff depends on the system under investigation and the pseudopotential used. Convergence tests are normally required to gain confidence in the value of the cutoff employed. To have a suggestion of a converged cutoff value based on the choice of pseudopotentials, you can check the standard solid-state pseudopotentials (SSSP) library on Materials Cloud.
Interactive Figures¶
The target function, sampling points and the reconstructed function are shown in the top left plot. The real part (cosine functions) and the constant term of the discrete Fourier series are shown in the top right panel.
Note that the components are shifted vertically for clarity. The integral of the square of the functions reconstructed from truncated Fourier series with different numbers of plane waves $N_{\text{fft}}$ is shown in the bottom panel, where the current choice of sampling is indicated with a red dot. The converged value is also shown with a red horizontal line, obtained with a large number (200) of FFT components.
Controls¶
The number of FFT components $N_{\text{fft}}$ can be set by the slider. Two target functions can be chosen from the drop-down menu. By clicking on one of the basis functions in the top-right panel, the contribution of that basis function will be shown in the top left panel. One can click the reset button to display all basis functions again.