Periodic systems I. Density fitting
These notes are the preliminary calculations I ran to build familiarity with periodic systems, lightly cleaned up for publishing.
The four-index electron-repulsion integral is a main ingredient for HF, MP2, RPA, hybrid functionals, and most of quantum chemistry. It is written as
For periodic systems these integrals are computationally expensive, so we approximate them with density fitting. We can read the integral as the repulsion between two generalized electron densities , such that
The approximation is to expand that density in an auxiliary basis,
where the are fitting coefficients, obtained by minimizing some functional of the fitting error (for the Coulomb metric, the error in the electric field). One standard form is
with the three-center integral
and the Coulomb repulsion matrix of the auxiliary functions . The four-index integral then factorizes as
which resembles a resolution of identity in quantum mechanics, so density fitting (DF) is also called the resolution-of-identity (RI) approximation.
DF-MP2
The bottleneck of an MP2 calculation is the integral transformation from AO to MO basis, . In the DF scheme this becomes , much less than the conventional where dominates.
DF in PySCF
There are four flavors of DF implemented in PySCF. Gaussian density fitting (GDF) uses Gaussian-type orbitals as the auxiliary functions. Fast-Fourier-transform density fitting (FFTDF) uses plane waves, and is also known as the Gaussian-and-plane-wave (GPW) approach. Mixed density fitting (MDF) uses both. Range-separated density fitting (RSDF) is an efficient implementation of GDF that splits the Coulomb metric into short-range and long-range parts with an error function. The short-range part decays fast with distance, so its lattice sum converges quickly when evaluated directly in real space; the long-range part is smooth, so its Fourier components die off quickly and the sum converges in few terms in reciprocal space. Splitting the metric lets each piece be evaluated where it is cheap, the same logic as Ewald summation.
By default PySCF uses FFTDF in a periodic calculation. This can be changed, for example to GDF, by altering the object as
mf = scf.KRHF(cell, kpts).density_fit()
Only GDF and MDF can be used for all-electron calculations (that is, without freezing the core), because FFTDF would need an impractically large plane-wave basis to describe the sharp core orbitals accurately.
Diamond
The first benchmark is an energy calculation on the diamond primitive cell. Use the primitive cell when possible, since the result is the same as the conventional cell while the conventional cell costs times more, where is the scaling exponent of the method. The calculation is carried out with the following parameters.
- GTH-HF-rev pseudopotential
- GTH-cc-pVDZ basis (not in PySCF’s preloaded
pbcbasis sets; parse it withgto.mol.basis.parse) - k-point meshes of size , with for FFTDF, for GDF, and for RSDF
When running MP2 at large k-meshes, don’t store the amplitudes, which would eat memory at large meshes. This is achieved by
mmp = mp.KMP2(mf)
mmp.kernel(with_t2=False)
Energies
| HF energy (Eh) | GDF | RSDF | FFTDF |
|---|---|---|---|
| −10.2128685 | −10.2128685 | −10.21286713 | |
| −10.95686485 | −10.95686485 | −10.95687283 | |
| −11.02220654 | −11.02220654 | −11.02221347 | |
| −11.02867244 | −11.02867244 | −11.02868016 | |
| −11.02830944 | −11.02830944 | ||
| −11.02734337 |
Taking FFTDF as numerically exact for this AO basis, the tables below list the errors .
| HF energy error (Eh) | GDF | RSDF |
|---|---|---|
| 0.0000013715 | 0.0000013726 | |
| 0.0000079775 | 0.0000079782 | |
| 0.0000069266 | 0.0000069244 | |
| 0.0000077172 | 0.0000077172 | |
| MAE | 0.0000059982 | 0.0000059981 |
| RMSE | 0.0000065775 | 0.0000065772 |
| MP2 corr. energy error (Eh) | GDF | RSDF |
|---|---|---|
| 0.0000270229 | 0.0000270241 | |
| 0.0000070320 | 0.0000070301 | |
| 0.0000043544 | 0.0000043547 | |
| 0.0000040885 | 0.0000040886 | |
| MAE | 0.0000106245 | 0.0000106244 |
| RMSE | 0.0000142773 | 0.0000142777 |
The errors are all on the order of hartree, the same magnitude as the HF energy errors reported in the RSDF paper (Ye and Berkelbach, J. Chem. Phys. 154, 131104 (2021)). Even for MP2 correlation energies, GDF and RSDF stay on the same order. There is no significant accuracy difference between GDF and RSDF as a function of mesh size when compared against FFTDF.
CPU time
| HF CPU time (s) | FFTDF | GDF | RSDF | |
|---|---|---|---|---|
| 1 | 10.3 | 2390.46 | 231.92 | |
| 8 | 143.69 | 3255.22 | 339.53 | |
| 27 | 1529.01 | 5150.75 | 699.31 | |
| 64 | 8294.77 | 8953.04 | 1914.79 | |
| 125 | 40943.18 | 29613.32 | ||
| 216 | 89105.05 |

While FFTDF is fast at small , its cost catches up to GDF’s by , consistent with the known scaling of FFTDF. GDF and RSDF grow more slowly over this range, with RSDF keeping the absolute time almost 10-fold below GDF from to . (GDF and RSDF timings include a DF warm-up, since their integrals are not computed on the fly; that warm-up is also why these timings shouldn’t be compared too literally against the near-linear small-mesh scaling reported in the RSDF paper, which was measured on different systems and hardware.)
| MP2 CPU time (s) | FFTDF | GDF | RSDF | |
|---|---|---|---|---|
| 1 | 0.49 | 0.13 | 0.23 | |
| 8 | 261.59 | 2.23 | 2.45 | |
| 27 | 9198.81 | 52.48 | 45.42 | |
| 64 | 120043.76 | 496.46 | 525.25 | |
| 125 | 15230.4 | 15535.94 | ||
| 216 | 66361.81 |

For MP2 the gap is dramatic. The bottleneck is the integral transformation, and GDF/RSDF work with three-center rather than four-center integrals, so their times sit far below FFTDF’s. The strong dependence itself comes from conservation of crystal momentum: every orbital index in carries a k-point label, and momentum conservation fixes only one of the four, leaving a triple sum over k-points, an factor on top of the per-cell orbital work. Effective exponents fitted over a small range of meshes come out steeper than the formal ones (my fit suggested roughly -like growth for GDF/RSDF here) because the range is short and the warm-up and transformation costs haven’t separated cleanly.