Skip to content

Commit 42aad4e

Browse files
author
lburth
committed
Root search for UG0W0 on MOM
1 parent 70cfa37 commit 42aad4e

File tree

6 files changed

+322
-1
lines changed

6 files changed

+322
-1
lines changed

src/GW/CVS_SRG_UGW_Re_SigC.f90

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
double precision function CVS_UGW_SRG_Re_SigC(p,w,s,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,e,Om,rho)
2+
3+
! Compute diagonal of the correlation part of the self-energy
4+
5+
implicit none
6+
include 'parameters.h'
7+
8+
! Input variables
9+
10+
integer,intent(in) :: p
11+
double precision,intent(in) :: w
12+
double precision,intent(in) :: s
13+
integer,intent(in) :: nBas
14+
integer,intent(in) :: nC
15+
integer,intent(in) :: nO
16+
integer,intent(in) :: nV
17+
integer,intent(in) :: nR
18+
integer,intent(in) :: nS
19+
double precision,intent(in) :: e(nBas)
20+
double precision,intent(in) :: Om(nS)
21+
double precision,intent(in) :: rho(nBas,nBas,nS)
22+
integer,intent(in) :: nCVS,nFC
23+
integer,intent(in) :: occupations(nO-nFC)
24+
integer,intent(in) :: virtuals(nBas-nO)
25+
26+
! Local variables
27+
28+
integer :: i,a,m
29+
double precision :: Dpim,Dpam
30+
31+
! Initialize
32+
33+
CVS_UGW_SRG_Re_SigC = 0d0
34+
35+
! Occupied part of the correlation self-energy
36+
37+
do i=1,nO-nFC
38+
do m=1,nS
39+
Dpim = w - e(occupations(i)) + Om(m)
40+
CVS_UGW_SRG_Re_SigC = CVS_UGW_SRG_Re_SigC &
41+
+ rho(p,occupations(i),m)**2*(1d0-exp(-2d0*s*Dpim*Dpim))/Dpim
42+
end do
43+
end do
44+
45+
! Virtual part of the correlation self-energy
46+
47+
do a=nCVS+1,nBas-nO
48+
do m=1,nS
49+
Dpam = w - e(virtuals(a)) - Om(m)
50+
CVS_UGW_SRG_Re_SigC = CVS_UGW_SRG_Re_SigC &
51+
+ rho(p,virtuals(a),m)**2*(1d0-exp(-2d0*s*Dpam*Dpam))/Dpam
52+
end do
53+
end do
54+
55+
end function

src/GW/CVS_SRG_UGW_Re_dSigC.f90

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
double precision function CVS_UGW_SRG_Re_dSigC(p,w,s,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,e,Om,rho)
2+
3+
! Compute the derivative of the correlation part of the self-energy
4+
5+
implicit none
6+
include 'parameters.h'
7+
8+
! Input variables
9+
10+
integer,intent(in) :: p
11+
double precision,intent(in) :: w
12+
double precision,intent(in) :: s
13+
integer,intent(in) :: nBas
14+
integer,intent(in) :: nC
15+
integer,intent(in) :: nO
16+
integer,intent(in) :: nV
17+
integer,intent(in) :: nR
18+
integer,intent(in) :: nS
19+
double precision,intent(in) :: e(nBas)
20+
double precision,intent(in) :: Om(nS)
21+
double precision,intent(in) :: rho(nBas,nBas,nS)
22+
integer,intent(in) :: nCVS,nFC
23+
integer,intent(in) :: occupations(nO-nFC)
24+
integer,intent(in) :: virtuals(nBas-nO)
25+
26+
! Local variables
27+
28+
integer :: i,a,m
29+
double precision :: Dpim,Dpam
30+
31+
! Initialize
32+
33+
CVS_UGW_SRG_Re_dSigC = 0d0
34+
35+
! Occupied part of the correlation self-energy
36+
37+
do i=1,nO-nFC
38+
do m=1,nS
39+
Dpim = w - e(occupations(i)) + Om(m)
40+
CVS_UGW_SRG_Re_dSigC = CVS_UGW_SRG_Re_dSigC &
41+
- rho(p,occupations(i),m)**2*(1d0-exp(-2d0*s*Dpim*Dpim))/Dpim**2
42+
end do
43+
end do
44+
45+
! Virtual part of the correlation self-energy
46+
47+
do a=nCVS+1,nBas-nFC
48+
do m=1,nS
49+
Dpam = w - e(virtuals(a)) - Om(m)
50+
CVS_UGW_SRG_Re_dSigC = CVS_UGW_SRG_Re_dSigC &
51+
- rho(p,virtuals(a),m)**2*(1d0-exp(-2d0*s*Dpam*Dpam))/Dpam**2
52+
end do
53+
end do
54+
55+
end function

