From b09cff2ff77e10cd351e5fdbdb80a4bab9c46ef0 Mon Sep 17 00:00:00 2001
From: Pierre-Francois Loos <pierrefrancois.loos@gmail.com>
Date: Wed, 12 Feb 2020 12:25:24 +0100
Subject: [PATCH] QP solutions

---
 examples/basis.BF.cc-pvqz  |  98 +++++++++++++++++++++++
 examples/basis.Be.cc-pvdz  |  30 +++++++
 examples/basis.CO.cc-pvqz  |  98 +++++++++++++++++++++++
 examples/basis.F2.cc-pvqz  |  98 +++++++++++++++++++++++
 examples/basis.H2.cc-pvqz  |  46 +++++++++++
 examples/basis.HCl.cc-pvqz | 108 +++++++++++++++++++++++++
 examples/basis.He.cc-pvdz  |   9 +++
 examples/basis.LiF.cc-pvqz |  98 +++++++++++++++++++++++
 examples/basis.LiH.cc-pvqz |  72 +++++++++++++++++
 examples/basis.N2.cc-pvqz  |  98 +++++++++++++++++++++++
 examples/molecule.BF       |   2 +-
 examples/molecule.CO       |   2 +-
 examples/molecule.F2       |   2 +-
 examples/molecule.HCl      |   2 +-
 examples/molecule.LiF      |   2 +-
 examples/molecule.LiH      |   2 +-
 examples/molecule.N2       |   2 +-
 input/basis                |  98 ++++-------------------
 input/methods              |   4 +-
 input/molecule             |   4 +-
 input/molecule.xyz         |   2 +-
 input/options              |   4 +-
 input/weight               |  98 ++++-------------------
 scan_LiF.sh                |   6 +-
 scan_LiH.sh                |   4 +-
 scan_N2.sh                 |   4 +-
 src/QuAcK/G0W0.f90         |   6 +-
 src/QuAcK/QP_roots.f90     | 156 +++++++++++++++++++++++++++++++++++++
 src/QuAcK/RPA.f90          |  44 +++++------
 src/QuAcK/SigmaC.f90       |  58 ++++++++++++++
 src/QuAcK/dSigmaC.f90      |  58 ++++++++++++++
 31 files changed, 1103 insertions(+), 212 deletions(-)
 create mode 100644 examples/basis.BF.cc-pvqz
 create mode 100644 examples/basis.Be.cc-pvdz
 create mode 100644 examples/basis.CO.cc-pvqz
 create mode 100644 examples/basis.F2.cc-pvqz
 create mode 100644 examples/basis.H2.cc-pvqz
 create mode 100644 examples/basis.HCl.cc-pvqz
 create mode 100644 examples/basis.He.cc-pvdz
 create mode 100644 examples/basis.LiF.cc-pvqz
 create mode 100644 examples/basis.LiH.cc-pvqz
 create mode 100644 examples/basis.N2.cc-pvqz
 create mode 100644 src/QuAcK/QP_roots.f90
 create mode 100644 src/QuAcK/SigmaC.f90
 create mode 100644 src/QuAcK/dSigmaC.f90

