forked from QcmPlab/CDMFT-LANC-ED
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathED_IO.f90
518 lines (408 loc) · 17.1 KB
/
ED_IO.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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
MODULE ED_IO
USE ED_INPUT_VARS
USE ED_VARS_GLOBAL
USE ED_AUX_FUNX
USE ED_BATH
USE ED_BATH_FUNCTIONS
USE SF_LINALG
USE SF_ARRAYS, only: linspace,arange
USE SF_IOTOOLS, only: str,reg,free_unit,splot,sread
implicit none
private
!Retrieve self-energy through routines:
interface ed_get_sigma_matsubara
module procedure ed_get_sigma_matsubara_1
module procedure ed_get_sigma_matsubara_2
! module procedure ed_get_sigma_matsubara_lattice_1
! module procedure ed_get_sigma_matsubara_lattice_2
end interface ed_get_sigma_matsubara
interface ed_get_sigma_realaxis
module procedure ed_get_sigma_real_1
module procedure ed_get_sigma_real_2
! module procedure ed_get_sigma_real_lattice_1
! module procedure ed_get_sigma_real_lattice_2
end interface ed_get_sigma_realaxis
!Retrieve imp GF through routines.
interface ed_get_gimp_matsubara
module procedure ed_get_gimp_matsubara_1
module procedure ed_get_gimp_matsubara_2
! module procedure ed_get_gimp_matsubara_lattice_1
! module procedure ed_get_gimp_matsubara_lattice_2
end interface ed_get_gimp_matsubara
interface ed_get_gimp_realaxis
module procedure ed_get_gimp_real_1
module procedure ed_get_gimp_real_2
!module procedure ed_get_gimp_real_lattice_1
!module procedure ed_get_gimp_real_lattice_2
end interface ed_get_gimp_realaxis
!Retrieve imp GF_0 (G0_and) through routines.
interface ed_get_g0imp_matsubara
module procedure ed_get_g0imp_matsubara_1
module procedure ed_get_g0imp_matsubara_2
! module procedure ed_get_g0imp_matsubara_lattice_1
! module procedure ed_get_g0imp_matsubara_lattice_2
end interface ed_get_g0imp_matsubara
interface ed_get_g0imp_realaxis
module procedure ed_get_g0imp_real_1
module procedure ed_get_g0imp_real_2
! module procedure ed_get_g0imp_real_lattice_1
! module procedure ed_get_g0imp_real_lattice_2
end interface ed_get_g0imp_realaxis
interface ed_get_delta_matsubara
module procedure delta_bath_main_
end interface ed_get_delta_matsubara
interface ed_get_delta_realaxis
module procedure delta_bath_main_ !mats is the same as real
end interface ed_get_delta_realaxis
interface ed_get_g0and_matsubara
module procedure g0and_bath_main_
end interface ed_get_g0and_matsubara
interface ed_get_g0and_realaxis
module procedure g0and_bath_main_
end interface ed_get_g0and_realaxis
interface ed_get_invg0and_matsubara
module procedure invg0_bath_main_
end interface ed_get_invg0and_matsubara
interface ed_get_invg0and_realaxis
module procedure invg0_bath_main_
end interface ed_get_invg0and_realaxis
!Retrieve static common observables
interface ed_get_dens
module procedure ed_get_dens_1
module procedure ed_get_dens_2
! module procedure ed_get_dens_lattice_1
! module procedure ed_get_dens_lattice_2
end interface ed_get_dens
interface ed_get_mag
module procedure ed_get_mag_1
module procedure ed_get_mag_2
! module procedure ed_get_mag_lattice_1
! module procedure ed_get_mag_lattice_2
end interface ed_get_mag
interface ed_get_docc
module procedure ed_get_docc_1
module procedure ed_get_docc_2
! module procedure ed_get_docc_lattice_1
! module procedure ed_get_docc_lattice_2
end interface ed_get_docc
interface ed_get_epot
module procedure :: ed_get_epot_
! module procedure :: ed_get_epot_lattice
end interface ed_get_epot
interface ed_get_eint
module procedure :: ed_get_eint_
! module procedure :: ed_get_eint_lattice
end interface ed_get_eint
interface ed_get_ehartree
module procedure :: ed_get_ehartree_
! module procedure :: ed_get_ehartree_lattice
end interface ed_get_ehartree
interface ed_get_eknot
module procedure :: ed_get_eknot_
! module procedure :: ed_get_eknot_lattice
end interface ed_get_eknot
interface ed_get_dust
module procedure :: ed_get_dust_
! module procedure :: ed_get_dust_lattice
end interface ed_get_dust
interface ed_get_dund
module procedure :: ed_get_dund_
! module procedure :: ed_get_dund_lattice
end interface ed_get_dund
interface ed_get_dse
module procedure :: ed_get_dse_
! module procedure :: ed_get_dse_lattice
end interface ed_get_dse
interface ed_get_dph
module procedure :: ed_get_dph_
! module procedure :: ed_get_dph_lattice
end interface ed_get_dph
! interface ed_get_density_matrix
! module procedure :: ed_get_density_matrix_single
! ! module procedure :: ed_get_density_matrix_lattice
! end interface ed_get_density_matrix
interface ed_gf_cluster
module procedure :: ed_gf_cluster_scalar
module procedure :: ed_gf_cluster_array
end interface ed_gf_cluster
public :: ed_get_sigma_matsubara
public :: ed_get_sigma_realaxis
public :: ed_get_gimp_matsubara
public :: ed_get_gimp_realaxis
public :: ed_get_g0imp_matsubara
public :: ed_get_g0imp_realaxis
public :: ed_get_delta_matsubara
public :: ed_get_delta_realaxis
public :: ed_get_g0and_matsubara
public :: ed_get_g0and_realaxis
public :: ed_get_invG0and_matsubara
public :: ed_get_invG0and_realaxis
public :: ed_gf_cluster
public :: ed_get_dens
public :: ed_get_mag
public :: ed_get_docc
public :: ed_get_epot
public :: ed_get_eint
public :: ed_get_ehartree
public :: ed_get_eknot
public :: ed_get_dust
public :: ed_get_dund
public :: ed_get_dse
public :: ed_get_dph
! public :: ed_get_density_matrix
public :: ed_read_impSigma
public :: ed_read_impG
!****************************************************************************************!
!****************************************************************************************!
public :: ed_print_impSigma
public :: ed_print_impG
public :: ed_print_impG0
! public :: ed_print_impChi
!****************************************************************************************!
!****************************************************************************************!
!Frequency and time arrays:
!=========================================================
real(8),dimension(:),allocatable :: wm,tau,wr,vm
character(len=64) :: suffix
contains
!+--------------------------------------------------------------------------+!
! PURPOSE: Retrieve measured values of the impurity functions
!+--------------------------------------------------------------------------+!
include "ED_IO/get_sigma_matsubara.f90"
include "ED_IO/get_sigma_realaxis.f90"
include "ED_IO/get_gimp_matsubara.f90"
include "ED_IO/get_gimp_realaxis.f90"
include "ED_IO/get_g0imp_matsubara.f90"
include "ED_IO/get_g0imp_realaxis.f90"
include "ED_IO/get_Gand_all.f90"
include "ED_IO/gf_cluster.f90"
!+--------------------------------------------------------------------------+!
! PURPOSE: Retrieve measured values of the local observables
!+--------------------------------------------------------------------------+!
include "ED_IO/get_dens.f90"
include "ED_IO/get_mag.f90"
include "ED_IO/get_docc.f90"
include "ED_IO/get_eimp.f90"
include "ED_IO/get_doubles.f90"
!
! include "ED_IO/get_imp_dm.f90"
!+------------------------------------------------------------------+
! PRINT SIGMA:
!+------------------------------------------------------------------+
subroutine ed_print_impSigma
character(len=64) :: suffix
integer :: ilat,jlat,iorb,jorb,ispin
!
if(.not.allocated(wm))allocate(wm(Lmats))
if(.not.allocated(wr))allocate(wr(Lreal))
wm = pi/beta*real(2*arange(1,Lmats)-1,8)
wr = linspace(wini,wfin,Lreal)
!Print the impurity Sigma:
do ilat=1,Nlat
do jlat=1,Nlat
do iorb=1,Norb
do jorb=1,Norb
do ispin=1,Nspin
suffix="_Isite"//str(ilat,4)//"_Jsite"//str(jlat,4)//"_l"//str(iorb)//str(jorb)//"_s"//str(ispin)
call splot("impSigma"//reg(suffix)//"_iw"//reg(ed_file_suffix)//".ed" ,wm,impSmats(ilat,jlat,ispin,ispin,iorb,jorb,:))
call splot("impSigma"//reg(suffix)//"_realw"//reg(ed_file_suffix)//".ed",wr,impSreal(ilat,jlat,ispin,ispin,iorb,jorb,:))
enddo
enddo
enddo
enddo
enddo
!
if(allocated(wm))deallocate(wm)
if(allocated(wr))deallocate(wr)
end subroutine ed_print_impSigma
!+------------------------------------------------------------------+
! PRINT G
!+------------------------------------------------------------------+
subroutine ed_print_impG
character(len=64) :: suffix
integer :: ilat,jlat,iorb,ispin,jorb
!
!
if(.not.allocated(wm))allocate(wm(Lmats))
if(.not.allocated(wr))allocate(wr(Lreal))
wm = pi/beta*real(2*arange(1,Lmats)-1,8)
wr = linspace(wini,wfin,Lreal)
!
do ilat=1,Nlat
do jlat=1,Nlat
do iorb=1,Norb
do jorb=1,Norb
do ispin=1,Nspin
suffix="_Isite"//str(ilat,4)//"_Jsite"//str(jlat,4)//"_l"//str(iorb)//str(jorb)//"_s"//str(ispin)
call splot("impG"//reg(suffix)//"_iw"//reg(ed_file_suffix)//".ed" ,wm,impGmats(ilat,jlat,ispin,ispin,iorb,jorb,:))
call splot("impG"//reg(suffix)//"_realw"//reg(ed_file_suffix)//".ed",wr,impGreal(ilat,jlat,ispin,ispin,iorb,jorb,:))
enddo
enddo
enddo
enddo
enddo
!
if(allocated(wm))deallocate(wm)
if(allocated(wr))deallocate(wr)
!
end subroutine ed_print_impG
!+------------------------------------------------------------------+
! PRINT G0
!+------------------------------------------------------------------+
subroutine ed_print_impG0
character(len=64) :: suffix
integer :: ilat,jlat,iorb,ispin,jorb
!
if(.not.allocated(wm))allocate(wm(Lmats))
if(.not.allocated(wr))allocate(wr(Lreal))
wm = pi/beta*real(2*arange(1,Lmats)-1,8)
wr = linspace(wini,wfin,Lreal)
!
do ilat=1,Nlat
do jlat=1,Nlat
do iorb=1,Norb
do jorb=1,Norb
do ispin=1,Nspin
suffix="_Isite"//str(ilat,4)//"_Jsite"//str(jlat,4)//"_l"//str(iorb)//str(jorb)//"_s"//str(ispin)
call splot("impG0"//reg(suffix)//"_iw"//reg(ed_file_suffix)//".ed" ,wm,impG0mats(ilat,jlat,ispin,ispin,iorb,jorb,:))
call splot("impG0"//reg(suffix)//"_realw"//reg(ed_file_suffix)//".ed",wr,impG0real(ilat,jlat,ispin,ispin,iorb,jorb,:))
enddo
enddo
enddo
enddo
enddo
!
if(allocated(wm))deallocate(wm)
if(allocated(wr))deallocate(wr)
!
end subroutine ed_print_impG0
!+------------------------------------------------------------------+
! ! PRINT CHI:
! !+------------------------------------------------------------------+
! subroutine ed_print_impChi
! call print_chi_spin
! call print_chi_dens
! call print_chi_dens_mix
! call print_chi_dens_tot
! call print_chi_pair
! end subroutine ed_print_impChi
! ! SPIN-SPIN
! subroutine print_chi_spin
! integer :: i,iorb
! integer :: unit(3)
! do iorb=1,Norb
! call splot("spinChi_l"//str(iorb)//"_tau"//reg(ed_file_suffix)//".ed",tau,spinChi_tau(iorb,0:))
! call splot("spinChi_l"//str(iorb)//"_realw"//reg(ed_file_suffix)//".ed",wr,spinChi_w(iorb,:))
! call splot("spinChi_l"//str(iorb)//"_iw"//reg(ed_file_suffix)//".ed",vm,spinChi_iv(iorb,:))
! enddo
! if(Norb>1)then
! iorb=Norb+1
! call splot("spinChi_tot"//str(iorb)//"_tau"//reg(ed_file_suffix)//".ed",tau,spinChi_tau(iorb,0:))
! call splot("spinChi_tot"//str(iorb)//"_realw"//reg(ed_file_suffix)//".ed",wr,spinChi_w(iorb,:))
! call splot("spinChi_tot"//str(iorb)//"_iw"//reg(ed_file_suffix)//".ed",vm,spinChi_iv(iorb,:))
! endif
! end subroutine print_chi_spin
! ! DENSITY-DENSITY
! subroutine print_chi_dens
! integer :: i,j,iorb,jorb
! integer :: unit(3),unit_mix
! do iorb=1,Norb
! do jorb=iorb,Norb
! call splot("densChi_l"//str(iorb)//str(jorb)//"_tau"//reg(ed_file_suffix)//".ed",tau,densChi_tau(iorb,jorb,0:))
! call splot("densChi_l"//str(iorb)//str(jorb)//"_realw"//reg(ed_file_suffix)//".ed",wr,densChi_w(iorb,jorb,:))
! call splot("densChi_l"//str(iorb)//str(jorb)//"_iw"//reg(ed_file_suffix)//".ed",vm,densChi_iv(iorb,jorb,:))
! enddo
! enddo
! end subroutine print_chi_dens
! subroutine print_chi_dens_mix
! integer :: i,j,iorb,jorb
! integer :: unit(3),unit_mix
! do iorb=1,Norb
! do jorb=1,Norb
! call splot("densChi_mix_l"//str(iorb)//str(jorb)//"_tau"//reg(ed_file_suffix)//".ed",tau,densChi_mix_tau(iorb,jorb,0:))
! call splot("densChi_mix_l"//str(iorb)//str(jorb)//"_realw"//reg(ed_file_suffix)//".ed",wr,densChi_mix_w(iorb,jorb,:))
! call splot("densChi_mix_l"//str(iorb)//str(jorb)//"_iw"//reg(ed_file_suffix)//".ed",vm,densChi_mix_iv(iorb,jorb,:))
! enddo
! enddo
! end subroutine print_chi_dens_mix
! subroutine print_chi_dens_tot
! integer :: i,j,iorb,jorb
! integer :: unit(3),unit_mix
! call splot("densChi_tot_tau"//reg(ed_file_suffix)//".ed",tau,densChi_tot_tau(0:))
! call splot("densChi_tot_realw"//reg(ed_file_suffix)//".ed",wr,densChi_tot_w(:))
! call splot("densChi_tot_iw"//reg(ed_file_suffix)//".ed",vm,densChi_tot_iv(:))
! end subroutine print_chi_dens_tot
! ! PAIR
! subroutine print_chi_pair
! integer :: i,iorb
! integer :: unit(3)
! do iorb=1,Norb
! call splot("pairChi_orb"//str(iorb)//"_tau"//reg(ed_file_suffix)//".ed",tau,pairChi_tau(iorb,0:))
! call splot("pairChi_orb"//str(iorb)//"_realw"//reg(ed_file_suffix)//".ed",wr,pairChi_w(iorb,:))
! call splot("pairChi_orb"//str(iorb)//"_iw"//reg(ed_file_suffix)//".ed",vm,pairChi_iv(iorb,:))
! enddo
! end subroutine print_chi_pair
! PURPOSE: Read self-energy function(s) - also for inequivalent sites.
!+-----------------------------------------------------------------------------+!
subroutine ed_read_impSigma
integer :: i,ispin,isign,unit(2),iorb,jorb,ilat,jlat
character(len=30) :: suffix
integer,dimension(:),allocatable :: getIorb,getJorb
integer :: totNorb,l
!
if(.not.allocated(wm))allocate(wm(Lmats))
if(.not.allocated(wr))allocate(wr(Lreal))
wm = pi/beta*real(2*arange(1,Lmats)-1,8)
wr = linspace(wini,wfin,Lreal)
!
!!
!Print the impurity functions:
do ispin=1,Nspin
do ilat=1,Nlat
do jlat=1,Nlat
do iorb=1,Norb
do jorb=1,Norb
suffix="_Isite"//str(ilat,4)//"_Jsite"//str(jlat,4)//"_l"//str(iorb)//str(jorb)//"_s"//str(ispin)
call sread("impSigma"//reg(suffix)//"_iw"//reg(ed_file_suffix)//".ed" ,wm,impSmats(ilat,jlat,ispin,ispin,iorb,jorb,:))
call sread("impSigma"//reg(suffix)//"_realw"//reg(ed_file_suffix)//".ed",wr,impSreal(ilat,jlat,ispin,ispin,iorb,jorb,:))
enddo
enddo
enddo
enddo
enddo
!
if(allocated(wm))deallocate(wm)
if(allocated(wr))deallocate(wr)
!
end subroutine ed_read_impSigma
subroutine ed_read_impG
integer :: i,ispin,isign,unit(2),iorb,jorb,ilat,jlat
character(len=30) :: suffix
integer,dimension(:),allocatable :: getIorb,getJorb
integer :: totNorb,l
!
if(.not.allocated(wm))allocate(wm(Lmats))
if(.not.allocated(wr))allocate(wr(Lreal))
wm = pi/beta*real(2*arange(1,Lmats)-1,8)
wr = linspace(wini,wfin,Lreal)
!
!Print the impurity functions:
do ispin=1,Nspin
do ilat=1,Nlat
do jlat=1,Nlat
do iorb=1,Norb
do jorb=1,Norb
suffix="_Isite"//str(ilat,4)//"_Jsite"//str(jlat,4)//"_l"//str(iorb)//str(jorb)//"_s"//str(ispin)
call sread("impG"//reg(suffix)//"_iw"//reg(ed_file_suffix)//".ed" ,wm,impGmats(ilat,jlat,ispin,ispin,iorb,jorb,:))
call sread("impG"//reg(suffix)//"_realw"//reg(ed_file_suffix)//".ed",wr,impGreal(ilat,jlat,ispin,ispin,iorb,jorb,:))
enddo
enddo
enddo
enddo
enddo
!
if(allocated(wm))deallocate(wm)
if(allocated(wr))deallocate(wr)
!
end subroutine ed_read_impG
END MODULE ED_IO