-
Notifications
You must be signed in to change notification settings - Fork 1
/
VCA_BATH_FUNCTIONS.f90
454 lines (342 loc) · 15.9 KB
/
VCA_BATH_FUNCTIONS.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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
MODULE VCA_BATH_FUNCTIONS
USE SF_CONSTANTS, only: zero
USE SF_IOTOOLS, only:free_unit,reg,file_length,txtfy
USE SF_LINALG, only: eye,inv,zeye,inv_her
USE VCA_INPUT_VARS
USE VCA_VARS_GLOBAL
USE VCA_BATH_SETUP
USE VCA_AUX_FUNX
implicit none
private
interface delta_bath_freq
module procedure delta_bath_freq_main
endinterface delta_bath_freq
!##################################################################
!
!\DELTA HYBRIDIZATION FUNCTION MATSUBARA
!
!##################################################################
!NORMAL
interface delta_bath_mats
module procedure delta_bath_mats_main
module procedure delta_bath_mats_main_
end interface delta_bath_mats
!##################################################################
!
!\DELTA HYBRIDIZATION FUNCTION REAL
!
!##################################################################
!NORMAL
interface delta_bath_real
module procedure delta_bath_real_main
module procedure delta_bath_real_main_
end interface delta_bath_real
!
!##################################################################
!
!NON-INTERACTING GREEN'S FUNCTION MATSUBARA
!
!##################################################################
!NORMAL
interface g0and_bath_mats
module procedure g0and_bath_mats_main
module procedure g0and_bath_mats_main_
end interface g0and_bath_mats
!
!##################################################################
!
!INVERSE NON-INTERACTING GREEN'S FUNCTION MATSUBARA
!
!##################################################################
!NORMAL
interface invg0_bath_mats
module procedure invg0_bath_mats_main
module procedure invg0_bath_mats_main_
end interface invg0_bath_mats
!##################################################################
!
!NON-INTERACTING GREEN'S FUNCTION REAL-AXIS
!
!##################################################################
!NORMAL
interface g0and_bath_real
module procedure g0and_bath_real_main
module procedure g0and_bath_real_main_
end interface g0and_bath_real
!
!##################################################################
!
!INVERSE NON-INTERACTING GREEN'S FUNCTION REAL-AXIS
!
!##################################################################
!NORMAL
interface invg0_bath_real
module procedure invg0_bath_real_main
module procedure invg0_bath_real_main_
end interface invg0_bath_real
!
public :: delta_bath_freq
public :: delta_bath_mats
public :: g0and_bath_mats
public :: invg0_bath_mats
!
public :: delta_bath_real
public :: g0and_bath_real
public :: invg0_bath_real
integer :: ilat,jlat,iorb,jorb,ispin,jspin
contains
!##################################################################
!
! DELTA FUNCTIONS
! G0 FUNCTIONS
! G0^{-1} FUNCTIONS
! at a point x from type(effective_bath) :: vca_bath
!
!##################################################################
!+-----------------------------------------------------------------------------+!
!PURPOSE: Delta functions for specific frequency:
!+-----------------------------------------------------------------------------+!
!NORMAL:
function delta_bath_freq_main(x,vca_bath_) result(Delta)
complex(8),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb) :: Delta
integer :: i,ih,L
integer :: io,jo
complex(8),dimension(Nlat_bath*Nspin*Norb_bath,Nlat_bath*Nspin*Norb_bath) :: hbath
complex(8),dimension(Nlat*Nspin*Norb,Nlat_bath*Nspin*Norb_bath) :: vbath_ver
complex(8),dimension(Nlat_bath*Nspin*Norb_bath,Nlat*Nspin*Norb) :: vbath_hor
!
Delta=zero
!
!
if(.not.vca_bath_%status)return
!
hbath = (x+XMU)*zeye(Nlat_bath*Nspin*Norb_bath) - vca_nnn2lso_reshape(vca_bath_%h,Nlat_bath,Nspin,Norb_bath)
vbath_ver = vca_rectangular_n2j_reshape(vca_bath_%v,Nlat,Nlat_bath,Nspin,Nspin,Norb,Norb_bath)
vbath_hor = conjg(transpose(vbath_ver))
!
call inv(hbath)
!
Delta = vca_lso2nnn_reshape(matmul(vbath_ver,matmul(hbath,vbath_hor)),Nlat,Nspin,Norb)
!
end function delta_bath_freq_main
!+-----------------------------------------------------------------------------+!
!PURPOSE: Delta functions on the Matsubara axis:
!+-----------------------------------------------------------------------------+!
!NORMAL:
function delta_bath_mats_main(x,vca_bath_) result(Delta)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: Delta
integer :: i,ih,L
integer :: io,jo
complex(8),dimension(Nlat_bath*Nspin*Norb_bath,Nlat_bath*Nspin*Norb_bath) :: hbath
complex(8),dimension(Nlat*Nspin*Norb,Nlat_bath*Nspin*Norb_bath) :: vbath_ver
complex(8),dimension(Nlat_bath*Nspin*Norb_bath,Nlat*Nspin*Norb) :: vbath_hor
!
Delta=zero
!
L = size(x)
!
if(.not.vca_bath_%status)return
vbath_ver = vca_rectangular_n2j_reshape(vca_bath_%v,Nlat,Nlat_bath,Nspin,Nspin,Norb,Norb_bath)
vbath_hor = conjg(transpose(vbath_ver))
!
do i=1,L
hbath = (x(i)+XMU)*zeye(Nlat_bath*Nspin*Norb_bath) - vca_nnn2lso_reshape(vca_bath_%h,Nlat_bath,Nspin,Norb_bath)
call inv(hbath)
Delta(:,:,:,:,:,:,i) = vca_lso2nnn_reshape(matmul(vbath_ver,matmul(hbath,vbath_hor)),Nlat,Nspin,Norb)
enddo
end function delta_bath_mats_main
!+-----------------------------------------------------------------------------+!
!PURPOSE: Delta functions on the Real axis:
!+-----------------------------------------------------------------------------+!
function delta_bath_real_main(x,vca_bath_) result(Delta)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: Delta
integer :: i,ih,L
integer :: io,jo
complex(8),dimension(Nlat_bath*Nspin*Norb_bath,Nlat_bath*Nspin*Norb_bath) :: hbath
complex(8),dimension(Nlat*Nspin*Norb,Nlat_bath*Nspin*Norb_bath) :: vbath_ver
complex(8),dimension(Nlat_bath*Nspin*Norb_bath,Nlat*Nspin*Norb) :: vbath_hor
!
Delta=zero
!
L = size(x)
!
if(.not.vca_bath_%status)return
vbath_ver = vca_rectangular_n2j_reshape(vca_bath_%v,Nlat,Nlat_bath,Nspin,Nspin,Norb,Norb_bath)
vbath_hor = conjg(transpose(vbath_ver))
!
do i=1,L
hbath = (x(i)+XMU)*zeye(Nlat_bath*Nspin*Norb_bath) - vca_nnn2lso_reshape(vca_bath_%h,Nlat_bath,Nspin,Norb_bath)
call inv(hbath)
Delta(:,:,:,:,:,:,i) = vca_lso2nnn_reshape(matmul(vbath_ver,matmul(hbath,vbath_hor)),Nlat,Nspin,Norb)
enddo
!
end function delta_bath_real_main
!+-----------------------------------------------------------------------------+!
!PURPOSE: G0 non-interacting Green's functions on the Matsubara axis
!+-----------------------------------------------------------------------------+!
!NORMAL:
function g0and_bath_mats_main(x,vca_bath_) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and,Delta
complex(8),dimension(Nlat*Nspin*Norb,Nlat*Nspin*Norb) :: tmp
integer :: iorb,jorb,ispin,jspin,io,jo,Nso,i,L
real(8),dimension(size(x)) :: det
complex(8),dimension(size(x)) :: fg,ff
complex(8),dimension(:,:),allocatable :: fgorb,zeta
!
G0and = zero
!
L=size(x)
!
!
Delta = delta_bath_mats(x,vca_bath_)
do i=1,L
tmp=(x(i) + xmu)*Zeye(Nlat*Nspin*Norb) - vca_nnn2lso_reshape(impHloc - Delta(:,:,:,:,:,:,i),Nlat,Nspin,Norb)
call inv(tmp)
G0and(:,:,:,:,:,:,i) = vca_lso2nnn_reshape(tmp,Nlat,Nspin,Norb)
enddo
!
end function g0and_bath_mats_main
!+-----------------------------------------------------------------------------+!
!PURPOSE: G0 non-interacting Green's functions on the real-axis
!+-----------------------------------------------------------------------------+!
!NORMAL:
function g0and_bath_real_main(x,vca_bath_) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and,Delta
complex(8),dimension(Nlat*Nspin*Norb,Nlat*Nspin*Norb) :: tmp
integer :: iorb,jorb,ispin,jspin,io,jo,Nso,i,L
complex(8),dimension(size(x)) :: det,fg,ff
complex(8),dimension(:,:),allocatable :: fgorb,zeta
!
G0and = zero
!
L = size(x)
!
Delta = delta_bath_real(x,vca_bath_)
do i=1,L
tmp=(x(i) + xmu)*Zeye(Nlat*Nspin*Norb) - vca_nnn2lso_reshape(impHloc - Delta(:,:,:,:,:,:,i),Nlat,Nspin,Norb)
call inv(tmp)
G0and(:,:,:,:,:,:,i) = vca_lso2nnn_reshape(tmp,Nlat,Nspin,Norb)
enddo
!
end function g0and_bath_real_main
!+-----------------------------------------------------------------------------+!
!PURPOSE: G0^{-1} non-interacting Green's functions on the Matsubara axis:
!+-----------------------------------------------------------------------------+!
!NORMAL:
function invg0_bath_mats_main(x,vca_bath_) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and,Delta
integer :: i,iorb,jorb,ispin,jspin,io,jo,Nso,L
complex(8),dimension(:,:),allocatable :: zeta!,fgorb
!
G0and = zero
!
L=size(x)
!
Delta = delta_bath_mats(x,vca_bath_)
do i=1,L
G0and(:,:,:,:,:,:,i) = vca_lso2nnn_reshape((x(i) + xmu)*Zeye(Nlat*Nspin*Norb) - vca_nnn2lso_reshape(impHloc - Delta(:,:,:,:,:,:,i),Nlat,Nspin,Norb),Nlat,Nspin,Norb)
enddo
end function invg0_bath_mats_main
!+-----------------------------------------------------------------------------+!
!PURPOSE: G0 non-interacting Green's functions on the real-axis:
!+-----------------------------------------------------------------------------+!
function invg0_bath_real_main(x,vca_bath_) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and,Delta
integer :: iorb,jorb,ispin,jspin,io,jo,Nso,i,L
complex(8),dimension(:,:),allocatable :: zeta!,fgorb
!
G0and = zero
!
L = size(x)
!
Delta = delta_bath_real(x,vca_bath_)
do i=1,L
G0and(:,:,:,:,:,:,i) = vca_lso2nnn_reshape((x(i) + xmu)*Zeye(Nlat*Nspin*Norb) - vca_nnn2lso_reshape(impHloc - Delta(:,:,:,:,:,:,i),Nlat,Nspin,Norb),Nlat,Nspin,Norb)
enddo
! !
end function invg0_bath_real_main
!##################################################################
!
! DELTA FUNCTIONS
! G0 FUNCTIONS
! G0^{-1} FUNCTIONS
! at a point x from real(8),dimension(:) :: bath_array
!
!##################################################################
function delta_bath_mats_main_(x,h_in,v_in) result(Delta)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: Delta
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
logical :: check
call vca_allocate_bath(vca_bath_)
call vca_set_bath(h_in,v_in,vca_bath_)
Delta = delta_bath_mats_main(x,vca_bath_)
call vca_deallocate_bath(vca_bath_)
end function delta_bath_mats_main_
function delta_bath_real_main_(x,h_in,v_in) result(Delta)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: Delta
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
logical :: check
call vca_allocate_bath(vca_bath_)
call vca_set_bath(h_in,v_in,vca_bath_)
Delta = delta_bath_real_main(x,vca_bath_)
call vca_deallocate_bath(vca_bath_)
end function delta_bath_real_main_
function g0and_bath_mats_main_(x,h_in,v_in) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
call vca_allocate_bath(vca_bath_)
call vca_set_bath(h_in,v_in,vca_bath_)
G0and = g0and_bath_mats_main(x,vca_bath_)
call vca_deallocate_bath(vca_bath_)
end function g0and_bath_mats_main_
function g0and_bath_real_main_(x,h_in,v_in) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
call vca_allocate_bath(vca_bath_)
call vca_set_bath(h_in,v_in,vca_bath_)
G0and = g0and_bath_real_main(x,vca_bath_)
call vca_deallocate_bath(vca_bath_)
end function g0and_bath_real_main_
function invg0_bath_mats_main_(x,h_in,v_in) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
call vca_allocate_bath(vca_bath_)
call vca_set_bath(h_in,v_in,vca_bath_)
G0and = invg0_bath_mats_main(x,vca_bath_)
call vca_deallocate_bath(vca_bath_)
end function invg0_bath_mats_main_
function invg0_bath_real_main_(x,h_in,v_in) result(G0and)
complex(8),dimension(:),intent(in) :: x
type(effective_bath) :: vca_bath_
complex(8),dimension(Nlat,Nlat,Nspin,Nspin,Norb,Norb,size(x)) :: G0and
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
call vca_allocate_bath(vca_bath_)
call vca_set_bath(h_in,v_in,vca_bath_)
G0and = invg0_bath_real_main(x,vca_bath_)
call vca_deallocate_bath(vca_bath_)
end function invg0_bath_real_main_
END MODULE VCA_BATH_FUNCTIONS