MBPT scheme
***********

Note:

  This page describes technical aspects of the MBPT (Many-Body
  Perturbation Theory) module which is used in double-hybrid and MP2,
  RPA, GW and GW-BSE calculations. In order to use double-hybrids,
  MP2, or RPA in your calculation you should request it in the XC
  input block. In order to perform a GW calculation, you should
  request it in the GW input block.

ADF implements RPA, GW, and SOS-MP2 (spin-opposite-scaled) using a
newly designed algorithm which in all cases scales quadratically with
system size [1] [3]. Full MP2 is at the moment only implemented using
the canonical RI algorithm which scales to the fifth power with system
size. Thus, we strongly discourage using full MP2 or double-hybrids
employing full MP2 for systems larger than 1000-1500 basis functions.
At the moment ADF features a large number of double-hybrids using SOS-
MP2 only (for a list of implemented functionals see XC input block)
which are significantly faster than conventional double-hybrids while
offering the same level of accuracy [2].

GW, MP2, RPA and double-hybrid functionals can be used with scalar
relativistic effects within the "ZORA", "X2C", or "RA-X2C" formalism.
GW should not be used in combination with solvent models, like COSMO,
or other environments. In ADF2022 and later MP2 and double-hybrid
functionals, GW and RPA can be used with spin-orbit coupling. Note
that in case of spin-orbit coupling approximate SS and OS
contributions are calculated. In ADF2022 in case of ZORA by default
the so-called scaled ZORA orbital energies are used in the MBPT
expressions.

The Formalism used in the double-hybrid calculation can be changed
using the Formalism key. By default, ADF selects the most appropriate
algorithm for your system and functional.

The calculation of the independent-particle polarizability or Kohn-
Sham density response function in imaginary time is the key step in
SOS-MP2, opposite-spin only double-hybrid functionals, GW, and GW-BSE
and RPA for larger systems. The equations are solved in the atomic
orbital basis exploiting sparsity via advanced density fitting
techniques (so-called pair-atomic resolution of the identity or pair-
atomic density fitting) [1]. In case of a SOS-MP2 or RPA calculation,
the polarizability is then contracted with the Coulomb potential. For
SOS-MP2, the correlation energy is then immediately evaluated in
imaginary time while in a RPA calculation the product of Coulomb
potential and polarizability is Fourier transformed to the imaginary
frequency axis where the correlation energy is evaluated using a
matrix logarithm. In a GW calculation, the polarizability is Fourier
transformed to the imaginary frequency axis as well where the so-
called screened interaction is calculated. The QP states are then
evaluated along the real-frequency axis using analytical continuation
techniques.


Recommended numerical settings
==============================

For all calculations using the MBPT scheme (which includes GW, GW-BSE,
RPA, MP2, and double-hybrids), we recommend to consider the following
points:

**Basis set**

Use a basis set of TZ quality or higher.

**Dependency**

One may improve stability of the results by removing linear
dependencies in the basis set, by using the "Dependency" key. For
example:

   DEPENDENCY
      BAS 5e-04
   END

* Augmented basis sets: A value of 5e-3 is recommended

* Non-augmented basis sets: Set the dependency key to values between
  5e-4 and 5e-3

* quasiparticle self-consistent GW: A value of 5e-3 is recommended

* GW-BSE: A value of 5e-3 is recommended

In addition one can increase the value of
RIHartreeFock%DependencyThreshold to improve numerical stability.
Starting from AMS2022 ADF will use a "Dependency bas=5e-3" and
"RIHartreeFock DependencyThreshold=5e-3" in case of (any variant of)
GW and GW-BSE. One can override these values in the input. For RPA,
MP2, and double-hybrids and non-augmented TZ basis sets, typically it
is not needed to include this Dependency key.

**Numerical Quality**

* Augmented basis sets: Numerical quality should be "VeryGood"

* Non-augmented basis sets, TZ: Numerical quality should range from
  "Normal" to  "VeryGood"

* Non-augmented basis sets, QZ: Numerical quality should range from
  "Good" to  "VeryGood"

There is also the option to choose a different numerical quality for
the MBPT and the preceding DFT calculation:

   MBPT
      NumericalQuality Good
   END

sets the numerical quality to Good only for the MBPT calculation. More
information can be found in the MBPT input block section.

**The imaginary time and imaginary frequency grids**

Not in all calculations that use the MBPT scheme the imaginary time
and imaginary frequency grids are used. One can skip this part of the
recommendations if they are not used.

* For SOS-MP2 and opposite-spin only double-hybrids the imaginary time
  grid is used (default MBPT%Formalism is LT), and only the remarks
  for "nTime" are relevant.

* For full MP2, SCS-MP2 and double-hybrids that depend not only on
  opposite-spin both grids are not used (default MBPT%Formalism is
  RI).