src/GW/CVS_UG0W0.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ subroutine CVS_UG0W0(dotest,doACFDT,exchange_kernel,doXBS,dophBSE,TDA_W,TDA,dBSE
214214
if(is==1) write(*,*)' Spin-up orbitals '
215215
if(is==2) write(*,*)' Spin-down orbitals '
216216

217-
call UGW_QP_graph(doSRG,eta,flow,nBas,nC(is),nO(is),nV(is),nR(is),nSt,eHF(:,is), &
217+
call CVS_UGW_QP_graph(doSRG,eta,flow,nBas,nC(is),nO(is),nV(is),nR(is),nSt,nCVS(is),nFC(is),occupations_fc(:,is),virtuals(:,is),eHF(:,is), &
218218
Om,rho(:,:,:,is),eGWlin(:,is),eHF(:,is),eGW(:,is),Z(:,is))
219219
end do
220220

src/GW/CVS_UGW_QP_graph.f90

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
subroutine CVS_UGW_QP_graph(doSRG,eta,flow,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,eHF,Om,rho,eGWlin,eOld,eGW,Z)
2+
3+
! Compute the graphical solution of the QP equation
4+
5+
implicit none
6+
include 'parameters.h'
7+
8+
! Input variables
9+
10+
integer,intent(in) :: nBas
11+
integer,intent(in) :: nC
12+
integer,intent(in) :: nO
13+
integer,intent(in) :: nV
14+
integer,intent(in) :: nR
15+
integer,intent(in) :: nS
16+
integer,intent(in) :: nCVS,nFC
17+
integer,intent(in) :: occupations(nO-nFC)
18+
integer,intent(in) :: virtuals(nBas-nO)
19+
20+
logical,intent(in) :: doSRG
21+
double precision,intent(in) :: eta
22+
double precision,intent(in) :: flow
23+
double precision,intent(in) :: eHF(nBas)
24+
double precision,intent(in) :: Om(nS)
25+
double precision,intent(in) :: rho(nBas,nBas,nS,nspin)
26+
27+
double precision,intent(in) :: eGWlin(nBas)
28+
double precision,intent(in) :: eOld(nBas)
29+
30+
! Local variables
31+
32+
integer :: p
33+
integer :: nIt
34+
integer,parameter :: maxIt = 64
35+
double precision,parameter :: thresh = 1d-6
36+
double precision,external :: CVS_UGW_Re_SigC,CVS_UGW_Re_dSigC
37+
double precision,external :: CVS_UGW_SRG_Re_SigC,CVS_UGW_SRG_Re_dSigC
38+
double precision :: SigC,dSigC
39+
double precision :: f,df
40+
double precision :: w
41+
42+
! Output variables
43+
44+
double precision,intent(out) :: eGW(nBas)
45+
double precision,intent(out) :: Z(nBas)
46+
47+
! Run Newton's algorithm to find the root
48+
49+
write(*,*)'-----------------------------------------------------'
50+
write(*,'(A5,1X,A3,1X,A15,1X,A15,1X,A10)') 'Orb.','It.','e_GWlin (eV)','e_GW (eV)','Z'
51+
write(*,*)'-----------------------------------------------------'
52+
53+
do p=nC+1,nBas-nR
54+
55+
w = eGWlin(p)
56+
nIt = 0
57+
f = 1d0
58+
59+
do while (abs(f) > thresh .and. nIt < maxIt)
60+
61+
nIt = nIt + 1
62+
63+
if(doSRG) then
64+
65+
SigC = CVS_UGW_SRG_Re_SigC(p,w,flow,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,eOld,Om,rho)
66+
dSigC = CVS_UGW_SRG_Re_dSigC(p,w,flow,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,eOld,Om,rho)
67+
68+
else
69+
70+
SigC = CVS_UGW_Re_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,eOld,Om,rho)
71+
dSigC = CVS_UGW_Re_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,eOld,Om,rho)
72+
73+
end if
74+
75+
f = w - eHF(p) - SigC
76+
df = 1d0/(1d0 - dSigC)
77+
78+
w = w - df*f
79+
80+
end do
81+
82+
if(nIt == maxIt) then
83+
84+
eGW(p) = eGWlin(p)
85+
write(*,'(I5,1X,I3,1X,F15.9,1X,F15.9,1X,F10.6,1X,A12)') p,nIt,eGWlin(p)*HaToeV,eGW(p)*HaToeV,Z(p),'Cvg Failed!'
86+
87+
else
88+
89+
eGW(p) = w
90+
Z(p) = df
91+
92+
write(*,'(I5,1X,I3,1X,F15.9,1X,F15.9,1X,F10.6)') p,nIt,eGWlin(p)*HaToeV,eGW(p)*HaToeV,Z(p)
93+
94+
end if
95+
96+
end do
97+
98+
write(*,*)'-----------------------------------------------------'
99+
write(*,*)
100+
101+
end subroutine