diff --git a/examples/basis.BF.cc-pvqz b/examples/basis.BF.cc-pvqz
new file mode 100644
index 0000000..3bde203
--- /dev/null
+++ b/examples/basis.BF.cc-pvqz
@@ -0,0 +1,98 @@
+1   15
+S   9
+  1  23870.0000000              0.0000880        
+  2   3575.0000000              0.0006870        
+  3    812.8000000              0.0036000        
+  4    229.7000000              0.0149490        
+  5     74.6900000              0.0514350        
+  6     26.8100000              0.1433020        
+  7     10.3200000              0.3009350        
+  8      4.1780000              0.4035260        
+  9      1.7270000              0.2253400        
+S   9
+  1  23870.0000000             -0.0000180        
+  2   3575.0000000             -0.0001390        
+  3    812.8000000             -0.0007250        
+  4    229.7000000             -0.0030630        
+  5     74.6900000             -0.0105810        
+  6     26.8100000             -0.0313650        
+  7     10.3200000             -0.0710120        
+  8      4.1780000             -0.1321030        
+  9      1.7270000             -0.1230720        
+S   1
+  1      0.4704000              1.0000000        
+S   1
+  1      0.1896000              1.0000000        
+S   1
+  1      0.0739400              1.0000000        
+P   3
+  1     22.2600000              0.0050950        
+  2      5.0580000              0.0332060        
+  3      1.4870000              0.1323140        
+P   1
+  1      0.5071000              1.0000000        
+P   1
+  1      0.1812000              1.0000000        
+P   1
+  1      0.0646300              1.0000000        
+D   1
+  1      1.1100000              1.0000000        
+D   1
+  1      0.4020000              1.0000000        
+D   1
+  1      0.1450000              1.0000000        
+F   1
+  1      0.8820000              1.0000000        
+F   1
+  1      0.3110000              1.0000000        
+G   1
+  1      0.6730000              1.0000000
+2   15
+S   9
+  1  74530.0000000              0.0000950        
+  2  11170.0000000              0.0007380        
+  3   2543.0000000              0.0038580        
+  4    721.0000000              0.0159260        
+  5    235.9000000              0.0542890        
+  6     85.6000000              0.1495130        
+  7     33.5500000              0.3082520        
+  8     13.9300000              0.3948530        
+  9      5.9150000              0.2110310        
+S   9
+  1  74530.0000000             -0.0000220        
+  2  11170.0000000             -0.0001720        
+  3   2543.0000000             -0.0008910        
+  4    721.0000000             -0.0037480        
+  5    235.9000000             -0.0128620        
+  6     85.6000000             -0.0380610        
+  7     33.5500000             -0.0862390        
+  8     13.9300000             -0.1558650        
+  9      5.9150000             -0.1109140        
+S   1
+  1      1.8430000              1.0000000        
+S   1
+  1      0.7124000              1.0000000        
+S   1
+  1      0.2637000              1.0000000        
+P   3
+  1     80.3900000              0.0063470        
+  2     18.6300000              0.0442040        
+  3      5.6940000              0.1685140        
+P   1
+  1      1.9530000              1.0000000        
+P   1
+  1      0.6702000              1.0000000        
+P   1
+  1      0.2166000              1.0000000        
+D   1
+  1      5.0140000              1.0000000        
+D   1
+  1      1.7250000              1.0000000        
+D   1
+  1      0.5860000              1.0000000        
+F   1
+  1      3.5620000              1.0000000        
+F   1
+  1      1.1480000              1.0000000        
+G   1
+  1      2.3760000              1.0000000
diff --git a/examples/basis.Be.cc-pvdz b/examples/basis.Be.cc-pvdz
new file mode 100644
index 0000000..1ea2746
--- /dev/null
+++ b/examples/basis.Be.cc-pvdz
@@ -0,0 +1,30 @@
+1   6
+S   8
+  1   2940.0000000              0.0006800        
+  2    441.2000000              0.0052360        
+  3    100.5000000              0.0266060        
+  4     28.4300000              0.0999930        
+  5      9.1690000              0.2697020        
+  6      3.1960000              0.4514690        
+  7      1.1590000              0.2950740        
+  8      0.1811000              0.0125870        
+S   8
+  1   2940.0000000             -0.0001230        
+  2    441.2000000             -0.0009660        
+  3    100.5000000             -0.0048310        
+  4     28.4300000             -0.0193140        
+  5      9.1690000             -0.0532800        
+  6      3.1960000             -0.1207230        
+  7      1.1590000             -0.1334350        
+  8      0.1811000              0.5307670        
+S   1
+  1      0.0589000              1.0000000        
+P   3
+  1      3.6190000              0.0291110        
+  2      0.7110000              0.1693650        
+  3      0.1951000              0.5134580        
+P   1
+  1      0.0601800              1.0000000        
+D   1
+  1      0.2380000              1.0000000
+
diff --git a/examples/basis.CO.cc-pvqz b/examples/basis.CO.cc-pvqz
new file mode 100644
index 0000000..894420f
--- /dev/null
+++ b/examples/basis.CO.cc-pvqz
@@ -0,0 +1,98 @@
+1  15
+S   9
+  1  33980.0000000              0.0000910        
+  2   5089.0000000              0.0007040        
+  3   1157.0000000              0.0036930        
+  4    326.6000000              0.0153600        
+  5    106.1000000              0.0529290        
+  6     38.1100000              0.1470430        
+  7     14.7500000              0.3056310        
+  8      6.0350000              0.3993450        
+  9      2.5300000              0.2170510        
+S   9
+  1  33980.0000000             -0.0000190        
+  2   5089.0000000             -0.0001510        
+  3   1157.0000000             -0.0007850        
+  4    326.6000000             -0.0033240        
+  5    106.1000000             -0.0115120        
+  6     38.1100000             -0.0341600        
+  7     14.7500000             -0.0771730        
+  8      6.0350000             -0.1414930        
+  9      2.5300000             -0.1180190        
+S   1
+  1      0.7355000              1.0000000        
+S   1
+  1      0.2905000              1.0000000        
+S   1
+  1      0.1111000              1.0000000        
+P   3
+  1     34.5100000              0.0053780        
+  2      7.9150000              0.0361320        
+  3      2.3680000              0.1424930        
+P   1
+  1      0.8132000              1.0000000        
+P   1
+  1      0.2890000              1.0000000        
+P   1
+  1      0.1007000              1.0000000        
+D   1
+  1      1.8480000              1.0000000        
+D   1
+  1      0.6490000              1.0000000        
+D   1
+  1      0.2280000              1.0000000        
+F   1
+  1      1.4190000              1.0000000        
+F   1
+  1      0.4850000              1.0000000        
+G   1
+  1      1.0110000              1.0000000
+2  15
+S   9
+  1  61420.0000000              0.0000900        
+  2   9199.0000000              0.0006980        
+  3   2091.0000000              0.0036640        
+  4    590.9000000              0.0152180        
+  5    192.3000000              0.0524230        
+  6     69.3200000              0.1459210        
+  7     26.9700000              0.3052580        
+  8     11.1000000              0.3985080        
+  9      4.6820000              0.2169800        
+S   9
+  1  61420.0000000             -0.0000200        
+  2   9199.0000000             -0.0001590        
+  3   2091.0000000             -0.0008290        
+  4    590.9000000             -0.0035080        
+  5    192.3000000             -0.0121560        
+  6     69.3200000             -0.0362610        
+  7     26.9700000             -0.0829920        
+  8     11.1000000             -0.1520900        
+  9      4.6820000             -0.1153310        
+S   1
+  1      1.4280000              1.0000000        
+S   1
+  1      0.5547000              1.0000000        
+S   1
+  1      0.2067000              1.0000000        
+P   3
+  1     63.4200000              0.0060440        
+  2     14.6600000              0.0417990        
+  3      4.4590000              0.1611430        
+P   1
+  1      1.5310000              1.0000000        
+P   1
+  1      0.5302000              1.0000000        
+P   1
+  1      0.1750000              1.0000000        
+D   1
+  1      3.7750000              1.0000000        
+D   1
+  1      1.3000000              1.0000000        
+D   1
+  1      0.4440000              1.0000000        
+F   1
+  1      2.6660000              1.0000000        
+F   1
+  1      0.8590000              1.0000000        
+G   1
+  1      1.8460000              1.0000000
diff --git a/examples/basis.F2.cc-pvqz b/examples/basis.F2.cc-pvqz
new file mode 100644
index 0000000..687cb59
--- /dev/null
+++ b/examples/basis.F2.cc-pvqz
@@ -0,0 +1,98 @@
+1   15
+S   9
+  1  74530.0000000              0.0000950        
+  2  11170.0000000              0.0007380        
+  3   2543.0000000              0.0038580        
+  4    721.0000000              0.0159260        
+  5    235.9000000              0.0542890        
+  6     85.6000000              0.1495130        
+  7     33.5500000              0.3082520        
+  8     13.9300000              0.3948530        
+  9      5.9150000              0.2110310        
+S   9
+  1  74530.0000000             -0.0000220        
+  2  11170.0000000             -0.0001720        
+  3   2543.0000000             -0.0008910        
+  4    721.0000000             -0.0037480        
+  5    235.9000000             -0.0128620        
+  6     85.6000000             -0.0380610        
+  7     33.5500000             -0.0862390        
+  8     13.9300000             -0.1558650        
+  9      5.9150000             -0.1109140        
+S   1
+  1      1.8430000              1.0000000        
+S   1
+  1      0.7124000              1.0000000        
+S   1
+  1      0.2637000              1.0000000        
+P   3
+  1     80.3900000              0.0063470        
+  2     18.6300000              0.0442040        
+  3      5.6940000              0.1685140        
+P   1
+  1      1.9530000              1.0000000        
+P   1
+  1      0.6702000              1.0000000        
+P   1
+  1      0.2166000              1.0000000        
+D   1
+  1      5.0140000              1.0000000        
+D   1
+  1      1.7250000              1.0000000        
+D   1
+  1      0.5860000              1.0000000        
+F   1
+  1      3.5620000              1.0000000        
+F   1
+  1      1.1480000              1.0000000        
+G   1
+  1      2.3760000              1.0000000
+1   15
+S   9
+  1  74530.0000000              0.0000950        
+  2  11170.0000000              0.0007380        
+  3   2543.0000000              0.0038580        
+  4    721.0000000              0.0159260        
+  5    235.9000000              0.0542890        
+  6     85.6000000              0.1495130        
+  7     33.5500000              0.3082520        
+  8     13.9300000              0.3948530        
+  9      5.9150000              0.2110310        
+S   9
+  1  74530.0000000             -0.0000220        
+  2  11170.0000000             -0.0001720        
+  3   2543.0000000             -0.0008910        
+  4    721.0000000             -0.0037480        
+  5    235.9000000             -0.0128620        
+  6     85.6000000             -0.0380610        
+  7     33.5500000             -0.0862390        
+  8     13.9300000             -0.1558650        
+  9      5.9150000             -0.1109140        
+S   1
+  1      1.8430000              1.0000000        
+S   1
+  1      0.7124000              1.0000000        
+S   1
+  1      0.2637000              1.0000000        
+P   3
+  1     80.3900000              0.0063470        
+  2     18.6300000              0.0442040        
+  3      5.6940000              0.1685140        
+P   1
+  1      1.9530000              1.0000000        
+P   1
+  1      0.6702000              1.0000000        
+P   1
+  1      0.2166000              1.0000000        
+D   1
+  1      5.0140000              1.0000000        
+D   1
+  1      1.7250000              1.0000000        
+D   1
+  1      0.5860000              1.0000000        
+F   1
+  1      3.5620000              1.0000000        
+F   1
+  1      1.1480000              1.0000000        
+G   1
+  1      2.3760000              1.0000000
diff --git a/examples/basis.H2.cc-pvqz b/examples/basis.H2.cc-pvqz
new file mode 100644
index 0000000..4b80620
--- /dev/null
+++ b/examples/basis.H2.cc-pvqz
@@ -0,0 +1,46 @@
+1   10
+S   3
+  1     82.6400000              0.0020060        
+  2     12.4100000              0.0153430        
+  3      2.8240000              0.0755790        
+S   1
+  1      0.7977000              1.0000000        
+S   1
+  1      0.2581000              1.0000000        
+S   1
+  1      0.0898900              1.0000000        
+P   1
+  1      2.2920000              1.0000000        
+P   1
+  1      0.8380000              1.0000000        
+P   1
+  1      0.2920000              1.0000000        
+D   1
+  1      2.0620000              1.0000000        
+D   1
+  1      0.6620000              1.0000000        
+F   1
+  1      1.3970000              1.0000000
+2   10
+S   3
+  1     82.6400000              0.0020060        
+  2     12.4100000              0.0153430        
+  3      2.8240000              0.0755790        
+S   1
+  1      0.7977000              1.0000000        
+S   1
+  1      0.2581000              1.0000000        
+S   1
+  1      0.0898900              1.0000000        
+P   1
+  1      2.2920000              1.0000000        
+P   1
+  1      0.8380000              1.0000000        
+P   1
+  1      0.2920000              1.0000000        
+D   1
+  1      2.0620000              1.0000000        
+D   1
+  1      0.6620000              1.0000000        
+F   1
+  1      1.3970000              1.0000000
diff --git a/examples/basis.HCl.cc-pvqz b/examples/basis.HCl.cc-pvqz
new file mode 100644
index 0000000..f171887
--- /dev/null
+++ b/examples/basis.HCl.cc-pvqz
@@ -0,0 +1,108 @@
+1   10
+S   3
+  1     82.6400000              0.0020060        
+  2     12.4100000              0.0153430        
+  3      2.8240000              0.0755790        
+S   1
+  1      0.7977000              1.0000000        
+S   1
+  1      0.2581000              1.0000000        
+S   1
+  1      0.0898900              1.0000000        
+P   1
+  1      2.2920000              1.0000000        
+P   1
+  1      0.8380000              1.0000000        
+P   1
+  1      0.2920000              1.0000000        
+D   1
+  1      2.0620000              1.0000000        
+D   1
+  1      0.6620000              1.0000000        
+F   1
+  1      1.3970000              1.0000000
+2   17
+S   13
+  1 834900.0000000              0.231688E-04     
+  2 125000.0000000              0.180154E-03     
+  3  28430.0000000              0.947782E-03     
+  4   8033.0000000              0.400139E-02     
+  5   2608.0000000              0.144629E-01     
+  6    933.9000000              0.456586E-01     
+  7    360.0000000              0.123248E+00     
+  8    147.0000000              0.264369E+00     
+  9     62.8800000              0.382989E+00     
+ 10     27.6000000              0.270934E+00     
+ 11     11.0800000              0.471404E-01     
+ 12      5.0750000             -0.371766E-02     
+ 13      2.2780000              0.219158E-02     
+S   13
+  1 834900.0000000             -0.649649E-05     
+  2 125000.0000000             -0.504895E-04     
+  3  28430.0000000             -0.266113E-03     
+  4   8033.0000000             -0.112499E-02     
+  5   2608.0000000             -0.410497E-02     
+  6    933.9000000             -0.131987E-01     
+  7    360.0000000             -0.375342E-01     
+  8    147.0000000             -0.897233E-01     
+  9     62.8800000             -0.167671E+00     
+ 10     27.6000000             -0.174763E+00     
+ 11     11.0800000              0.114909E+00     
+ 12      5.0750000              0.563618E+00     
+ 13      2.2780000              0.441606E+00     
+S   13
+  1 834900.0000000              0.196645E-05     
+  2 125000.0000000              0.152620E-04     
+  3  28430.0000000              0.806086E-04     
+  4   8033.0000000              0.339960E-03     
+  5   2608.0000000              0.124551E-02     
+  6    933.9000000              0.399612E-02     
+  7    360.0000000              0.114751E-01     
+  8    147.0000000              0.275504E-01     
+  9     62.8800000              0.532917E-01     
+ 10     27.6000000              0.571246E-01     
+ 11     11.0800000             -0.395201E-01     
+ 12      5.0750000             -0.264343E+00     
+ 13      2.2780000             -0.349291E+00     
+S   1
+  1      0.7775000              1.0000000        
+S   1
+  1      0.3527000              1.0000000        
+S   1
+  1      0.1431000              1.0000000        
+P   8
+  1   1703.0000000              0.474039E-03     
+  2    403.6000000              0.406412E-02     
+  3    130.3000000              0.213355E-01     
+  4     49.0500000              0.794611E-01     
+  5     20.2600000              0.208927E+00     
+  6      8.7870000              0.364945E+00     
+  7      3.9190000              0.371725E+00     
+  8      1.7650000              0.146292E+00     
+P   8
+  1   1703.0000000             -0.128266E-03     
+  2    403.6000000             -0.109356E-02     
+  3    130.3000000             -0.583429E-02     
+  4     49.0500000             -0.219258E-01     
+  5     20.2600000             -0.601385E-01     
+  6      8.7870000             -0.106929E+00     
+  7      3.9190000             -0.122454E+00     
+  8      1.7650000              0.383619E-01     
+P   1
+  1      0.7207000              1.0000000        
+P   1
+  1      0.2839000              1.0000000        
+P   1
+  1      0.1060000              1.0000000        
+D   1
+  1      0.2540000              1.0000000        
+D   1
+  1      0.6280000              1.0000000        
+D   1
+  1      1.5510000              1.0000000        
+F   1
+  1      0.4230000              1.0000000        
+F   1
+  1      1.0890000              1.0000000        
+G   1
+  1      0.8270000              1.0000000
diff --git a/examples/basis.He.cc-pvdz b/examples/basis.He.cc-pvdz
new file mode 100644
index 0000000..6796e3b
--- /dev/null
+++ b/examples/basis.He.cc-pvdz
@@ -0,0 +1,9 @@
+1   3
+S   3
+  1     38.3600000              0.0238090        
+  2      5.7700000              0.1548910        
+  3      1.2400000              0.4699870        
+S   1
+  1      0.2976000              1.0000000        
+P   1
+  1      1.2750000              1.0000000
diff --git a/examples/basis.LiF.cc-pvqz b/examples/basis.LiF.cc-pvqz
new file mode 100644
index 0000000..76e69dd
--- /dev/null
+++ b/examples/basis.LiF.cc-pvqz
@@ -0,0 +1,98 @@
+1  15
+S   9
+  1   6601.0000000              0.0001170        
+  2    989.7000000              0.0009110        
+  3    225.7000000              0.0047280        
+  4     64.2900000              0.0191970        
+  5     21.1800000              0.0630470        
+  6      7.7240000              0.1632080        
+  7      3.0030000              0.3148270        
+  8      1.2120000              0.3939360        
+  9      0.4930000              0.1969180        
+S   9
+  1   6601.0000000             -0.0000180        
+  2    989.7000000             -0.0001420        
+  3    225.7000000             -0.0007410        
+  4     64.2900000             -0.0030200        
+  5     21.1800000             -0.0101230        
+  6      7.7240000             -0.0270940        
+  7      3.0030000             -0.0573590        
+  8      1.2120000             -0.0938950        
+  9      0.4930000             -0.1210910        
+S   1
+  1      0.0951500              1.0000000        
+S   1
+  1      0.0479100              1.0000000        
+S   1
+  1      0.0222000              1.0000000        
+P   3
+  1      6.2500000              0.0033880        
+  2      1.3700000              0.0193160        
+  3      0.3672000              0.0791040        
+P   1
+  1      0.1192000              1.0000000        
+P   1
+  1      0.0447400              1.0000000        
+P   1
+  1      0.0179500              1.0000000        
+D   1
+  1      0.3440000              1.0000000        
+D   1
+  1      0.1530000              1.0000000        
+D   1
+  1      0.0680000              1.0000000        
+F   1
+  1      0.2460000              1.0000000        
+F   1
+  1      0.1292000              1.0000000        
+G   1
+  1      0.2380000              1.0000000
+2  15
+S   9
+  1  74530.0000000              0.0000950        
+  2  11170.0000000              0.0007380        
+  3   2543.0000000              0.0038580        
+  4    721.0000000              0.0159260        
+  5    235.9000000              0.0542890        
+  6     85.6000000              0.1495130        
+  7     33.5500000              0.3082520        
+  8     13.9300000              0.3948530        
+  9      5.9150000              0.2110310        
+S   9
+  1  74530.0000000             -0.0000220        
+  2  11170.0000000             -0.0001720        
+  3   2543.0000000             -0.0008910        
+  4    721.0000000             -0.0037480        
+  5    235.9000000             -0.0128620        
+  6     85.6000000             -0.0380610        
+  7     33.5500000             -0.0862390        
+  8     13.9300000             -0.1558650        
+  9      5.9150000             -0.1109140        
+S   1
+  1      1.8430000              1.0000000        
+S   1
+  1      0.7124000              1.0000000        
+S   1
+  1      0.2637000              1.0000000        
+P   3
+  1     80.3900000              0.0063470        
+  2     18.6300000              0.0442040        
+  3      5.6940000              0.1685140        
+P   1
+  1      1.9530000              1.0000000        
+P   1
+  1      0.6702000              1.0000000        
+P   1
+  1      0.2166000              1.0000000        
+D   1
+  1      5.0140000              1.0000000        
+D   1
+  1      1.7250000              1.0000000        
+D   1
+  1      0.5860000              1.0000000        
+F   1
+  1      3.5620000              1.0000000        
+F   1
+  1      1.1480000              1.0000000        
+G   1
+  1      2.3760000              1.0000000
diff --git a/examples/basis.LiH.cc-pvqz b/examples/basis.LiH.cc-pvqz
new file mode 100644
index 0000000..339fa33
--- /dev/null
+++ b/examples/basis.LiH.cc-pvqz
@@ -0,0 +1,72 @@
+1  15
+S   9
+  1   6601.0000000              0.0001170        
+  2    989.7000000              0.0009110        
+  3    225.7000000              0.0047280        
+  4     64.2900000              0.0191970        
+  5     21.1800000              0.0630470        
+  6      7.7240000              0.1632080        
+  7      3.0030000              0.3148270        
+  8      1.2120000              0.3939360        
+  9      0.4930000              0.1969180        
+S   9
+  1   6601.0000000             -0.0000180        
+  2    989.7000000             -0.0001420        
+  3    225.7000000             -0.0007410        
+  4     64.2900000             -0.0030200        
+  5     21.1800000             -0.0101230        
+  6      7.7240000             -0.0270940        
+  7      3.0030000             -0.0573590        
+  8      1.2120000             -0.0938950        
+  9      0.4930000             -0.1210910        
+S   1
+  1      0.0951500              1.0000000        
+S   1
+  1      0.0479100              1.0000000        
+S   1
+  1      0.0222000              1.0000000        
+P   3
+  1      6.2500000              0.0033880        
+  2      1.3700000              0.0193160        
+  3      0.3672000              0.0791040        
+P   1
+  1      0.1192000              1.0000000        
+P   1
+  1      0.0447400              1.0000000        
+P   1
+  1      0.0179500              1.0000000        
+D   1
+  1      0.3440000              1.0000000        
+D   1
+  1      0.1530000              1.0000000        
+D   1
+  1      0.0680000              1.0000000        
+F   1
+  1      0.2460000              1.0000000        
+F   1
+  1      0.1292000              1.0000000        
+G   1
+  1      0.2380000              1.0000000
+2  10
+S   3
+  1     82.6400000              0.0020060        
+  2     12.4100000              0.0153430        
+  3      2.8240000              0.0755790        
+S   1
+  1      0.7977000              1.0000000        
+S   1
+  1      0.2581000              1.0000000        
+S   1
+  1      0.0898900              1.0000000        
+P   1
+  1      2.2920000              1.0000000        
+P   1
+  1      0.8380000              1.0000000        
+P   1
+  1      0.2920000              1.0000000        
+D   1
+  1      2.0620000              1.0000000        
+D   1
+  1      0.6620000              1.0000000        
+F   1
+  1      1.3970000              1.0000000
diff --git a/examples/basis.N2.cc-pvqz b/examples/basis.N2.cc-pvqz
new file mode 100644
index 0000000..d1c44f8
--- /dev/null
+++ b/examples/basis.N2.cc-pvqz
@@ -0,0 +1,98 @@
+1  15
+S   9
+  1  45840.0000000              0.0000920        
+  2   6868.0000000              0.0007170        
+  3   1563.0000000              0.0037490        
+  4    442.4000000              0.0155320        
+  5    144.3000000              0.0531460        
+  6     52.1800000              0.1467870        
+  7     20.3400000              0.3046630        
+  8      8.3810000              0.3976840        
+  9      3.5290000              0.2176410        
+S   9
+  1  45840.0000000             -0.0000200        
+  2   6868.0000000             -0.0001590        
+  3   1563.0000000             -0.0008240        
+  4    442.4000000             -0.0034780        
+  5    144.3000000             -0.0119660        
+  6     52.1800000             -0.0353880        
+  7     20.3400000             -0.0800770        
+  8      8.3810000             -0.1467220        
+  9      3.5290000             -0.1163600        
+S   1
+  1      1.0540000              1.0000000        
+S   1
+  1      0.4118000              1.0000000        
+S   1
+  1      0.1552000              1.0000000        
+P   3
+  1     49.3300000              0.0055330        
+  2     11.3700000              0.0379620        
+  3      3.4350000              0.1490280        
+P   1
+  1      1.1820000              1.0000000        
+P   1
+  1      0.4173000              1.0000000        
+P   1
+  1      0.1428000              1.0000000        
+D   1
+  1      2.8370000              1.0000000        
+D   1
+  1      0.9680000              1.0000000        
+D   1
+  1      0.3350000              1.0000000        
+F   1
+  1      2.0270000              1.0000000        
+F   1
+  1      0.6850000              1.0000000        
+G   1
+  1      1.4270000              1.0000000
+2  15
+S   9
+  1  45840.0000000              0.0000920        
+  2   6868.0000000              0.0007170        
+  3   1563.0000000              0.0037490        
+  4    442.4000000              0.0155320        
+  5    144.3000000              0.0531460        
+  6     52.1800000              0.1467870        
+  7     20.3400000              0.3046630        
+  8      8.3810000              0.3976840        
+  9      3.5290000              0.2176410        
+S   9
+  1  45840.0000000             -0.0000200        
+  2   6868.0000000             -0.0001590        
+  3   1563.0000000             -0.0008240        
+  4    442.4000000             -0.0034780        
+  5    144.3000000             -0.0119660        
+  6     52.1800000             -0.0353880        
+  7     20.3400000             -0.0800770        
+  8      8.3810000             -0.1467220        
+  9      3.5290000             -0.1163600        
+S   1
+  1      1.0540000              1.0000000        
+S   1
+  1      0.4118000              1.0000000        
+S   1
+  1      0.1552000              1.0000000        
+P   3
+  1     49.3300000              0.0055330        
+  2     11.3700000              0.0379620        
+  3      3.4350000              0.1490280        
+P   1
+  1      1.1820000              1.0000000        
+P   1
+  1      0.4173000              1.0000000        
+P   1
+  1      0.1428000              1.0000000        
+D   1
+  1      2.8370000              1.0000000        
+D   1
+  1      0.9680000              1.0000000        
+D   1
+  1      0.3350000              1.0000000        
+F   1
+  1      2.0270000              1.0000000        
+F   1
+  1      0.6850000              1.0000000        
+G   1
+  1      1.4270000              1.0000000
diff --git a/examples/molecule.BF b/examples/molecule.BF
index ee103e6..0955a4d 100644
--- a/examples/molecule.BF
+++ b/examples/molecule.BF
@@ -2,4 +2,4 @@
  2   7     7   0     0
 # Znuc   x            y           z
   B     0.           0.         0.