* For GW, GW-BSE, and RPA both imaginary time and imaginary frequency
  grids are used (default MBPT%Formalism is LT).

* For GW and GW-BSE, there is the option to use
  GW%analyticalintegration, see the GW description, in which case both
  grids are not used.

* If the MBPT%Formalism is set to RI the imaginary time grid is not
  used.

The imaginary time and imaginary frequency grids can be controlled
with the "nTime" and "nFrequency" keys. For example:

   MBPT
      nTime 32
      nFrequency 32
   END

For an SOS-MP2 or opposite-spin only double-hybrid calculation (with
default MBPT%Formalism is LT) the number of grid points for imaginary
time ("nTime") is automatically adjusted, and increases if the
numerical quality is higher, and increases if heavier elements are
part of the system. Note that the requirements for "nTime" are in
general lower than for a GW, GW-BSE, or RPA calculation.

For GW, GW-BSE, and RPA the numerical quality automatically sets the
number of grid points for imaginary time and frequency integration:

+------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| **Numerical quality**                                                                                | **Number of points**                                                                                 |
+------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| NORMAL                                                                                               | 16                                                                                                   |
+------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| GOOD                                                                                                 | 20                                                                                                   |
+------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| VERYGOOD                                                                                             | 24                                                                                                   |
+------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| EXCELLENT                                                                                            | 32                                                                                                   |
+------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+

**Note** the following: The number of points actually used in a
calculation can differ. At runtime, the MBPT algorithm decides what is
the maximum number of integration points which is reasonable to use.
So the actual number of points which has been used will be equal or
smaller. In case the number of points is set by hand, some info is
printed in the output. In case of a GW calculation, the numbers of
points can also be found in the "adf.rkf" file in the "GW" section
under the names "nTime" and "nFrequency".

**Changing the defaults**: the default settings for the size of the
imaginary time and imaginary frequency integration grids are normally
sufficient, unless the HOMO-LUMO gap of the system is very small. In
that case, one should be careful and test if changing the grid size
changes the results.


MBPT input block
================

   MBPT
      Formalism [Auto | RI | LT | All]
      FrequencyGridType [LeastSquare | GaussLegendre]
      nTime integer
      nFrequency integer
      nLambda integer
      FitSetQuality [Auto | VeryBasic | Basic | Normal | Good | VeryGood]
      IntegrationQuality [VeryBasic | Basic | Normal | Good | VeryGood]
      ThresholdQuality [VeryBasic | Basic | Normal | Good | VeryGood | Excellent]
      Dependency Yes/No
      UseScaledZORA Yes/No
      SigmaFunctionalParametrization [W1 | W2 | S1 | S2 | S1re]
   End

