# Hartree-Fock Exchange RI¶

The implementation in ADF of the calculation of exact exchange (Hartree Fock exchange), which is needed for the hybrid functionals, is based on work by Watson et al., Ref. [138]. The difference with their method is the way in which ADF the orbital densities are fitted.

Memory usage

Calculation of the Hartree-Fock exchange may require a lot of memory. Shared memory is used to buffer the necessary data used by all processes on a multi-processor node. By default, ADF will use 30% of the total physical memory of the computer for this buffer, which may be more than is desirable or possible. This amount, in megabytes, can be set using a HFMAXMEMORY input keyword.

HFMaxMemory mbytes


The amount of memory used is related how many atoms can be done in a single pass. Thus, another way to limit the amount of memory used by ADF is to limit the number of atoms done per pass. The latter can be done using the HFATOMSPERPASS keyword. The safest, but also the slowest, is to set HFATOMSPERPASS to 1.

HFAtomsPerPass AtomsPerPass


If both HFMAXMEMORY and HFATOMSPERPASS are present, the value specified in HFATOMSPERPASS takes precedence. To debug memory usage in the Hartree-Fock routine, one can use a PRINT HARTREEFOCK keyword.

Numerical issues

Numerical problems have been found with the present implementation of Hartree-Fock or (meta-)hybrids during the SCF, especially if the molecule has symmetry NOSYM and a basis set TZP or larger is used. Workaround is to use always the DEPENDENCY key with rather strict criteria for the basis set dependence, namely bas=4e-3. In ADF2010 these numerical problems have been reduced. The DEPENDENCY key is automatically switched on in the case of a Hartree-Fock or a (meta-)hybrid potential. The result of the DEPENDENCY key is that linear dependence of the basis set is reduced by removing linear combinations that correspond with eigenvalues in the virtual SFOs overlap matrix, which are smaller than, in this case, 4e-3. Note that this is a rather large value, such that it will have an effect on the bonding energy. For DZ and DZP basis sets this value will normally not result in reduction of the virtual space. However, for TZP, TZ2P, QZ4P and larger this will often result in reduction of the basis set, which will have an effect on the accuracy of the bonding energy. In these cases one could try a smaller value than 4e-3, but be aware that numerical problems may occur. If the molecule has symmetry the numerical problems are reduced.

The origin of this problem is that for an accurate description of Hartree-Fock exchange one needs more (diffuse) fit functions in the fit procedure which is used in ADF, which uses only fit functions on the two centers of the two STOs. One can get more diffuse fit functions if one adds in the Create run of an atom the key:

AddDiffuseFit


If the BASIS key is used one can also add this key in the molecular calculation (the scripts in ADF will then automatically add this in the Create runs of the atoms). If one adds this key preliminary results indicate that one can lower the value for the dependency key to bas=1e-4. Such a low value for the dependency key normally means that the basis set is not reduced for basis sets of TZP or TZ2P quality.

A different way to add fit functions that is useful for standard basis sets DZ, DZP, TZP, and TZ2P is to add the subkey ‘Fittype QZ4P’ in the BASIS key, thus:

BASIS
Type ...
Core ...
FitType QZ4P
End


In ADF2013 use is made of distance cut-offs for the calculation of the HF exchange integrals. This can reduce computation time and memory usage, especially for large molecules, however, this can also reduce the precision, which can lead to numerical problems. It is possible to set the distance cut-off threshold (starting from ADF2013.01b) for the calculation of the HF exchange integrals, A value of 99 for hffit virtually excludes the possibility that something will be neglected:

LINEARSCALING
HF_FIT hffit
END


SCF problems

However, for larger molecules and in case the molecule contains heavy elements (Z>36) one still should use rather strict criteria for the basis set dependence, such as bas=4e-3.

In case of SCF problems that might be related to numerical issues one can try one or more of the following, that were discussed before

LINEARSCALING
HF_FIT 99
END
Basis
FitType QZ4P
End
Dependency bas=5e-3


## New Hartree-Fock RI scheme¶

In ADF2016 a new scheme for the calculation of the Hartree-Fock exchange has been implemented. The new scheme is not used by default (unless you are using a range separated hybrid with the LibXC library).

The new Hartree-Fock RI scheme uses a larger fit set than the default scheme (including H and I fit functions); this should lead to more accurate results, especially for f-block elements.

To use it you must specify:

RIHartreeFock
UseMe True
End


Technical aspects of the RI scheme can be tweaked in the RIHartreeFock key block:

RIHartreeFock
UseMe {False|True}
Quality {basic|normal|good|verygood}
FitSetType {Mirko|ET6|ET7|ET8}
DependencyThreshold 1.0E-3
End

UseMe
Default: False. Set to True if you want to use the new RI scheme.
Quality
Default: Normal. Set the numerical quality of some internal technical procedures, including numerical integration and linear scaling parameters. The quality defined in the RIHartreeFock block key overrules the NumericalQuality.
FitSetType
Default: Mirko. The auxiliary fit set employed in the RI scheme. ET8 is a fairly large fit set, and can be used for assessing the accuracy of the RI procedure.
DependencyThreshold
Default: 1.0E-3. To improve numerical stability, almost linearly-dependent combination of basis functions are removed from the Hartree-Fock exchange matrix. If you obtain unphysically large bond energy in an Hybrid calculation, you might try setting the DependencyThreshold to a larger value (e.g. 3.0E-3).

Notes:

• Range separated hybrids that use the error function for range separation (e.g. CAM-B3LYP) can only be used in combination with the new RIHartreeFock scheme.
• The new Hartree-Fock RI scheme should not be used in NMR calculations.