-  F     0.           0.         2.41
+  F     0.           0.         2.39
diff --git a/examples/molecule.CO b/examples/molecule.CO
index 1d478fc..827311b 100644
--- a/examples/molecule.CO
+++ b/examples/molecule.CO
@@ -2,4 +2,4 @@
  2   7     7   0     0
 # Znuc   x            y           z
   C     0.           0.         0.
-  O     0.           0.         2.154
+  O     0.           0.         2.106
diff --git a/examples/molecule.F2 b/examples/molecule.F2
index 1046aea..af08593 100644
--- a/examples/molecule.F2
+++ b/examples/molecule.F2
@@ -2,4 +2,4 @@
  2   9     9   0     0
 # Znuc   x            y           z
   F     0.           0.         0.
-  F     0.           0.         2.67
+  F     0.           0.         2.64
diff --git a/examples/molecule.HCl b/examples/molecule.HCl
index 88a5912..1d42e01 100644
--- a/examples/molecule.HCl
+++ b/examples/molecule.HCl
@@ -2,4 +2,4 @@
  2   9     9   0     0
 # Znuc   x            y           z
   H     0.           0.         0.
-  Cl    0.           0.         2.41
+  Cl    0.           0.         2.37
diff --git a/examples/molecule.LiF b/examples/molecule.LiF
index e370518..381ba52 100644
--- a/examples/molecule.LiF
+++ b/examples/molecule.LiF
@@ -2,4 +2,4 @@
  2   6     6   0     0
 # Znuc   x            y           z
   Li    0.           0.         0.
