The Elk Code
 
Loading...
Searching...
No Matches
genevfsv.f90
Go to the documentation of this file.
1
2! Copyright (C) 2012 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
6subroutine genevfsv
7use modmain
8use modmpi
9use modomp
10implicit none
11! local variables
12integer ik,lp,nthd
13! automatic arrays
14real(8) evalfv(nstfv,nspnfv)
15! allocatable arrays
16complex(8), allocatable :: evecfv(:,:,:),evecsv(:,:)
17! begin parallel loop over k-points
18call holdthd(nkpt/np_mpi,nthd)
19!$OMP PARALLEL DEFAULT(SHARED) &
20!$OMP PRIVATE(evalfv,evecfv,evecsv) &
21!$OMP NUM_THREADS(nthd)
22allocate(evecfv(nmatmax,nstfv,nspnfv),evecsv(nstsv,nstsv))
23!$OMP DO SCHEDULE(DYNAMIC)
24do ik=1,nkpt
25! distribute among MPI processes
26 if (mod(ik-1,np_mpi) /= lp_mpi) cycle
27! solve the first- and second-variational eigenvalue equations
28 call eveqn(ik,evalfv,evecfv,evecsv)
29! write the eigenvalues/vectors to file
30 call putevalfv(filext,ik,evalfv)
31 call putevalsv(filext,ik,evalsv(:,ik))
32 call putevecfv(filext,ik,evecfv)
33 call putevecsv(filext,ik,evecsv)
34end do
35!$OMP END DO
36deallocate(evecfv,evecsv)
37!$OMP END PARALLEL
38call freethd(nthd)
39! broadcast eigenvalue array to every MPI process
40if (np_mpi > 1) then
41 do ik=1,nkpt
42 lp=mod(ik-1,np_mpi)
43 call mpi_bcast(evalsv(:,ik),nstsv,mpi_double_precision,lp,mpicom,ierror)
44 end do
45end if
46end subroutine
47
subroutine eveqn(ik, evalfv, evecfv, evecsv)
Definition eveqn.f90:10
subroutine genevfsv
Definition genevfsv.f90:7
character(256) filext
Definition modmain.f90:1300
integer nkpt
Definition modmain.f90:461
integer nmatmax
Definition modmain.f90:848
integer nstsv
Definition modmain.f90:886
real(8), dimension(:,:), allocatable evalsv
Definition modmain.f90:918
integer lp_mpi
Definition modmpi.f90:15
integer ierror
Definition modmpi.f90:19
integer mpicom
Definition modmpi.f90:11
integer np_mpi
Definition modmpi.f90:13
subroutine holdthd(nloop, nthd)
Definition modomp.f90:78
subroutine freethd(nthd)
Definition modomp.f90:106
subroutine putevalfv(fext, ik, evalfv)
Definition putevalfv.f90:7
subroutine putevalsv(fext, ik, evalsv_)
Definition putevalsv.f90:7
subroutine putevecfv(fext, ik, evecfv)
Definition putevecfv.f90:7
subroutine putevecsv(fext, ik, evecsv)
Definition putevecsv.f90:7