1#!/usr/bin/env python
2#
3# Author: Oliver J. Backhouse <olbackhouse@gmail.com>
4#         George H. Booth <george.booth@kcl.ac.uk>
5#
6
7'''
8An example of higher moment self-consistency in renormalization of self-energy in AGF2.
9
10Note that only the default AGF2 is efficiently implemented (corresponding to AGF2(1,0) in
11the literature, and equivalent to AGF2(None,0)). Higher moments do not support density-fitting
12or parallelism.
13
14Default AGF2 corresponds to the AGF2(1,0) method outlined in the papers:
15  - O. J. Backhouse, M. Nusspickel and G. H. Booth, J. Chem. Theory Comput., 16, 1090 (2020).
16  - O. J. Backhouse and G. H. Booth, J. Chem. Theory Comput., 16, 6294 (2020).
17'''
18
19from __future__ import print_function
20from pyscf import gto, scf, agf2, mp
21
22mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='6-31g')
23
24mf = scf.RHF(mol)
25mf.conv_tol = 1e-12
26mf.run()
27
28# Get the canonical MP2
29mp2 = mp.MP2(mf)
30mp2.run()
31
32# We can use very high moment calculations to converge to traditional GF2 limit.
33# We can also use the zeroth iteration to quantify the AGF2 error by comparison
34# to the MP2 energy.
35gf2_56 = agf2.AGF2(mf, nmom=(5,6))
36gf2_56.build_se()
37e_mp2 = gf2_56.energy_mp2()
38
39print('Canonical MP2 Ecorr: ', mp2.e_corr)
40print('AGF2(%s,%s) MP2 Ecorr: '%gf2_56.nmom, e_mp2)
41print('Error: ', abs(mp2.e_corr - e_mp2))
42
43# Run a high moment AGF2(5,6) calculation and compare to AGF2 (AGF2 as
44# default in pyscf is technically AGF2(None,0)). See
45# second reference for more details.
46gf2_56.run()
47
48gf2 = agf2.AGF2(mf)
49gf2.run()
50
51print('E(corr):')
52print('AGF2(%s,%s): '%gf2_56.nmom, gf2_56.e_corr)
53print('AGF2(1,0): ', gf2.e_corr)
54
55print('IP:')
56print('AGF2(%s,%s): '%gf2_56.nmom, gf2_56.ipagf2(nroots=1)[0])
57print('AGF2(1,0): ', gf2.ipagf2(nroots=1)[0])
58