-  F     0.           0.         3.003
+  F     0.           0.         2.965
diff --git a/examples/molecule.LiH b/examples/molecule.LiH
index d4f626f..1d6bb3f 100644
--- a/examples/molecule.LiH
+++ b/examples/molecule.LiH
@@ -2,4 +2,4 @@
  2   2     2   0     0
 # Znuc   x            y           z
   Li    0.           0.         0.
-  H     0.           0.         3
+  H     0.           0.         2.994
diff --git a/examples/molecule.N2 b/examples/molecule.N2
index 6e92c28..85fe0df 100644
--- a/examples/molecule.N2
+++ b/examples/molecule.N2
@@ -2,4 +2,4 @@
  2   7     7   0     0
 # Znuc   x            y           z
   N     0.           0.         0.
-  N     0.           0.         2.07
+  N     0.           0.         2.072
diff --git a/input/basis b/input/basis
index bb77ea0..fb05e68 100644
--- a/input/basis
+++ b/input/basis
@@ -1,88 +1,18 @@
-1   6
+1   3
 S   3
-  1     33.8700000              0.0060680        
-  2      5.0950000              0.0453080        
-  3      1.1590000              0.2028220        
+  1     13.0100000              0.0196850        
+  2      1.9620000              0.1379770        
+  3      0.4446000              0.4781480        
 S   1