src/GW/CVS_UGW_Re_SigC.f90

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
double precision function CVS_UGW_Re_SigC(p,w,eta,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,e,Om,rho)
2+
3+
! Compute diagonal of the correlation part of the self-energy
4+
5+
implicit none
6+
include 'parameters.h'
7+
8+
! Input variables
9+
10+
integer,intent(in) :: p
11+
double precision,intent(in) :: w
12+
double precision,intent(in) :: eta
13+
integer,intent(in) :: nBas
14+
integer,intent(in) :: nC
15+
integer,intent(in) :: nO
16+
integer,intent(in) :: nV
17+
integer,intent(in) :: nR
18+
integer,intent(in) :: nS
19+
double precision,intent(in) :: e(nBas)
20+
double precision,intent(in) :: Om(nS)
21+
double precision,intent(in) :: rho(nBas,nBas,nS)
22+
integer,intent(in) :: nCVS,nFC
23+
integer,intent(in) :: occupations(nO-nFC)
24+
integer,intent(in) :: virtuals(nBas-nO)
25+
26+
! Local variables
27+
28+
integer :: i,a,m
29+
double precision :: num,eps
30+
31+
! Initialize
32+
33+
CVS_UGW_Re_SigC = 0d0
34+
35+
! Occupied part of the correlation self-energy
36+
37+
do i=1,nO-nFC
38+
do m=1,nS
39+
eps = w - e(occupations(i)) + Om(m)
40+
num = rho(p,occupations(i),m)**2
41+
CVS_UGW_Re_SigC = CVS_UGW_Re_SigC + num*eps/(eps**2 + eta**2)
42+
end do
43+
end do
44+
45+
! Virtual part of the correlation self-energy
46+
47+
do a=nCVS+1,nBas-nO
48+
do m=1,nS
49+
eps = w - e(virtuals(a)) - Om(m)
50+
num = rho(p,virtuals(a),m)**2
51+
CVS_UGW_Re_SigC = CVS_UGW_Re_SigC + num*eps/(eps**2 + eta**2)
52+
end do
53+
end do
54+
55+
end function

src/GW/CVS_UGW_Re_dSigC.f90

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
double precision function CVS_UGW_Re_dSigC(p,w,eta,nBas,nC,nO,nV,nR,nS,nCVS,nFC,occupations,virtuals,e,Om,rho)
2+
3+
! Compute the derivative of the correlation part of the self-energy
4+
5+
implicit none
6+
include 'parameters.h'
7+
8+
! Input variables
9+
10+
integer,intent(in) :: p
11+
double precision,intent(in) :: w
12+
double precision,intent(in) :: eta
13+
integer,intent(in) :: nBas
14+
integer,intent(in) :: nC
15+
integer,intent(in) :: nO
16+
integer,intent(in) :: nV
17+
integer,intent(in) :: nR
18+
integer,intent(in) :: nS
19+
double precision,intent(in) :: e(nBas)
20+
double precision,intent(in) :: Om(nS)
21+
double precision,intent(in) :: rho(nBas,nBas,nS)
22+
integer,intent(in) :: nCVS,nFC
23+
integer,intent(in) :: occupations(nO-nFC)
24+
integer,intent(in) :: virtuals(nBas-nO)
25+
26+
! Local variables
27+
28+
integer :: i,a,m
29+
double precision :: num,eps
30+
31+
! Initialize
32+
33+
CVS_UGW_Re_dSigC = 0d0
34+
35+
! Occupied part of the correlation self-energy
36+
37+
do i=1,nO-nFC
38+
do m=1,nS
39+
eps = w - e(occupations(i)) + Om(m)
40+
num = rho(p,occupations(i),m)**2
41+
CVS_UGW_Re_dSigC = CVS_UGW_Re_dSigC - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
42+
end do
43+
end do
44+
45+
! Virtual part of the correlation self-energy
46+
47+
do a=nCVS+1,nBas-nO
48+
do m=1,nS
49+
eps = w - e(virtuals(a)) - Om(m)
50+
num = rho(p,virtuals(a),m)**2
51+
CVS_UGW_Re_dSigC = CVS_UGW_Re_dSigC - num*(eps**2 - eta**2)/(eps**2 + eta**2)**2
52+
end do
53+
end do
54+
55+
end function

0 commit comments

Comments
 (0)