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.

BAND implements RPA, GW, and SOS-MP2 (spin-opposite-scaled) using an
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 system larger than 1000-1500 basis functions. At the moment
BAND 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 icw scalar
relativistic effects within the "ZORA", "X2C", or "RA-X2C" formalism.
In BAND2022 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, BAND 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, RPA and GW. 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 than 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:

**Dependency**

In BAND a similar method is implemented as in the RIHARTREEFOCK scheme
to improve stability of the results with the subkey DEPENDENCY of the
key MBPT:

   MBPT
      Dependency Yes/No
   End

"MBPT"
   "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

In addition one may remove linear dependencies in the basis set, by
using the "Dependency" key. The following is recommended

   Dependency
      AllowBasisDependency True
      Basis 1e-4
   End

in case a large auxiliary fit set is used

Starting from AMS2022 BAND 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.

**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.

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

   MBPT
      nTime 32
      nFrequency 32
   END

In case of SOS-MP2, "nFrequency" is ignored. The numerical quality
automatically sets the number of grid points for imaginary time and
frequency integration in case of a GW or RPA calculation:

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

For a MP2 or double hybrid calculation, see default is always 9
points, independently of the numerical quality. Note, that the
requirements for this parameter are in general lower than for a GW or
RPA calculation. Starting from AMS2022, the number of points is
automatically adjusted in SOS-MP2 as well.

**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 band.rkf file in the "GW" section under
the names "nTime" and "nFrequency".

**Changing the defaults** can be necessary in case your system
contains 4th row elements or heavier and/or your basis set is very
large and/or your system has a very small HOMO-LUMO gap. For a GW
calculation, 24 points should be sufficient for 5th row elements. 32
points might be required for 6th row elements. The maximum number of
points which can be used is 42. For a MP2 calculation, 16 points will
usually be sufficient if your systems contains 4th row elements, and
20 points will usually suffice in case of 5th row elements. Note, that
also a very small HOMO-LUMO.

   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)