-  1      0.3258000              1.0000000        
+  1      0.1220000              1.0000000        
+P   1
+  1      0.7270000              1.0000000
+2   3
+S   3
+  1     13.0100000              0.0196850        
+  2      1.9620000              0.1379770        
+  3      0.4446000              0.4781480        
 S   1
-  1      0.1027000              1.0000000        
+  1      0.1220000              1.0000000        
 P   1
-  1      1.4070000              1.0000000        
-P   1
-  1      0.3880000              1.0000000        
-D   1
-  1      1.0570000              1.0000000
-2   12
-S   13
-  1 456100.0000000              0.492970E-04     
-  2  68330.0000000              0.383029E-03     
-  3  15550.0000000              0.200854E-02     
-  4   4405.0000000              0.838558E-02     
-  5   1439.0000000              0.294703E-01     
-  6    520.4000000              0.878325E-01     
-  7    203.1000000              0.211473E+00     
-  8     83.9600000              0.365364E+00     
-  9     36.2000000              0.340884E+00     
- 10     15.8300000              0.102133E+00     
- 11      6.3340000              0.311675E-02     
- 12      2.6940000              0.105751E-02     
- 13      0.4313000              0.156136E-03     
-S   13
-  1 456100.0000000             -0.138304E-04     
-  2  68330.0000000             -0.107279E-03     
-  3  15550.0000000             -0.565083E-03     
-  4   4405.0000000             -0.236135E-02     
-  5   1439.0000000             -0.845886E-02     
-  6    520.4000000             -0.259638E-01     
-  7    203.1000000             -0.686362E-01     
-  8     83.9600000             -0.141874E+00     
-  9     36.2000000             -0.199319E+00     
- 10     15.8300000             -0.195662E-01     
- 11      6.3340000              0.499741E+00     
- 12      2.6940000              0.563736E+00     
- 13      0.4313000             -0.835091E-02     
-S   13
-  1 456100.0000000              0.418546E-05     
-  2  68330.0000000              0.324395E-04     
-  3  15550.0000000              0.171105E-03     
-  4   4405.0000000              0.714176E-03     
-  5   1439.0000000              0.256705E-02     
-  6    520.4000000              0.788552E-02     
-  7    203.1000000              0.210867E-01     
-  8     83.9600000              0.442264E-01     
-  9     36.2000000              0.651670E-01     
- 10     15.8300000              0.603012E-02     
- 11      6.3340000             -0.206495E+00     
- 12      2.6940000             -0.405871E+00     
- 13      0.4313000              0.725661E+00     
-S   1
-  1      0.9768000              1.0000000        
-S   1
-  1      0.1625000              1.0000000        
-P   7
-  1    663.3000000              0.240448E-02     
-  2    156.8000000              0.192148E-01     
-  3     49.9800000              0.885097E-01     
-  4     18.4200000              0.256020E+00     
-  5      7.2400000              0.436927E+00     
-  6      2.9220000              0.350334E+00     
-  7      0.3818000             -0.458423E-02     
-P   7
-  1    663.3000000             -0.652145E-03     
-  2    156.8000000             -0.519445E-02     
-  3     49.9800000             -0.246938E-01     
-  4     18.4200000             -0.728167E-01     
-  5      7.2400000             -0.134030E+00     
-  6      2.9220000             -0.947742E-01     
-  7      0.3818000              0.564667E+00     
-P   1
-  1      1.0220000              1.0000000        
-P   1
-  1      0.1301000              1.0000000        
-D   1
-  1      1.0460000              1.0000000        
-D   1
-  1      0.3440000              1.0000000        
-F   1
-  1      0.7060000              1.0000000
+  1      0.7270000              1.0000000
diff --git a/input/methods b/input/methods
index 5b88684..2aa67c1 100644
--- a/input/methods
+++ b/input/methods
@@ -1,11 +1,11 @@
 # RHF UHF MOM
   T   F   F
 # MP2 MP3 MP2-F12
