Density fitting
***************

**Zlm Fit: density fitting with radial spline functions and real
spherical harmonics**

In ADF2013 and previous versions, a different density-fitting scheme
(pair fit) was used. Include the key "STOFIT" if you want to use the
old fitting scheme.

The basic ideas behind the so-called Zlm Fit can be described as
follows. The total electron density is split into atomic densities (in
a similar way as the volume is partitioned for the Becke grid). These
atomic densities are then approximated by a combination of radial
spline functions and real spherical harmonics (Zlm). The
implementation in ADF is described in Ref. [2]. The algorithm used in
ADF is related to the procedures proposed by Becke [3] and Delley [1].

The Zlm Fit scheme, which is the default fitting scheme in ADF, offers
certain advantages compared to the old pair-fit method, especially the
possibility of calculating the Coulomb potential to very high
precision.

   ZLMFIT
    Quality {Basic|Normal|Good|VeryGood|Excellent}
    {QualityPerRegion
       Region myregion
       Quality {Basic|Normal|Good|VeryGood|Excellent}
    End}
   End

"Quality"
   The default quality of the Zlm Fit is Normal. It can be changed
   with the "Quality" subkey.

"QualityPerRegion"
   You can override the Zlm Fit quality for atoms in a particular
   region. Example: Multiresolution illustrates how to use this
   option.

The Zlm Fit method can be used for most features of the ADF program.
For the calculation of Hartree-Fock exchange integrals, ADF uses a
different fitting method, see the section on Hartree-Fock exchange.

**Pair fit: symmetric density fit**

The non-default density fitting procedure in ADF, called the pair fit
method, is carried out separately for each pair of atoms. To use it,
include the "STOFIT" keyword.

   STOFIT

The implemented approach has several advantages in efficiency. Its
drawback is that it necessitates the use of all available fit
functions rather than only the symmetric combinations, although the
final result, of course, needs only a symmetric fit because the total
density is a symmetric (A1) function. For atoms far apart, the density
fitting is performed with only symmetric functions. Given the
implemented algorithm, this entails an approximation that can be
tuned:

   A1FIT atomicseparation

"atomicseparation"
   The threshold distance between atoms, *in Angstrom*. The symmetric
   fit approximation is applied only for atoms farther apart. The
   default is 10.0 Angstrom.

**Pair fit: fit integrals**

   STOFIT

For the computation of the Coulomb potential with the pair-fit method,
the program uses a large number of so-called *fit integrals*: overlap
integrals of a fit function with a *product* of two basis functions,
where at least two of the three involved functions are centered on the
same atom. In fact, these are ordinary overlap integrals of STOs,
because the fit and basis functions are all STOs, and a product of
STOs on one center is itself also an STO. To use this STO fitting
method, which was previously the default, use the key "STOFIT" in the
input of ADF (also include it in the Create mode of an atom, if that
mode is used explicitly). For the bond energy, a first-order fit
correction term is included, which makes the bond energy accurate to
first order in the fit.

Obviously, when the two involved atoms are far enough apart, such
overlap integrals become negligibly small. All fit integrals that are
smaller (according to a rough but reasonable estimate) than a preset
threshold are ignored and not computed.

The value of this threshold can be set in the input, using the
"CUTOFF_FIT" subkey of the LINEARSCALING block keyword.

**True density in XC potential**

For the computation of the exchange-correlation potential (XC
potential), the program uses the fitted density by default. This is an
approximation. For the XC potential, the true density can be used if
one includes the keyword "EXACTDENSITY":

   EXACTDENSITY

Using the "EXACTDENSITY" keyword makes the calculation more time-
consuming, but it can improve accuracy in the following cases:

* calculations that require accurate description of virtual orbitals,
  such as most TDDFT calculations;

* when studying systems where weak interactions like van der Waals
  forces and hydrogen bonds are important. For example, "EXACTDENSITY"
  should be switched on when performing a geometry optimization of DNA
  pairs.

**Precision of density fitting on standard output**

In the output file of the ADF calculation, you can find, at the end of
the SCF procedure, concise information about the density-fit
precision: the error integral for the SCF density. The error integral
is the integral of the difference between the exact density and the
fit density, squared. Such values have very little to do with
numerical integration; rather they show whether or not the employed
set of fit functions is adequate to describe the SCF density. Error
integral values that significantly exceed 1e-4 times the number of
atoms are suspicious and may indicate some deficiency in the fit set
for the actual calculation. The fit-error integrals for the initial
(sum-of-fragments) density and the orthogonalized fragments are also
printed. In the bond energy analysis, a first-order fit-correction
term is given. In an optimization, such as a geometry optimization,
all of this information is only printed for the final geometry.

[1] B. Delley, *An all-electron numerical method for solving the local
    density functional for polyatomic molecules*, Journal of Chemical
    Physics 92, 508 (1992)

[2] M. Franchini, P.H.T. Philipsen, E. van Lenthe, L. Visscher,
    *Accurate Coulomb Potentials for Periodic and Molecular Systems
    through Density Fitting*, Journal of Chemical Theory and
    Computation 10, 1994 (2014)

[3] A.D. Becke, R.M. Dickson, *Numerical solution of Poisson's
    equation in polyatomic molecules*, Journal of Chemical Physics 89,
    2993 (1988)
