-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexciton_polaron_2dgas.f90
284 lines (250 loc) · 8.24 KB
/
exciton_polaron_2dgas.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
program ed_bilayer
USE DMFT_ED
USE SCIFOR
USE DMFT_TOOLS
USE MPI
implicit none
integer :: ip,im,ipp,iw
real(8) :: wx
real(8) :: Vex
real(8) :: Ef
real(8) :: h0
!
real(8) :: ecut,pcut
integer :: lp,lphi
integer :: unit_io
!
real(8),dimension(:),allocatable :: wr,modp,phip
complex(8),dimension(:,:),allocatable :: Pi_irreducible,Pi_irreducible_tmp
!
real(8),dimension(:),allocatable :: Im_Sigma,Im_Sigma_tmp
complex(8),dimension(:),allocatable :: Sigma,DX
!
complex(8),dimension(:,:),allocatable :: Lambda_vertex
!
complex(8),dimension(:),allocatable :: int_tmp,int_tmp_inn
real(8),dimension(:),allocatable :: int_tmp_im
real(8),dimension(:),allocatable :: epp_tmp
real(8) :: epsilonp,epsX
complex(8) :: wcmplx
real(8) :: wp,mx,mel,bwp,wtmp,ImL
logical :: hartree
real(8) :: ndop
!
character(len=16) :: finput
!MPI Vars:
integer :: comm,rank,mpierr,mpiSize
logical :: master
!
!
call init_MPI()
comm = MPI_COMM_WORLD
call StartMsg_MPI(comm)
rank = get_Rank_MPI(comm)
master = get_Master_MPI(comm)
mpiSize = get_Size_MPI(comm)
!
!
!Parse additional variables && read Input && read H(k)^4x4
call parse_cmd_variable(finput,"FINPUT",default='input_Xpol.in')
call parse_input_variable(wx,"wx",finput,default=1.d0,comment='q=0 exciton frequency ')
call parse_input_variable(Vex,"Vex",finput,default=1.d0,comment='e-X interaction')
call parse_input_variable(ef,"ef",finput,default=0.d0,comment='fermi energy of the 2d electron gas')
call parse_input_variable(ecut,"ecut",finput,default=1.d0,comment='cut off energy for momentum integration [eV]')
call parse_input_variable(lp,"lp",finput,default=100,comment='number of points for momenutm integration (modulus)')
call parse_input_variable(lphi,"lphi",finput,default=100,comment='number of points for momenutm integration (phase)')
call parse_input_variable(epsX,"epsX",finput,default=1.d-3,comment='linewidth exciton')
call parse_input_variable(mX,"mX",finput,default=1.d0,comment='mass enhancement exciton')
call parse_input_variable(mel,"mel",finput,default=1.d0,comment='mass enhancement electron')
call parse_input_variable(hartree,"hartree",finput,default=.true.,comment='include the hartree term to the Sigma_X')
!
call ed_read_input(trim(finput),comm)
!
!Add DMFT CTRL Variables:
call add_ctrl_var(Norb,"norb")
call add_ctrl_var(Nspin,"nspin")
call add_ctrl_var(beta,"beta")
call add_ctrl_var(xmu,"xmu")
call add_ctrl_var(wini,'wini')
call add_ctrl_var(wfin,'wfin')
call add_ctrl_var(eps,"eps")
!
!
h0=7.62d-02 ! hbar^2/m [eV x nm^2]
pcut=sqrt(2.d0*ecut/h0)
!
!
allocate(wr(lreal)); wr=linspace(wini,wfin,lreal)
allocate(modp(lp)); modp=linspace(0.d0,pcut,lp)
allocate(phip(lphi)); phip=linspace(0.d0,2.d0*pi,lphi)
!
allocate(Pi_irreducible(lreal,lp)); Pi_irreducible = 0.d0
allocate(Pi_irreducible_tmp(lreal,lp)); Pi_irreducible_tmp = 0.d0
!
allocate(int_tmp(lp)); int_tmp=0.d0
allocate(int_tmp_inn(lphi)); int_tmp_inn=0.d0
allocate(epp_tmp(lphi)); epp_tmp=0.d0
do iw=1+rank,lreal,mpiSize
wcmplx=wr(iw) + xi*epsX
if(master) write(*,*) iw
do ip=1,lp
!
Pi_irreducible_tmp(iw,ip) = 0.d0
!
int_tmp=0d0
do ipp=1,lp
!
int_tmp_inn = 0.d0
epp_tmp(1:lphi) = h0*0.5*(modp(ip)**2.d0+modp(ipp)**2.d0-2.d0*modp(ipp)*modp(ip)*dcos(phip(1:lphi)))/mel-Ef
wp = wx + h0*0.5*0.5*modp(ipp)**2.d0/mx
bwp = 1.d0/(exp(-beta*wp)-1.d0)
int_tmp_inn(1:lphi) = (fermi(epp_tmp,beta) + bwp)/(wcmplx - epp_tmp - wp)*modp(ipp)/(2d0*pi)/(2d0*pi)
!
int_tmp(ipp) = trapz(int_tmp_inn,phip(1),phip(lphi))
!
end do
Pi_irreducible_tmp(iw,ip) = 1.d0*trapz(int_tmp,modp(1),modp(lp))
!
end do
end do
!
call mpi_allreduce(Pi_irreducible_tmp,Pi_irreducible,lreal*lp,MPI_DOUBLE_COMPLEX,MPI_SUM,MPI_COMM_WORLD,MPIerr)
allocate(Lambda_vertex(lreal,lp)); Lambda_vertex = 0.d0
Lambda_vertex=Vex*Vex*Pi_irreducible/(1.0+Vex*Pi_irreducible)
if(master) then
unit_io=free_unit()
open(unit=unit_io,file="pi_irreducible.out")
do iw=1,lreal
do ip=1,lp
write(unit_io,'(5F18.10)') wr(iw),modp(ip),Pi_irreducible(iw,ip)
end do
write(unit_io,*)
end do
close(unit_io)
!
open(unit=unit_io,file="Lambda_vertex.out")
do iw=1,lreal
do ip=1,lp
write(unit_io,'(5F18.10)') wr(iw),modp(ip),lambda_vertex(iw,ip)
end do
write(unit_io,*)
end do
close(unit_io)
open(unit=unit_io,file="q0_pi_irreducible.out")
do iw=1,lreal
write(unit_io,'(5F18.10)') wr(iw),Pi_irreducible(iw,1)
end do
close(unit_io)
open(unit=unit_io,file="q0_lambda_vertex.out")
do iw=1,lreal
write(unit_io,'(5F18.10)') wr(iw),Lambda_vertex(iw,1)
end do
close(unit_io)
end if
!
allocate(Im_Sigma(lreal)); Im_Sigma = 0.d0
allocate(Im_Sigma_tmp(lreal)); Im_Sigma_tmp = 0.d0
allocate(Sigma(lreal)); Sigma = 0.d0
allocate(int_tmp_im(lp));int_tmp_im = 0.d0
!
do iw=1+rank,lreal,mpiSize
!
Im_Sigma_tmp(iw) = 0.d0
!
int_tmp_im=0.d0
do ip=1,lp
!find Im \Lambda_p(\Omega+\epsilon_p)
epsilonp = h0*0.5*modp(ip)**2.d0
wtmp = wr(iw) + epsilonp
if(wtmp.lt.wini.or.wtmp.gt.wfin) then
ImL=0.d0
else
!+- interpolate
call linear_spline(wr(:),dimag(Lambda_vertex(:,ip)),wtmp,ImL)
end if
!
int_tmp_im(ip) = (fermi(epsilonp-ef,beta) - fermi(wtmp-ef,beta) )*ImL*modp(ip)/(2.d0*pi)
!
end do
!
Im_sigma_tmp(iw) = -1.d0*trapz(int_tmp_im,modp(1),modp(lp))
!
end do
!
call mpi_allreduce(Im_sigma_tmp,Im_sigma,lreal,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,MPIerr)
call get_kkt(Im_sigma,Im_sigma_tmp,wr,'IR')
!
Sigma = Im_sigma_tmp + xi*Im_sigma
!
if(hartree) then
ndop=0.d0
int_tmp=0.d0
int_tmp = fermi(h0*0.5*modp(:)**2.d0-Ef,beta)*modp(:)/(2d0*pi)
ndop=trapz(int_tmp,modp(1),modp(lp))
Sigma = Sigma+Vex*ndop
end if
allocate(Dx(lreal));Dx=0.d0
do iw=1,Lreal
wcmplx = wr(iw) + xi*epsX
Dx(iw) = 1.d0/(wcmplx-wx-Sigma(iw))
end do
if(rank==0) then
unit_io=free_unit()
open(unit=unit_io,file="Sigma.out")
do iw=1,lreal
write(unit_io,'(5F18.10)') wr(iw),Sigma(iw)
end do
close(unit_io)
open(unit=unit_io,file="DX.out")
do iw=1,lreal
write(unit_io,'(5F18.10)') wr(iw),Dx(iw)
end do
close(unit_io)
end if
!
call finalize_MPI()
contains
subroutine get_KKT(ReS,ImS,wreal,mode_)
real(8),dimension(:) :: ReS,ImS
real(8),dimension(:) :: wreal
character(len=2),optional :: mode_
character(len=2) :: mode
real(8) :: A,B
integer :: iv,iw,Lw
real(8),dimension(:),allocatable :: ImS_tmp
!
Lw = size(wreal)
if(size(ReS).ne.Lw) then
if(rank==0) write(*,*) 'size(ReS).ne.Lw'
CALL MPI_BARRIER(MPI_COMM_WORLD,MPIerr)
stop
end if
!
if(size(ImS).ne.Lw) then
if(rank==0) write(*,*) 'size(ImS).ne.Lw'
CALL MPI_BARRIER(MPI_COMM_WORLD,MPIerr)
stop
end if
!
mode='RI'
if(present(mode_)) mode=mode_
if(mode.ne.'IR'.and.mode.ne.'RI') stop "wrong mode KKT"
!
allocate(ImS_tmp(Lw))
ImS_tmp=0.d0
ImS=0.d0
do iw=1+rank,Lw,mpiSize
do iv=1,Lw-1
A = ReS(iv) -wr(iv)*(ReS(iv)-ReS(iv+1))/(wr(iv)-wr(iv+1))
B = (ReS(iv)-ReS(iv+1))/(wr(iv)-wr(iv+1))
ImS_tmp(iw) =ImS_tmp(iw) -B*(wr(iv+1)-wr(iv))
if(iv+1.ne.iw) ImS_tmp(iw) = ImS_tmp(iw) - (A+B*wr(iw))*log(abs(wr(iw)-wr(iv+1)))
if(iv.ne.iw) ImS_tmp(iw) = ImS_tmp(iw) + (A+B*wr(iw))*log(abs(wr(iw)-wr(iv)))
end do
ImS_tmp(iw) = ImS_tmp(iw)/pi
if(mode.eq.'IR') ImS_tmp(iw)=-ImS_tmp(iw)
end do
CALL MPI_ALLREDUCE(ImS_tmp,ImS,Lw,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,MPIerr)
!
end subroutine get_KKT
end program