-  T   F   F
+  F   F   F
 # CCD CCSD CCSD(T) ringCCD ladderCCD
   F   F    F       F       F
 # CIS RPA RPAx ppRPA ADC
-  T   T   T    F     F
+  F   F   F    F     F
 # GF2 GF3
   F   F
 # G0W0 evGW qsGW 
diff --git a/input/molecule b/input/molecule
index 88a5912..81c624a 100644
--- a/input/molecule
+++ b/input/molecule
@@ -1,5 +1,5 @@
 # nAt nEla nElb nCore nRyd
- 2   9     9   0     0
+ 2   1     1   0     0
 # Znuc   x            y           z
   H     0.           0.         0.
-  Cl    0.           0.         2.41
+  H     0.           0.         1.4
diff --git a/input/molecule.xyz b/input/molecule.xyz
index 64d6254..6edc99d 100644
--- a/input/molecule.xyz
+++ b/input/molecule.xyz
@@ -1,4 +1,4 @@
   2
 
  H      0.0000000000    0.0000000000    0.0000000000
- Cl     0.0000000000    0.0000000000    1.2753171701
+ H      0.0000000000    0.0000000000    0.7408481486
diff --git a/input/options b/input/options
index 5a8d22a..c47156a 100644
--- a/input/options
+++ b/input/options
@@ -5,11 +5,11 @@
 # CC: maxSCF thresh   DIIS n_diis
       64     0.0000001  F    1
 # CIS/TDHF/BSE: singlet triplet
-                T       T
+                T       F
 # GF: maxSCF thresh  DIIS n_diis renormalization
       64     0.00001 T    5      3 
 # GW: maxSCF thresh  DIIS n_diis COHSEX SOSEX BSE TDA G0W GW0 lin eta     
-      256    0.00001    T  5     F      F     T   F   F   F   F   0.000   
+      256    0.00001    T  5     F      F     F   F   F   F   F   0.000   
 # ACFDT: AC Kx  XBS
          T  F   T
 # MCMP2: nMC    nEq    nWalk dt  nPrint iSeed doDrift
diff --git a/input/weight b/input/weight
index bb77ea0..fb05e68 100644
--- a/input/weight
+++ b/input/weight
@@ -1,88 +1,18 @@
-1   6
+1   3
 S   3
-  1     33.8700000              0.0060680        
-  2      5.0950000              0.0453080        
-  3      1.1590000              0.2028220        
+  1     13.0100000              0.0196850        
+  2      1.9620000              0.1379770        
+  3      0.4446000              0.4781480        
 S   1
-  1      0.3258000              1.0000000        
+  1      0.1220000              1.0000000        
+P   1
+  1      0.7270000              1.0000000
+2   3
+S   3
+  1     13.0100000              0.0196850        
+  2      1.9620000              0.1379770        
+  3      0.4446000              0.4781480        
 S   1
-  1      0.1027000              1.0000000        
+  1      0.1220000              1.0000000        
 P   1
-  1      1.4070000              1.0000000        
-P   1
-  1      0.3880000              1.0000000        
-D   1
-  1      1.0570000              1.0000000
-2   12
-S   13
-  1 456100.0000000              0.492970E-04     
-  2  68330.0000000              0.383029E-03     
-  3  15550.0000000              0.200854E-02     
-  4   4405.0000000              0.838558E-02     
-  5   1439.0000000              0.294703E-01     
-  6    520.4000000              0.878325E-01     
-  7    203.1000000              0.211473E+00     
-  8     83.9600000              0.365364E+00     
-  9     36.2000000              0.340884E+00     
- 10     15.8300000              0.102133E+00     
- 11      6.3340000              0.311675E-02     
- 12      2.6940000              0.105751E-02     
- 13      0.4313000              0.156136E-03     
-S   13
-  1 456100.0000000             -0.138304E-04     
-  2  68330.0000000             -0.107279E-03     
-  3  15550.0000000             -0.565083E-03     
-  4   4405.0000000             -0.236135E-02     
-  5   1439.0000000             -0.845886E-02     
-  6    520.4000000             -0.259638E-01     
-  7    203.1000000             -0.686362E-01     
-  8     83.9600000             -0.141874E+00     
-  9     36.2000000             -0.199319E+00     
- 10     15.8300000             -0.195662E-01     
- 11      6.3340000              0.499741E+00     
- 12      2.6940000              0.563736E+00     
- 13      0.4313000             -0.835091E-02     
-S   13
-  1 456100.0000000              0.418546E-05     
-  2  68330.0000000              0.324395E-04     
-  3  15550.0000000              0.171105E-03     
-  4   4405.0000000              0.714176E-03     
-  5   1439.0000000              0.256705E-02     
-  6    520.4000000              0.788552E-02     
-  7    203.1000000              0.210867E-01     
-  8     83.9600000              0.442264E-01     
-  9     36.2000000              0.651670E-01     
- 10     15.8300000              0.603012E-02     
- 11      6.3340000             -0.206495E+00     
- 12      2.6940000             -0.405871E+00     
- 13      0.4313000              0.725661E+00     
-S   1
-  1      0.9768000              1.0000000        
-S   1
-  1      0.1625000              1.0000000        
-P   7
-  1    663.3000000              0.240448E-02     
-  2    156.8000000              0.192148E-01     
-  3     49.9800000              0.885097E-01     
-  4     18.4200000              0.256020E+00     
-  5      7.2400000              0.436927E+00     
-  6      2.9220000              0.350334E+00     
-  7      0.3818000             -0.458423E-02     
-P   7
-  1    663.3000000             -0.652145E-03     
-  2    156.8000000             -0.519445E-02     
-  3     49.9800000             -0.246938E-01     
-  4     18.4200000             -0.728167E-01     
-  5      7.2400000             -0.134030E+00     
-  6      2.9220000             -0.947742E-01     
-  7      0.3818000              0.564667E+00     
-P   1
-  1      1.0220000              1.0000000        
-P   1
-  1      0.1301000              1.0000000        
-D   1
-  1      1.0460000              1.0000000        
-D   1
-  1      0.3440000              1.0000000        
-F   1
-  1      0.7060000              1.0000000
+  1      0.7270000              1.0000000
diff --git a/scan_LiF.sh b/scan_LiF.sh
index 13226bc..c3f11d7 100755
--- a/scan_LiF.sh
+++ b/scan_LiF.sh
@@ -1,9 +1,9 @@
 #! /bin/bash
 
 MOL="LiF"
-BASIS="cc-pvtz"
-R_START=3.980
-R_END=2.990
+BASIS="cc-pvqz"
+R_START=2.965
+R_END=2.965
 DR=0.001
 
 for R in $(seq $R_START $DR $R_END)
diff --git a/scan_LiH.sh b/scan_LiH.sh
index 4eed6e1..5061aae 100755
--- a/scan_LiH.sh
+++ b/scan_LiH.sh
@@ -2,8 +2,8 @@
 
 MOL="LiH"
 BASIS="cc-pvqz"
