# Density Fitting¶

The Coulomb potential in Band is computed using a method called density fitting. The density fitting scheme in BAND is called Zlm Fit, and it is described in reference 53. The ZlmFit is also used to compute (when needed) the gradient and hessian of the electron density.

## Zlm Fit¶

The idea behind Zlm Fit can be summarized as follows: the total electron density is split into localized atomic densities (in a similar way as the volume is partitioned in the Becke grid). These atomic densities are then approximated by a combination of radial spline functions and real spherical harmonics (Zlm), for which the Coulomb potential can be easily computed.

ZlmFit
Quality [Auto | Basic | Normal | Good | VeryGood | Excellent]
AtomDepQuality # Non-standard block. See details.
...
End
End

ZlmFit
Type: Block Options for the density fitting scheme ‘ZlmFit’.
Quality
Type: Multiple Choice Auto [Auto, Basic, Normal, Good, VeryGood, Excellent] Quality of the density-fitting approximation. For a description of the various qualities and the associated numerical accuracy see reference. If ‘Auto’, the quality defined in the ‘NumericalQuality’ will be used.
AtomDepQuality
Type: Non-standard block One can specify different ZlmFit-quality for different atoms, The syntax for this free block is ‘iAtom quality’, where iAtom is the index of the atom in input order. For the atoms that are not present in the AtomDepQuality sub-block, the quality defined in the Quality key will be used.

Example: Multiresolution illustrates how to use the AtomDepQuality option.

### Expert options¶

ZlmFit
LMargin integer
AllowBoost [True | False]
DensityThreshold float
PartitionFunThreshold float
FGaussianW float
FGridSpacing float
FKSpaceCutOff float
FirstTopoCell integer
LastTopoCell integer
OrderTopoTrick integer
NumStarsPartitionFun integer
End

ZlmFit
Type: Block Options for the density fitting scheme ‘ZlmFit’.
LMargin
Type: Integer 4 User-defined l-margin, i.e., l_max for fitting is max(lMargin + l_max_basis_function, 2*l_max_basis_function)
AllowBoost
Type: Bool True Allow automatic atom-dependent tuning of maximum l of spherical harmonics expansion. Whether or not this boost is needed for a given atom is based on an heuristic estimate of how complex the density around that atom is.
DensityThreshold
Type: Float 1e-07 Threshold below which the electron density is considered to be negligible.
PartitionFunThreshold
Type: Float 0.0 Threshold for the partition functions: if an integration point has a partition function weight smaller than this threshold, it will be discarded.
FGaussianW
Type: Float 1.0 Only for 3D periodic systems. Width of the Gaussian functions replacing the S and P Zlms for Fourier transform.
FGridSpacing
Type: Float Only for 3D periodic systems. Spacing for the Fourier grid. By default, this depends on the quality.
FKSpaceCutOff
Type: Float Only for 3D periodic systems. Cut-off of the grid in k-space for the Fourier transform.
FirstTopoCell
Type: Integer 5 First cell for the topological extrapolation of the long range part of the Coulomb Potential.
LastTopoCell
Type: Integer 10 Last cell for the topological extrapolation of the long range part of the Coulomb Potential.
OrderTopoTrick
Type: Integer 3 Order of the topological extrapolation of the long range part of the Coulomb Potential.
NumStarsPartitionFun
Type: Integer 5 Number of cell stars to consider when computing the partition function.

## STO Fit (Deprecated)¶

In previous version of BAND (pre2014) this was the default option, which is now replaced by Zlm Fit. It is still used in the context of NMR and OldResponse calculations.