The Elk Code
 
Loading...
Searching...
No Matches
occupyuv.f90
Go to the documentation of this file.
1
2! Copyright (C) 2019 J. K. Dewhurst and S. Sharma.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6subroutine occupyuv
7use modmain
8use modbog
9use modmpi
10implicit none
11integer ik,ist
12real(8) chg,w,vn
13real(8) e0,e1,e,t1
14! determine the total charge and fermionic anomalous correlation entropy
15chg=0.d0
16face=0.d0
17do ik=1,nkpt
18 w=wkpt(ik)
19 do ist=1,nstsv
20 vn=vnorm(ist,ik)
21 chg=chg+w*vn
22 if ((vn > 0.d0).and.(vn < 1.d0)) then
23 face=face+w*(vn*log(vn)+(1.d0-vn)*log(1.d0-vn))
24 end if
25 end do
26end do
27chg=occmax*chg
29! adjust the Fermi energy
31if (mp_mpi) then
32 if (abs(chg-chgval) > epschg) then
33 write(*,*)
34 write(*,'("Warning(occupyuv): incorrect charge : ",2G18.10)') chg,chgval
35 end if
36end if
37! estimate the indirect band gap
38e0=-1.d8
39e1=1.d8
40ikgap(1)=1
41ikgap(2)=1
42do ist=1,nstsv
43 do ik=1,nkpt
44 e=evaluv(ist,ik)
45 if (vnorm(ist,ik) > 0.5d0) e=-e
46 if (e <= 0.d0) then
47 if (e > e0) then
48 e0=e
49 ikgap(1)=ik
50 end if
51 else
52 if (e < e1) then
53 e1=e
54 ikgap(2)=ik
55 end if
56 end if
57 end do
58end do
59bandgap(1)=e1-e0
60! estimate the direct band gap
61e=1.d8
62ikgap(3)=1
63do ik=1,nkpt
64 e0=-1.d8
65 e1=1.d8
66 do ist=1,nstsv
67 t1=evaluv(ist,ik)
68 if (vnorm(ist,ik) > 0.5d0) t1=-t1
69 if (t1 <= 0.d0) then
70 if (t1 > e0) e0=t1
71 else
72 if (t1 < e1) e1=t1
73 end if
74 end do
75 t1=e1-e0
76 if (t1 < e) then
77 e=t1
78 ikgap(3)=ik
79 end if
80end do
81bandgap(2)=e
82end subroutine
83
real(8) tauefm
Definition modbog.f90:19
real(8) face
Definition modbog.f90:27
real(8), dimension(:,:), allocatable evaluv
Definition modbog.f90:15
real(8), dimension(:,:), allocatable vnorm
Definition modbog.f90:17
real(8), dimension(:), allocatable wkpt
Definition modmain.f90:475
real(8) efermi
Definition modmain.f90:904
real(8) chgval
Definition modmain.f90:722
integer, dimension(3) ikgap
Definition modmain.f90:914
real(8), dimension(2) bandgap
Definition modmain.f90:912
integer nkpt
Definition modmain.f90:461
integer nstsv
Definition modmain.f90:886
real(8) epschg
Definition modmain.f90:712
real(8) occmax
Definition modmain.f90:898
logical mp_mpi
Definition modmpi.f90:17
subroutine occupyuv
Definition occupyuv.f90:7