-
Notifications
You must be signed in to change notification settings - Fork 5
/
wtb_main.f90
364 lines (221 loc) · 9.23 KB
/
wtb_main.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
!############subroutines################
INCLUDE "./subroutines/berry_curvature_subs.f90"
INCLUDE "./subroutines/bse_subs.f90"
INCLUDE "./subroutines/bse_subs_kpath.f90"
INCLUDE "./subroutines/coulomb_pot.f90"
INCLUDE "./subroutines/diel-pp-subs.f90"
INCLUDE "./subroutines/dos_subs.f90"
INCLUDE "./subroutines/general_subs.f90"
INCLUDE "./subroutines/mhkpack_subs.f90"
INCLUDE "./subroutines/module_input_read.f90"
INCLUDE "./subroutines/optics.f90"
INCLUDE "./subroutines/hamiltonian_tb.f90"
INCLUDE "./subroutines/bse_subs_temp.f90"
INCLUDE "./subroutines/pce-subs.f90"
!############subprograms##################
INCLUDE "./subprograms/bands-kpath-tool.f90"
INCLUDE "./subprograms/berry_curvature_bz-tool.f90"
INCLUDE "./subprograms/berry_curvature_kpath-tool.f90"
INCLUDE "./subprograms/bse_diel-tool.f90"
INCLUDE "./subprograms/bse_diel-tool-pol.f90"
INCLUDE "./subprograms/bse_kpath-tool.f90"
INCLUDE "./subprograms/bse_kpath-tool-temp.f90"
#ifdef FAST1
INCLUDE "./subprograms/bse_solver-tool-diel-f.f90"
#else
INCLUDE "./subprograms/bse_solver-tool-diel.f90"
#endif
#ifdef FAST1
INCLUDE "./subprograms/bse_solver-tool-diel-temp-f.f90"
#else
INCLUDE "./subprograms/bse_solver-tool-diel-temp.f90"
#endif
!INCLUDE "./subprograms/bse_solver-tool-pol.f90"
INCLUDE "./subprograms/diel-pp.f90"
INCLUDE "./subprograms/diel-pp-pol.f90"
INCLUDE "./subprograms/diel-pp-bse.f90"
INCLUDE "./subprograms/diel-pp-bse-pol.f90"
INCLUDE "./subprograms/exciton_lifetime.f90"
INCLUDE "./subprograms/sp_diel-tool.f90"
INCLUDE "./subprograms/sp_diel-tool-pol.f90"
INCLUDE "./subprograms/sp_opt_bz-tool.f90"
INCLUDE "./subprograms/sp_solver-tool-diel.f90"
!INCLUDE "./subprograms/sp_solver-tool-pol.f90"
INCLUDE "./subprograms/tdos-tool.f90"
INCLUDE "./subprograms/pce-code.f90"
!ifort tbt_main.f90 -o tbt.x -mkl -qopenmp -shared-intel
program main
use input_variables
use hamiltonian_input_variables
implicit none
integer :: erro
double precision:: t0,tf
integer,dimension(8) :: values,values2
double precision,dimension(3,3) :: rlatv
double precision :: flag
character(len=70) ::cflag
call input_read
OPEN(UNIT=2055, FILE= params,STATUS='old', IOSTAT=erro)
if (erro/=0) stop "Error opening wannier90 hr input file"
read(2055,*) systype
!read(2055,*) ediel(2)
read(2055,*) scs
read(2055,*) efermi
!read(2055,*) lc
read(2055,*) rlatv(1,1),rlatv(1,2),rlatv(1,3)
read(2055,*) rlatv(2,1),rlatv(2,2),rlatv(2,3)
read(2055,*) rlatv(3,1),rlatv(3,2),rlatv(3,3)
if (meshtype .eq. "RK3D") then
call rkmesh(rk,rlatv,ngrid)
else if (meshtype .eq. "RK2D") then
call rkmesh2D(rk,rlatv,ngrid)
else
continue
end if
close(2055)
OPEN(UNIT=2077, FILE= trim(calcparms)//"log.dat",STATUS='unknown', IOSTAT=erro)
if (erro/=0) stop "Error opening log output file "
call param_out(2077,nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,sme,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,bandscalc,doscalc,bse,bsepol,bsekpath,spec,&
spdiel,spdielpol,sppolbz,berryk,berrybz,pponly,bsewf,excwf0,excwff,&
tmcoef,ez,w,lc,r0,sysdim,dtfull,cpol,cshift,dft,bset,bsetbnd,&
st,phavg,temp,ta,pce,ses,ctemp,tmax,eg,egd,egs,ebgs,renorm)
call cpu_time(t0)
call date_and_time(VALUES=values)
write(2077,*)
write(2077,*) 'Begin',' ','day',values(3),'',values(5),'hours',values(6),'min',values(7),'seg'
write(2077,*)
!nthreads,outputfolder,calcparms,ngrid,nc,nv,edos0,edosf,numdos, &
!ebse0,ebsef,numbse,sme,ktol,params,kpaths,kpathsbse,orbw,ediel, &
!exc,mshift,coultype
!systype,efermi,edielh,lc,scs,rlat,w90basis
!hopmatrices,ihopmatrices,rvec,ffactor,nvec
!calculo estrutura eletronica
if (pponly) go to 131
if (bandscalc) then
call bandstool(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,sme,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,rk,dft)
write(2077,*) "Band Structure finished"
call flush(2077)
end if
if (doscalc) then
call dostool(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,sme,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,rk,meshtype,dft)
write(2077,*) "DOS finished"
call flush(2077)
end if
!calculo optica
if (bse .and. bset) then
write(2077,*) "ERROR: Choose BSE=T or BSET=T not both"
stop
elseif (bse) then
call bsesolver(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,cshift,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,ez,w,r0,lc,rk,meshtype,bsewf,excwf0,excwff,dtfull,cpol,tmcoef)
write(2077,*) "BSE and Single particle dielectric calculation finished"
call flush(2077)
elseif (bset) then
call bsesolvertemp(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,cshift,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,ez,w,r0,lc,rk,meshtype,bsewf,excwf0,excwff,dtfull,&
cpol,tmcoef,st,phavg,ta,temp)
write(2077,*) "BSE and Single particle dielectric calculation, with temperature, finished"
call flush(2077)
end if
if (bsekpath .and. bsetbnd) then
write(2077,*) "ERROR: Choose BSE_BND=T or BSET_BND=T not both"
stop
elseif (bsekpath) then
call bsebnds(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,sme,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,ez,w,r0,lc,rk,meshtype,bsewf,excwf0,excwff)
write(2077,*) "BSE exciton band structure finished"
call flush(2077)
elseif (bsetbnd) then
call bsebndstemp(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,sme,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,ez,w,r0,lc,rk,meshtype,bsewf,excwf0,excwff,&
st,phavg,ta,temp)
write(2077,*) "BSE exciton band structure, with temperature, finished"
call flush(2077)
end if
if (spdiel) then
call spoptics(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,cshift,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,rk,meshtype,tmcoef)
write(2077,*) "Single particle dielectric calculation finished"
call flush(2077)
end if
if (sppolbz) then
call spoptpolbz(nthreads,outputfolder,calcparms,ngrid,nc,nv,numdos, &
ebse0,ebsef,numbse,cshift,ktol,params,kpaths,kpathsbse,orbw,ediel, &
exc,mshift,coultype,rk,meshtype)
write(2077,*) "Single particle optical activity in BZ finished"
call flush(2077)
end if
!calculo curvatura de berry
if (berryk) then
call berrycurv(nthreads,outputfolder,params,kpaths,sme)
write(2077,*) "Berry curvature in kpath finished"
call flush(2077)
end if
if (berrybz) then
call berrycurvbz(nthreads,outputfolder,params,sme,ngrid,mshift)
write(2077,*) "Berry curvature in BZ finished"
call flush(2077)
end if
131 continue
!calculo espectro
if ((spec) .and. (bse .or. bset)) then
call bsedielraw(nthreads,outputfolder,renorm,params,ngrid,nc,nv,ebse0,ebsef,numbse,cshift) !calculate dielectric constants with BSE
call bseoptprop(numbse,outputfolder) !calculate abs coeficient and other properties with BSE
if (bset) then
continue
else
call lifetime(sysdim,numbse,ngrid,rlat,nc,nv,outputfolder)
end if
write(2077,*) "BSE dielectric properties calculated"
call flush(2077)
if (cpol) then
call bsedielrawpol(nthreads,outputfolder,renorm,params,ngrid,nc,nv,ebse0,ebsef,numbse,cshift) !calculate dielectric constants with BSE for different light polarization
call bseoptproppol(numbse,outputfolder) !calculate abs coeficient and other properties with BSE
if (bset) then
continue
else
call lifetimepol(sysdim,numbse,ngrid,rlat,nc,nv,outputfolder)
end if
write(2077,*) "BSE absorption spectrum with light polarization calculated"
call flush(2077)
end if
end if
if ((spec) .and. ((spdiel) .or. (bse .or. bset) )) then
call spdielraw(nthreads,outputfolder,renorm,params,ngrid,nc,nv,ebse0,ebsef,numbse,cshift) !calculate dielectric constants
call spoptprop(numbse,outputfolder) !calculate abs coeficient and other properties
write(2077,*) "Single particle dielectric properties calculated"
call flush(2077)
end if
if ((spec) .and. ((cpol) .or. (bse .or. bset) )) then
call spdielrawpol(nthreads,outputfolder,renorm,params,ngrid,nc,nv,ebse0,ebsef,numbse,cshift) !calculate dielectric constants different light polarizations
call spoptproppol(numbse,outputfolder) !calculate abs coeficient and other properties
write(2077,*) "Single particle absorption spectrum with light polarization calculated"
call flush(2077)
end if
if (pce) then
call pcecalc(outputfolder,numbse,"IPA",ctemp,ses,tmax,eg,egd)
write(2077,*) "PCE with single particle absortion spectrum"
call flush(2077)
call pcecalc(outputfolder,numbse,"BSE",ctemp,ses,tmax,egs,ebgs)
write(2077,*) "PCE with excitonic effects (BSE)"
call flush(2077)
end if
call cpu_time(tf)
call date_and_time(VALUES=values2)
write(2077,*)
write(2077,*) 'End',' ','day',values2(3),'',values2(5),'hours',values2(6),'min',values2(7),'seg'
write(2077,*)
!write(2077,*) "Total Time:",(tf-t0)/nthreads,"s"
close(2077)
end program main