-
Notifications
You must be signed in to change notification settings - Fork 0
/
vasp_gap_vbm-finder-hse.f90
197 lines (110 loc) · 2.94 KB
/
vasp_gap_vbm-finder-hse.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
!programa para achar o bandgap
!gfortran vasp_gap_vbm-finder-hse.f90 -o gapf_h.x
!gapf_h.x 30 , 30 numero de pontos k com peso diferente de zero
program main
implicit none
integer :: nbands,nkpts
integer :: erro
integer :: i,j
double precision :: flag
double precision,allocatable,dimension(:,:) :: kpt
integer,allocatable,dimension(:) :: nocp
double precision,allocatable,dimension(:,:,:) :: energy
double precision :: gapdir,cbm,vbm
integer :: cbmkpt,vbmkpt,gapdirkpt
double precision :: gaux,vaux,caux
double precision,parameter :: ocptol=0.05
!variaveis getarg
character*30 arg
integer ios
! INPUT : lendo os parametros do modelo de tight-binding
OPEN(UNIT=100, FILE= "EIGENVAL",STATUS='old', IOSTAT=erro)
if (erro/=0) stop "Erro na abertura do arquivo de entrada 1"
! OUTPUT : lendo os parametros do modelo de tight-binding
OPEN(UNIT=200, FILE= "gap_vasp.dat",STATUS='unknown', IOSTAT=erro)
if (erro/=0) stop "Erro na abertura do arquivo de saida 1"
CALL getarg(1, arg)
read(arg,*,iostat=ios) nkpts
!CALL getarg(2, arg)
! read(arg,*,iostat=ios) nkpts
!nbands=20
!nkpts=27
do i=1,5
read(100,*)
end do
read(100,*) flag,flag,nbands
allocate(kpt(nkpts,3),nocp(nkpts),energy(nkpts,nbands,2))
!lendo os valores de energia nos pontos k
do i=1,nkpts
read(100,*) kpt(i,1),kpt(i,2),kpt(i,3),flag
do j=1,nbands
read(100,*) flag,energy(i,j,1),energy(i,j,2)
end do
end do
!termino da leitura
!identificando a primeira banda desocupada de cada ponto k
do i=1,nkpts
do j=1,nbands
if (energy(i,j,2) .lt. 1.0) then
nocp(i)=j
go to 50
else
continue
end if
end do
50 continue
end do
!termino
gapdir=500
cbm=500
vbm=-500
!calculando os gaps
!teste metalico
do i=1,nkpts
if ( (energy(i,nocp(i),2) .gt. 0.0) .and. (energy(i,nocp(i),2) .lt. 1.0-ocptol)) then
go to 70
else
continue
end if
end do
!fim teste metalico
cbmkpt=1
vbmkpt=1
gapdirkpt=1
do i=1,nkpts
if (energy(i,nocp(i),1) .lt. cbm) then
cbm=energy(i,nocp(i),1)
cbmkpt=i
else
continue
end if
if (energy(i,nocp(i)-1,1) .gt. vbm) then
vbm=energy(i,nocp(i)-1,1)
vbmkpt=i
else
continue
end if
gaux=energy(i,nocp(i),1)-energy(i,nocp(i)-1,1)
if (gaux .lt. gapdir) then
gapdir=gaux
gapdirkpt=i
else
end if
end do
write(200,*) "gap direto:",real(gapdir)
write(200,*) "gap indireto", real(cbm-vbm)
write(200,*)
write(200,*) "cbm", real(cbm)
write(200,*) "vbm", real(vbm)
write(200,*)
write(200,*) "ponto k cbm:",real(kpt(cbmkpt,1)),real(kpt(cbmkpt,2)),real(kpt(cbmkpt,3))
write(200,*) "ponto k vbm:",real(kpt(vbmkpt,1)),real(kpt(vbmkpt,2)),real(kpt(vbmkpt,3))
write(200,*)
write(200,*) "ponto k gap direto:",real(kpt(gapdirkpt,1)),real(kpt(gapdirkpt,2)),real(kpt(gapdirkpt,3))
go to 60
70 write(200,*) "sistema metalico"
60 continue
deallocate(kpt,nocp,energy)
close(100)
close(200)
end program main