"MBPT"
   Type:
      Block

   Description:
      Technical aspects of the MP2 algorithm.

   "Formalism"
      Type:
         Multiple Choice

      Default value:
         Auto

      Options:
         [Auto, RI, LT, All]

      Description:
         Specifies the formalism for the calculation of the MP2
         correlation energy.                      'LT' means Laplace
         Transformed MP2 (also referred to as AO-PARI-MP2),
         'RI' means that a conventional RI-MP2 is carried out.
         If 'Auto', LT will be used in case of DOD double hybrids and
         SOS MP2, and RI will be used in all other cases.
         'All' means that both RI and LT formalisms are used in the
         calculation.                      For a RPA or GW
         calculation, the formalism is always LT, irrespective of the
         formalism specified with this key.

   "FrequencyGridType"
      Type:
         Multiple Choice

      Default value:
         LeastSquare

      Options:
         [LeastSquare, GaussLegendre]

      Description:
         Use Gauss-legendre grid for imaginary frequency integration
         in RPA and GW calculations instead of the usually used Least-
         Square optimized ones. Has the advantage that it can be
         systematically converged and an arbitrary number of grid
         points can be used. Typically more grid points will be needed
         to get the same level of accuracy. However, the convergence
         of the results with the size of the grid can be more
         systematic. These grids can only be used when Formalism is
         set to RI.

   "nTime"
      Type:
         Integer

      GUI name:
         Number of time points

      Description:
         Number of imaginary time points (only relevant in case the
         Laplace Transformed (LT) formalism is used).
         In the many-body-perturbation theory module in ADF, the
         polarizability (or Kohn-Sham density response function) is
         evaluated in imaginary time to exploit sparsity in the AO
         basis. For MP2, this is often referred to as a Laplace
         transform. For MP2, 9 points are the default. This is a safe
         choice, guaranteeing accuracies higher than 1 Kj/mol for most
         systems (For many simple organic systems, 6 points are
         sufficient for good accuracy).                      Only for
         systems with a very small HOMO-LUMO gap or low-lying core
         states (heavy elements starting from the 4th row of the
         periodic table) more points might be necessary.
         In principle, the same considerations apply for RPA and GW as
         well, however, the accuracy requirements are somewhat higher
         and 12 point are the default for RPA. In a GW calculation,
         the number of points is adjusted according to the numerical
         quality. Using less than 9 points is strongly discouraged
         except for the simplest molecules.                      In
         ADF2019, it can happen that the algorithm determining the
         imaginary time grid does not converge. In this case, the
         usual reason is that the number of points is too small and
         more points need to be specified. Starting from AMS2020, this
         does not happen any more. In case the imaginary time grid
         does not converge, the number of points is automatically
         adjusted until it does.                      The computation
         time of AO-PARI-MP2, RPA, and GW scales linearly with the
         number of imaginary time points.

   "nFrequency"
      Type:
         Integer

      Default value:
         12

      GUI name:
         N freq points

      Description:
         Number of imaginary frequency points. This key is only
         relevant for RPA and GW and will be ignored if used in an AO-
         PARI-MP2 calculation. 12 Points is the default for a RPA
         calculation. It is technically possible to use a different
         number of imaginary frequency points than for imaginary time.
         The maximum number of points which can be requested for
         imaginary frequency integration is 42. Important note: The
         computation time and memory requirements roughly scale
         linearly with the number of imaginary frequency points.
         However, memory can be an issue for RPA and GW when the
         number of imaginary frequency points is high. In case a job
         crashes, it is advised to increase the number of nodes since
         the necessary memory distributes over all nodes.

   "nLambda"
      Type:
         Integer

      Default value:
         1

      GUI name:
         Number of lambda points

      Description:
         Size of coupling constant integration grid for SOSEX variants
         in RPA. Default is 4 points

   "FitSetQuality"
      Type:
         Multiple Choice

      Default value:
         Auto

      Options:
         [Auto, VeryBasic, Basic, Normal, Good, VeryGood]

      Description:
         Specifies the fit set to be used in the MBPT calculation.
         'Normal' quality is generally sufficient for basis sets up to
         and including TZ2P.                      For larger basis
         sets (or for benchmarking purposes) a 'VeryGood' fit set is
         recommended. Note that the FitSetQuality heavily influences
         the computational cost of the calculation.
         If not specified or 'Auto', the RIHartreeFock%FitSetQuality
         is used.

   "IntegrationQuality"
      Type:
         Multiple Choice

      Options:
         [VeryBasic, Basic, Normal, Good, VeryGood]

      Description:
         Specifies the integration quality to be used in the MBPT
         calculation. If not specified, the
         RIHartreeFock%IntegrationQuality is used.

   "ThresholdQuality"
      Type:
         Multiple Choice

      Options:
         [VeryBasic, Basic, Normal, Good, VeryGood, Excellent]

      Description:
         Controls the distances between atomic centers for which the
         product of two basis functions is not fitted any more.
         Especially for spatially extended, large systems, 'VERYBASIC'
         and 'BASIC' can lead to large computational savings, but the
         fit is also more approximate. If not specified, the
         RIHartreeFock%ThresholdQuality is used.

   "Dependency"
      Type:
         Bool

      Default value:
         Yes

      Description:
         If true, to improve numerical stability, almost linearly-
         dependent combination of basis functions are removed from the
         Green's function that are used in the MBPT equations.
         Disabling this key is strongly discouraged. Its value can
         however be changed. The key to adjust this value is
         RiHartreeFock%DependencyThreshold

   "UseScaledZORA"
      Type:
         Bool

      Default value:
         Yes

      Description:
         If true, use the scaled ZORA orbital energies instead of the
         ZORA orbital energies in the MBPT equations.

   "SigmaFunctionalParametrization"
      Type:
         Multiple Choice

      Default value:
         S1re

      Options:
         [W1, W2, S1, S2, S1re]

      Description:
         Only relevant if a sigma-functional calculation is performed.
         Possible choices for the parametrization of the sigma-
         functional. Not all options are supported for all
         functionals.

[1] A. Förster, M. Franchini, E. van Lenthe, L. Visscher, *A Quadratic
    Pair Atomic Resolution of the Identity Based SOS-AO-MP2 Algorithm
    Using Slater Type Orbitals*, Journal of Chemical Theory and
    Computation 16 875-891 (2020)

[2] A. Förster, L. Visscher, *Double hybrid DFT calculations with
    Slater type orbitals*, Journal of Computational Chemistry 41
    1660-1684 (2020)

[3] A. Förster, L. Visscher, *Low-order scaling |G0W0| by pair atomic
    density fitting*, Journal of Chemical Theory and Computation 16
    (12), 7381 (2020)