-R_START=2.990
-R_END=3.000
+R_START=3.013
+R_END=3.013
 DR=0.001
 
 for R in $(seq $R_START $DR $R_END)
diff --git a/scan_N2.sh b/scan_N2.sh
index c62b21e..05e6af6 100755
--- a/scan_N2.sh
+++ b/scan_N2.sh
@@ -1,8 +1,8 @@
 #! /bin/bash
 
 MOL="N2"
-BASIS="cc-pvtz"
-R_START=2.066
+BASIS="cc-pvqz"
+R_START=2.071
 R_END=2.080
 DR=0.001
 
diff --git a/src/QuAcK/G0W0.f90 b/src/QuAcK/G0W0.f90
index 67a517d..cd20734 100644
--- a/src/QuAcK/G0W0.f90
+++ b/src/QuAcK/G0W0.f90
@@ -95,10 +95,14 @@ subroutine G0W0(doACFDT,exchange_kernel,doXBS,COHSEX,SOSEX,BSE,TDA,singlet_manif
   call renormalization_factor(COHSEX,SOSEX,eta,nBas,nC,nO,nV,nR,nS,eHF, & 
                               Omega(:,ispin),rho(:,:,:,ispin),rhox(:,:,:,ispin),Z(:))
 
+! Find all the roots of the QP equation if necessary
+
+  call QP_roots(nBas,nC,nO,nV,nR,nS,eta,eHF,Omega,rho)
+ 
 ! Solve the quasi-particle equation
 
   eGW(:) = eHF(:) + Z(:)*SigC(:)
- 
+
 ! Dump results
 
 ! call print_excitation('RPA   ',ispin,nS,Omega(:,ispin))
diff --git a/src/QuAcK/QP_roots.f90 b/src/QuAcK/QP_roots.f90
new file mode 100644
index 0000000..2dca6fe
--- /dev/null
+++ b/src/QuAcK/QP_roots.f90
@@ -0,0 +1,156 @@
+subroutine QP_roots(nBas,nC,nO,nV,nR,nS,eta,eHF,Omega,rho)
+
+! Compute all the roots of the QP equation for each orbital
+
+  implicit none
+  include 'parameters.h'
+
+! Input variables
+
+  integer,intent(in)            :: nBas
+  integer,intent(in)            :: nC
+  integer,intent(in)            :: nO
+  integer,intent(in)            :: nV
+  integer,intent(in)            :: nR
+  integer,intent(in)            :: nS
+  double precision,intent(in)   :: eta
+  double precision,intent(in)   :: eHF(nBas)
+  double precision,intent(in)   :: Omega(nS)
+  double precision,intent(in)   :: rho(nBas,nBas,nS)
+
+! Local variables
+
+  integer                       :: i,j,a,b,x,jb,g
+  integer                       :: nRoot
+  integer,parameter             :: nGrid = 10000
+  double precision,parameter    :: wmin = -10d0
+  double precision,parameter    :: wmax = +10d0
+  double precision              :: dw
+  double precision              :: eps
+  double precision              :: left_sign,right_sign
+  double precision              :: left_QP,right_QP
+  double precision,allocatable  :: w(:)
+  double precision,allocatable  :: SigC(:)
+  double precision,allocatable  :: dSigC(:)
+
+  integer                       :: nIt
+  integer,parameter             :: maxIt = 64
+  double precision,parameter    :: thresh = 1d-6
+  double precision,external     :: SigmaC,dSigmaC
+  double precision              :: f,df
+  double precision              :: s,ds
+  double precision              :: om
+
+! Construct grid
+
+  allocate(w(nGrid),SigC(nGrid),dSigC(nGrid))
+
+! Minimum and maximum frequency values
+
+  dw = (wmax - wmin)/dble(nGrid)
+
+  do g=1,nGrid
+    w(g) = wmin + dble(g)*dw
+  enddo
+
+! Main loop over the orbitals
+
+  do x=nC+1,nBas-nR
+
+  SigC(:)  = 0d0
+  dSigC(:) = 0d0
+
+    ! Loop over grid points
+ 
+    do g=1,nGrid
+
+      ! Occupied part of the self-energy and spectral weight
+
+      do i=nC+1,nO
+        jb = 0
+        do j=nC+1,nO
+          do b=nO+1,nBas-nR
+
+            jb = jb + 1
+            eps = w(g) - eHF(i) + Omega(jb)
+            SigC(g)  = SigC(g)  + 2d0*rho(x,i,jb)**2*eps/(eps**2 + eta**2)
+            dSigC(g) = dSigC(g) - 2d0*rho(x,i,jb)**2*(eps**2 - eta**2)/(eps**2 + eta**2)**2
+
+          enddo
+        enddo
+      enddo
+ 
+      ! Virtual part of the self-energy and spectral weight
+ 
+      do a=nO+1,nBas-nR
+        jb = 0
+        do j=nC+1,nO
+          do b=nO+1,nBas-nR
+
+            jb = jb + 1
+            eps = w(g) - eHF(a) - Omega(jb)
+            SigC(g)  = SigC(g)  + 2d0*rho(x,a,jb)**2*eps/(eps**2 + eta**2)
+            dSigC(g) = dSigC(g) - 2d0*rho(x,a,jb)**2*(eps**2 - eta**2)/(eps**2 + eta**2)**2
+
+          enddo                                               
+        enddo                                                 
+      enddo                                                   
+
+    enddo
+
+! Find the zeros of the QP equation
+
+    nRoot = 0
+
+    write(*,*) '-----------------'
+    write(*,'(A10,I3)') 'Orbital ',x
+    write(*,*) '-----------------'
+    write(*,*) 
+    left_QP   = w(1) - eHF(x) - SigC(1)
+    left_sign = sign(1d0,left_QP)
+
+    do g=2,nGrid
+
+      right_QP = w(g) - eHF(x) - SigC(g)
+      right_sign = sign(1d0,right_QP)
+
+      if(left_sign /= right_sign .and. left_sign == sign(1d0,-1d0)) then
+
+        nRoot = nRoot + 1
+        write(*,'(A20,I6,F10.6,F10.6,I6,F10.6,F10.6,F10.6)') & 
+          'root right here!',g-1,w(g-1),left_QP,g,w(g),right_QP,1d0/(1d0-dSigC(g))
+
+        ! Run Newton's algorithm to find the root
+
+          om = w(g-1)
+          nIt = 0
+          f = 1d0
+    
+          do while (abs(f) > thresh .and. nIt < maxIt)
+    
+            nIt = nIt + 1
+
+            s  =  SigmaC(x,om,eta,nBas,nC,nO,nV,nR,nS,eHF,Omega,rho)
+            ds = dSigmaC(x,om,eta,nBas,nC,nO,nV,nR,nS,eHF,Omega,rho)
+            f  = om - eHF(x) - s
+            df = 1d0 - ds
+    
+            write(*,'(A3,I3,A1,1X,4F15.9)') 'It.',nIt,':',om,f,s,1d0/(1d0-ds)
+    
+            om = om - f/df
+    
+          end do
+
+      end if
+
+      left_sign = right_sign
+      left_QP   = right_QP
+   
+    end do
+    write(*,*)
+    write(*,'(A32,I3,A1,I3)') 'Number of roots for orbital ',x,':',nRoot
+    write(*,*)
+
+  end do
+
+end subroutine QP_roots
diff --git a/src/QuAcK/RPA.f90 b/src/QuAcK/RPA.f90
index 767f80f..d4046de 100644
--- a/src/QuAcK/RPA.f90
+++ b/src/QuAcK/RPA.f90
@@ -96,33 +96,33 @@ subroutine RPA(doACFDT,exchange_kernel,singlet_manifold,triplet_manifold,eta, &
 ! Compute the correlation energy via the adiabatic connection 
 ! Switch off ACFDT for RPA as the trace formula is equivalent 
 
-  if(doACFDT) then
+! if(doACFDT) then
 
-    write(*,*) '------------------------------------------------------'
-    write(*,*) 'Adiabatic connection version of RPA correlation energy'
-    write(*,*) '------------------------------------------------------'
-    write(*,*) 
+!   write(*,*) '------------------------------------------------------'
+!   write(*,*) 'Adiabatic connection version of RPA correlation energy'
+!   write(*,*) '------------------------------------------------------'
+!   write(*,*) 
 
-    call ACFDT(exchange_kernel,.false.,.true.,.false.,.false.,singlet_manifold,triplet_manifold,eta, &
-               nBas,nC,nO,nV,nR,nS,ERI,e,Omega,XpY,XmY,rho,EcAC)
+!   call ACFDT(exchange_kernel,.false.,.true.,.false.,.false.,singlet_manifold,triplet_manifold,eta, &
+!              nBas,nC,nO,nV,nR,nS,ERI,e,Omega,XpY,XmY,rho,EcAC)
 
-    if(exchange_kernel) then
-    
-      EcAC(1) = 0.5d0*EcAC(1)
-      EcAC(2) = 1.5d0*EcAC(1)
-    
-    end if
+!   if(exchange_kernel) then
+!   
+!     EcAC(1) = 0.5d0*EcAC(1)
+!     EcAC(2) = 1.5d0*EcAC(1)
+!   
+!   end if
 
-    write(*,*)
-    write(*,*)'-------------------------------------------------------------------------------'
-    write(*,'(2X,A50,F20.10)') 'AC@RPA  correlation energy (singlet) =',EcAC(1)
-    write(*,'(2X,A50,F20.10)') 'AC@RPA  correlation energy (triplet) =',EcAC(2)
-    write(*,'(2X,A50,F20.10)') 'AC@RPA  correlation energy           =',EcAC(1) + EcAC(2)
-    write(*,'(2X,A50,F20.10)') 'AC@RPA  total energy                 =',ENuc + ERHF + EcAC(1) + EcAC(2)
-    write(*,*)'-------------------------------------------------------------------------------'
-    write(*,*)
+!   write(*,*)
+!   write(*,*)'-------------------------------------------------------------------------------'
+!   write(*,'(2X,A50,F20.10)') 'AC@RPA  correlation energy (singlet) =',EcAC(1)
+!   write(*,'(2X,A50,F20.10)') 'AC@RPA  correlation energy (triplet) =',EcAC(2)
+!   write(*,'(2X,A50,F20.10)') 'AC@RPA  correlation energy           =',EcAC(1) + EcAC(2)
+!   write(*,'(2X,A50,F20.10)') 'AC@RPA  total energy                 =',ENuc + ERHF + EcAC(1) + EcAC(2)
+!   write(*,*)'-------------------------------------------------------------------------------'
+!   write(*,*)
 
 
-  end if
+! end if
 
 end subroutine RPA
diff --git a/src/QuAcK/SigmaC.f90 b/src/QuAcK/SigmaC.f90
new file mode 100644
index 0000000..32a07ca
--- /dev/null
+++ b/src/QuAcK/SigmaC.f90
@@ -0,0 +1,58 @@
+double precision function SigmaC(x,w,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho)
+
+! Compute diagonal of the correlation part of the self-energy
+
+  implicit none
+  include 'parameters.h'
+
+! Input variables
+
+  integer,intent(in)            :: x
+  double precision,intent(in)   :: w
+  double precision,intent(in)   :: eta
+  integer,intent(in)            :: nBas
+  integer,intent(in)            :: nC
+  integer,intent(in)            :: nO
+  integer,intent(in)            :: nV
+  integer,intent(in)            :: nR
+  integer,intent(in)            :: nS
+  double precision,intent(in)   :: e(nBas)
+  double precision,intent(in)   :: Omega(nS)
+  double precision,intent(in)   :: rho(nBas,nBas,nS)
+
+! Local variables
+
+  integer                       :: i,j,a,b,p,jb
+  double precision              :: eps
+
+! Initialize 
+
+  SigmaC = 0d0
+
+! Occupied part of the correlation self-energy
+
+  do i=nC+1,nO
+    jb = 0
+    do j=nC+1,nO
+      do b=nO+1,nBas-nR
+        jb = jb + 1
+        eps = w - e(i) + Omega(jb)
+        SigmaC = SigmaC + 2d0*rho(x,i,jb)**2*eps/(eps**2 + eta**2)
+      enddo
+    enddo
+  enddo
+
+! Virtual part of the correlation self-energy
+
+  do a=nO+1,nBas-nR
+    jb = 0
+    do j=nC+1,nO
+      do b=nO+1,nBas-nR
+        jb = jb + 1
+        eps = w - e(a) - Omega(jb)
+        SigmaC = SigmaC + 2d0*rho(x,a,jb)**2*eps/(eps**2 + eta**2)
+      enddo
+    enddo
+  enddo
+
+end function SigmaC
diff --git a/src/QuAcK/dSigmaC.f90 b/src/QuAcK/dSigmaC.f90
new file mode 100644
index 0000000..6323de9
--- /dev/null
+++ b/src/QuAcK/dSigmaC.f90
@@ -0,0 +1,58 @@
+double precision function dSigmaC(x,w,eta,nBas,nC,nO,nV,nR,nS,e,Omega,rho)
+
+! Compute the derivative of the correlation part of the self-energy
+
+  implicit none
+  include 'parameters.h'
+
+! Input variables
+
+  integer,intent(in)            :: x
+  double precision,intent(in)   :: w
+  double precision,intent(in)   :: eta
+  integer,intent(in)            :: nBas
+  integer,intent(in)            :: nC
+  integer,intent(in)            :: nO
+  integer,intent(in)            :: nV
+  integer,intent(in)            :: nR
+  integer,intent(in)            :: nS
+  double precision,intent(in)   :: e(nBas)
+  double precision,intent(in)   :: Omega(nS)
+  double precision,intent(in)   :: rho(nBas,nBas,nS)
+
+! Local variables
+
+  integer                       :: i,j,a,b,p,jb
+  double precision              :: eps
+
+! Initialize 
+
+  dSigmaC = 0d0
+
+! Occupied part of the correlation self-energy
+
+  do i=nC+1,nO
+    jb = 0
+    do j=nC+1,nO
+      do b=nO+1,nBas-nR
+        jb = jb + 1
+        eps = w - e(i) + Omega(jb)
+        dSigmaC = dSigmaC - 2d0*rho(x,i,jb)**2*(eps**2 - eta**2)/(eps**2 + eta**2)**2
+      enddo
+    enddo
+  enddo
+
+! Virtual part of the correlation self-energy
+
+  do a=nO+1,nBas-nR
+    jb = 0
+    do j=nC+1,nO
+      do b=nO+1,nBas-nR
+        jb = jb + 1
+        eps = w - e(a) - Omega(jb)
+        dSigmaC = dSigmaC - 2d0*rho(x,a,jb)**2*(eps**2 - eta**2)/(eps**2 + eta**2)**2
+      enddo
+    enddo
+  enddo
+
+end function dSigmaC