The Elk Code
gwdmat.f90
Go to the documentation of this file.
1
2
! Copyright (C) 2018 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
3
! This file is distributed under the terms of the GNU General Public License.
4
! See the file COPYING for license details.
5
6
subroutine
gwdmat
7
use
modmain
8
use
modgw
9
use
modmpi
10
use
modomp
11
implicit none
12
! local variables
13
integer
ik,lp,nthd
14
! initialise universal variables
15
call
init0
16
call
init1
17
call
init3
18
! read Fermi energy from file
19
call
readefm
20
! get the eigenvalues from file
21
do
ik=1,
nkpt
22
call
getevalsv
(
filext
,ik,
vkl
(:,ik),
evalsv
(:,ik))
23
end do
24
! determine the GW Fermi energy
25
call
gwefermi
26
! compute the GW density matrices and write the natural orbitals and occupation
27
! numbers to EVECSV.OUT and OCCSV.OUT, respectively
28
call
holdthd
(
nkpt
/
np_mpi
,nthd)
29
!$OMP PARALLEL DO DEFAULT(SHARED) &
30
!$OMP SCHEDULE(DYNAMIC) &
31
!$OMP NUM_THREADS(nthd)
32
do
ik=1,
nkpt
33
! distribute among MPI processes
34
if
(mod(ik-1,
np_mpi
) /=
lp_mpi
) cycle
35
call
gwdmatk
(ik)
36
end do
37
!$OMP END PARALLEL DO
38
call
freethd
(nthd)
39
! broadcast occupation number array to every MPI process
40
if
(
np_mpi
> 1)
then
41
do
ik=1,
nkpt
42
lp=mod(ik-1,
np_mpi
)
43
call
mpi_bcast(
occsv
(:,ik),
nstsv
,mpi_double_precision,lp,
mpicom
,
ierror
)
44
end do
45
end if
46
if
(
mp_mpi
)
then
47
! write the occupation numbers to file
48
do
ik=1,
nkpt
49
call
putoccsv
(
filext
,ik,
occsv
(:,ik))
50
end do
51
write
(*,*)
52
write
(*,
'("Info(gwdmat):")'
)
53
write
(*,
'(" GW density matrices determined for each k-point")'
)
54
write
(*,*)
55
write
(*,
'(" Natural orbitals and occupation numbers written to")'
)
56
write
(*,
'(" EVECSV.OUT and OCCSV.OUT, respectively")'
)
57
end if
58
end subroutine
59
modmain::filext
character(256) filext
Definition:
modmain.f90:1301
modmain::evalsv
real(8), dimension(:,:), allocatable evalsv
Definition:
modmain.f90:921
modmpi::mp_mpi
logical mp_mpi
Definition:
modmpi.f90:17
modmain::nkpt
integer nkpt
Definition:
modmain.f90:461
getevalsv
subroutine getevalsv(fext, ikp, vpl, evalsv_)
Definition:
getevalsv.f90:7
modomp
Definition:
modomp.f90:6
modmpi::np_mpi
integer np_mpi
Definition:
modmpi.f90:13
gwdmat
subroutine gwdmat
Definition:
gwdmat.f90:7
modmain
Definition:
modmain.f90:6
modmain::nstsv
integer nstsv
Definition:
modmain.f90:889
readefm
subroutine readefm
Definition:
readefm.f90:10
init3
subroutine init3
Definition:
init3.f90:7
modmain::occsv
real(8), dimension(:,:), allocatable occsv
Definition:
modmain.f90:905
gwefermi
subroutine gwefermi
Definition:
gwefermi.f90:7
init1
subroutine init1
Definition:
init1.f90:10
modmain::vkl
real(8), dimension(:,:), allocatable vkl
Definition:
modmain.f90:471
modgw
Definition:
modgw.f90:6
modmpi
Definition:
modmpi.f90:6
modmpi::lp_mpi
integer lp_mpi
Definition:
modmpi.f90:15
modomp::freethd
subroutine freethd(nthd)
Definition:
modomp.f90:106
modomp::holdthd
subroutine holdthd(nloop, nthd)
Definition:
modomp.f90:78
putoccsv
subroutine putoccsv(fext, ik, occsvp)
Definition:
putoccsv.f90:7
init0
subroutine init0
Definition:
init0.f90:10
modmpi::mpicom
integer mpicom
Definition:
modmpi.f90:11
gwdmatk
subroutine gwdmatk(ik)
Definition:
gwdmatk.f90:7
modmpi::ierror
integer ierror
Definition:
modmpi.f90:19
gwdmat.f90
Generated by
1.8.14