-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVCA_BATH_SETUP.f90
185 lines (154 loc) · 6.29 KB
/
VCA_BATH_SETUP.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
MODULE VCA_BATH_SETUP
USE SF_CONSTANTS, only: zero
USE SF_IOTOOLS, only:free_unit,reg,file_length,txtfy
USE SF_LINALG, only: eye,inv
USE SF_MISC, only: assert_shape
USE VCA_INPUT_VARS
USE VCA_VARS_GLOBAL
use VCA_AUX_FUNX
implicit none
private
!##################################################################
!
! VCA BATH ROUTINES:
!
!##################################################################
!VCA BATH procedures:
public :: vca_allocate_bath !INTERNAL (for effective_bath)
public :: vca_deallocate_bath !INTERNAL (for effective_bath)
public :: vca_init_bath !INTERNAL (for effective_bath)
public :: vca_set_bath !INTERNAL (for effective_bath)
public :: vca_write_bath !INTERNAL (for effective_bath)
contains
!##################################################################
!
! USER BATH ROUTINES:
!
!##################################################################
!##################################################################
!
! VCA BATH ROUTINES:
!
!##################################################################
!+-------------------------------------------------------------------+
!PURPOSE : Allocate the VCA bath
!+-------------------------------------------------------------------+
subroutine vca_allocate_bath(vca_bath_)
type(effective_bath) :: vca_bath_
!
if(vca_bath_%status)call vca_deallocate_bath(vca_bath_)
!
!
! select case(bath_type)
! case default!normal_normal
!
allocate(vca_bath_%h(Nlat_bath,Nlat_bath,Nspin,Nspin,Norb_bath,Norb_bath))
allocate(vca_bath_%v(Nlat,Nlat_bath,Nspin,Nspin,Norb,Norb_bath)) !vertical rectangular
!
vca_bath_%h=0d0
vca_bath_%v=0d0
vca_bath_%status=.true.
end subroutine vca_allocate_bath
!+-------------------------------------------------------------------+
!PURPOSE : Deallocate the VCA bath
!+-------------------------------------------------------------------+
subroutine vca_deallocate_bath(vca_bath_)
type(effective_bath) :: vca_bath_
if(allocated(vca_bath_%h)) deallocate(vca_bath_%h)
if(allocated(vca_bath_%v)) deallocate(vca_bath_%v)
vca_bath_%status=.false.
end subroutine vca_deallocate_bath
!+------------------------------------------------------------------+
!PURPOSE : Initialize the VCA loop, builindg H parameters and/or
!reading previous (converged) solution
!+------------------------------------------------------------------+
subroutine vca_init_bath(vca_bath_)
type(effective_bath) :: vca_bath_
integer :: i,unit,flen,Nh
integer :: io,jo,ispin,iorb,jorb,jspin,ilat
logical :: IOfile
real(8) :: de,hwband
character(len=21) :: space
!
hwband=1d0
!
if(.not.vca_bath_%status)stop "vca_init_bath error: bath not allocated"
!
!
vca_bath_%h = 1d0
vca_bath_%v = 0d0
!
!
end subroutine vca_init_bath
!+-------------------------------------------------------------------+
!PURPOSE : set the bath components from a given user provided
! bath-array
!+-------------------------------------------------------------------+
subroutine vca_set_bath(h_in,v_in,vca_bath_)
complex(8),dimension(:,:,:,:,:,:) :: h_in, v_in
type(effective_bath) :: vca_bath_
integer :: ilat,ispin,iorb
!
call assert_shape(h_in,[Nlat_bath,Nlat_bath,Nspin,Nspin,Norb_bath,Norb_bath],"print_Hcluster_nnn","Hloc")
call assert_shape(v_in,[Nlat,Nlat_bath,Nspin,Nspin,Norb,Norb_bath],"print_Hcluster_nnn","Hloc")
!
if(.not.vca_bath_%status)stop "set_vca_bath error: bath not allocated"
!
!
!
vca_bath_%h = h_in
vca_bath_%v = v_in
!
if(hfmode)then
do ilat=1,Nlat_bath
do iorb=1,Norb_bath
do ispin=1,Nspin
if( .not. hfshift) vca_bath_%h(ilat,ilat,ispin,ispin,iorb,iorb) = &
vca_bath_%h(ilat,ilat,ispin,ispin,iorb,iorb)-(0.5d0*Uloc(iorb)+0.5d0*Ust*(Norb-1)+0.5d0*(Ust-Jh)*(Norb-1))
enddo
enddo
enddo
endif
!
end subroutine vca_set_bath
!+-------------------------------------------------------------------+
!PURPOSE : pretty print
!+-------------------------------------------------------------------+
subroutine vca_write_bath(vca_bath_)
integer :: unit_
type(effective_bath) :: vca_bath_
integer :: ibath
integer :: io,jo,iorb,ispin,isym
complex(8) :: hrep_aux(Nlat_bath*Nspin*Norb_bath,Nlat_bath*Nspin*Norb_bath)
complex(8) :: vrep_aux(Nlat*Nspin*Norb,Nlat_bath*Nspin*Norb_bath)
character(len=64) :: string_fmt,string_fmt_first
!
unit_=LOGfile
if(.not.vca_bath_%status)stop "write_dmft_bath error: bath not allocated"
!
string_fmt="(a5,"//str(Nlat_bath*Nspin*Norb_bath)//"(F8.4,1X),a5,"//str(Nlat_bath*Nspin*Norb_bath)//"(F8.4,1X))"
!
if(Nlat*Nspin*Norb.le.8)then
write(unit_,"(A1)")" "
write(unit_,"(90(A36,1X))")"Re(H_ib_jb) | Im(H_ib_jb)"
write(unit_,"(A1)")" "
Hrep_aux=vca_nnn2lso_reshape(vca_bath_%h,Nlat_bath,Nspin,Norb_bath)
do io=1,Nlat_bath*Nspin*Norb_bath
write(unit_,string_fmt) " " ,(DREAL(hrep_aux(io,jo)),jo=1,Nlat_bath*Nspin*Norb_bath),&
"| ",(DIMAG(hrep_aux(io,jo)),jo=1,Nlat_bath*Nspin*Norb_bath)
enddo
write(unit_,"(A1)")" "
write(unit_,"(90(A34,1X))")"Re(V_i_jb) | Im(V_i_jb)"
write(unit_,"(A1)")" "
vrep_aux=vca_rectangular_n2j_reshape(vca_bath_%v,Nlat,Nlat_bath,Nspin,Nspin,Norb,Norb_bath)
do io=1,Nlat*Nspin*Norb
write(unit_,string_fmt) " " ,(DREAL(vrep_aux(io,jo)),jo=1,Nlat_bath*Nspin*Norb_bath),&
"| ",(DIMAG(vrep_aux(io,jo)),jo=1,Nlat_bath*Nspin*Norb_bath)
enddo
write(unit_,"(A1)")" "
else
write(LOGfile,"(A)")"Bath matrix too large to print"
endif
!
end subroutine vca_write_bath
END MODULE VCA_BATH_SETUP