The Elk Code
genpmat.f90
Go to the documentation of this file.
1
2
! Copyright (C) 2015 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
genpmat
7
use
modmain
8
use
modmpi
9
use
modomp
10
implicit none
11
! local variables
12
integer
ik,nthd
13
! allocatable arrays
14
complex(8)
,
allocatable
:: pmat(:,:,:)
15
if
(
mp_mpi
)
write
(*,*)
16
! synchronise MPI processes
17
call
mpi_barrier(
mpicom
,
ierror
)
18
call
holdthd
(
nkpt
/
np_mpi
,nthd)
19
!$OMP PARALLEL DEFAULT(SHARED) &
20
!$OMP PRIVATE(pmat) &
21
!$OMP NUM_THREADS(nthd)
22
allocate
(pmat(
nstsv
,
nstsv
,3))
23
!$OMP DO SCHEDULE(DYNAMIC)
24
do
ik=1,
nkpt
25
! distribute among MPI processes
26
if
(mod(ik-1,
np_mpi
) /=
lp_mpi
) cycle
27
!$OMP CRITICAL(genpmat_)
28
write
(*,
'("Info(genpmat): ",I0," of ",I0," k-points")'
) ik,
nkpt
29
!$OMP END CRITICAL(genpmat_)
30
! generate the momentum matrix elements for k-point ik
31
call
genpmatk
(ik,pmat)
32
! write the matrix elements to file
33
call
putpmat
(ik,pmat)
34
end do
35
!$OMP END DO
36
deallocate
(pmat)
37
!$OMP END PARALLEL
38
call
freethd
(nthd)
39
! synchronise MPI processes
40
call
mpi_barrier(
mpicom
,
ierror
)
41
end subroutine
42
modmpi::mp_mpi
logical mp_mpi
Definition:
modmpi.f90:17
modmain::nkpt
integer nkpt
Definition:
modmain.f90:464
modomp
Definition:
modomp.f90:6
modmpi::np_mpi
integer np_mpi
Definition:
modmpi.f90:13
modmain
Definition:
modmain.f90:6
modmain::nstsv
integer nstsv
Definition:
modmain.f90:885
modmpi
Definition:
modmpi.f90:6
genpmat
subroutine genpmat
Definition:
genpmat.f90:7
modmpi::lp_mpi
integer lp_mpi
Definition:
modmpi.f90:15
modomp::freethd
subroutine freethd(nthd)
Definition:
modomp.f90:112
modomp::holdthd
subroutine holdthd(nloop, nthd)
Definition:
modomp.f90:78
genpmatk
subroutine genpmatk(ik, pmat)
Definition:
genpmatk.f90:7
putpmat
subroutine putpmat(ik, pmat)
Definition:
putpmat.f90:7
modmpi::mpicom
integer mpicom
Definition:
modmpi.f90:11
modmpi::ierror
integer ierror
Definition:
modmpi.f90:19
genpmat.f90
Generated by
1.8.14