# Number of k-points vs number of electrons: which is more significant in terms of computational cost for plane-wave calculations?

When using plane-wave codes for solid-state calculations, which computational parameter is more significant in increasing the computational cost: number of electrons or number of k-points?

I ask this question because I am planning a large-scale calculation (512-atom supercell, HSE06, VASP), but I doubt my accessible computational resources have the enough memory.

• As your supercell dimesion will be quite high, the need for K-Point may boil down to 1 or so, straight forward your calculation will scale with number of electrons only Jul 14, 2022 at 16:25
• @Pranavkumar Now I had to reduce my supercell to less than 200 atoms, Gamma-only sampling. The previous plan was tested to be too heavy for me. Jul 15, 2022 at 7:09
• Check supercell size in length unit, and decide Jul 16, 2022 at 1:25
• In conventional DFT, the computational cost scales cubically with the number of electrons and linearly in the number of k-points. Thus the number of electrons is more significant in computing the cost of a large simulation. A straightforward implementation of generalised DFT (e.g. HSE06) scales quadratically with the number of k-points; however, VASP has various approximate forms for non-local functionals, some of which ignore the interactions between k and k' which means they scale linearly with k-points again (but aren't strictly correct...) Aug 5, 2022 at 23:15

There are two major computational resources we should consider: the computational time, and the computational storage (RAM).

### Computational time

In conventional DFT, the computational time scales linearly with the number of k-points, and cubically with the number of electrons (in the limit of large simulations; for modest simulation sizes it may appear to scale quadratically).

The reason it scales linearly with k-points is straightforward: the Kohn-Sham equations have a k-point index on all quantities:

$$\hat{H}^{KS}_k[\rho]\psi_{bk} = \epsilon_{bk} \psi_{bk},\tag{1}$$

where $$b$$ is a band index (essentially an electron index) and $$k$$ is a k-point index. Therefore the states at different k-points are independent of each other, and the cost of more k-points is just the cost of the calculations at the extra k-points.

The solutions at different k-points are coupled via the density,

$$\rho(r) = \sum_{bk}f_{bk}\vert\psi_{bk}(r)\vert^2,\tag{2}$$

where $$f_{bk}$$ are the band-occupancies. However, this cost also scales linearly with k-points.

The Kohn-Sham wavefunctions must form an orthonormal set, and must be eigenstates of the Hamiltonian in the computed subspace. Both of these involve constructing a band-band matrix, and either inverting (orthonormalisation) or diagonalising (finding the eigenstates of the subspace Hamiltonian). Matrix inversion and matrix diagonalisation both scale as the cube of the number of matrix rows, hence this part of a DFT calculation scales cubically with the number of bands, and thus cubically with the number of electrons.

### Computational storage

The computational storage scales linearly with the number of k-points, for the same reasons as for computational time. The scaling with the number of electrons is, strictly-speaking, quadratic, since the band-overlap and subspace Hamiltonian matrices scale quadratically with the number of electrons. However, in practice the storage is usually dominated by the Kohn-Sham wavefunctions and the non-local pseudopotential projectors (if stored in the full representation), both of which scale linearly with the number of electrons.

### Conclusion

Since the scaling with the number of electrons is always a higher-order than the scaling with k-points, the number of electrons is more significant in determining the computational cost of a large simulation.

### Subtleties and details

##### Parallel complications

On a high-performance computer, it is relatively trivial to parallelise over k-points since almost all calculations only require summations over the k-points, but parallelising over electrons (i.e. Kohn-Sham bands) requires all-to-all communications; thus, it is much more efficient to run a many-k-point calculation than a many-electron calculation.

##### Non-local/hybrid functionals

A straightforward implementation of generalised DFT with non-local or hybrid functionals (e.g. HSE06) causes the computational time to scale quadratically with the number of k-points, rather than linearly. However, VASP has various approximate forms for non-local functionals, some of which ignore the interactions between k and k', which means they scale linearly with k-points again (but aren't strictly correct...)

These classes of functionals also scale quadratically in time with the number of electrons, but this is better scaling than other operations in DFT so doesn't affect the large-system behaviour.

##### Linear-scaling DFT

So far, I've focused on conventional DFT such as is implemented in VASP (or ABINIT, CASTEP, Quantum Espresso...). There are also linear-scaling DFT programs (e.g. ONETEP, CONQUEST; also some operational modes of SIESTA, CP2K etc) and in these cases both the computational time and storage should scale linearly with the number of electrons (band) as well as k-points.

##### Caveats

I've assumed that only the numbers of electrons and/or k-points are changing; in particular, I have assumed that the simulation volume is constant.

I've only considered the computational cost of calculating the Kohn-Sham ground state. Certain properties scale differently, for example Fermi-surface integrals require double-integrals over k-points, so scale quadratically with k-points; they also only involve states on (or near) the Fermi surface, so there are far fewer bands active in this part of the calculation and it tends to scale sub-linearly with the number of electrons (roughly speaking, as the square-root).