The Elk Code
genwfsv.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: genwfsv
8 ! !INTERFACE:
9 subroutine genwfsv(tsh,tgp,nst,idx,ngridg_,igfft_,ngp,igpig,apwalm,evecfv, &
10  evecsv,wfmt,ld,wfir)
11 ! !USES:
12 use modmain
13 use modomp
14 ! !INPUT/OUTPUT PARAMETERS:
15 ! tsh : .true. if wfmt should be in spherical harmonic basis, otherwise
16 ! in spherical coordinates (in,logical)
17 ! tgp : .true. if wfir should be in G+p-space, otherwise in real-space
18 ! (in,logical)
19 ! nst : number of states to be calculated (in,integer)
20 ! idx : index to states which are to be calculated; if idx(1)=0 then
21 ! all states are calculated in the usual order (in,integer(*))
22 ! ngridg_ : G-vector grid sizes (in,integer(3))
23 ! igfft_ : map from G-vector index to FFT array (in,integer(*))
24 ! ngp : number of G+p-vectors (in,integer(nspnfv))
25 ! igpig : index from G+p-vectors to G-vectors (in,integer(ngkmax,nspnfv))
26 ! apwalm : APW matching coefficients
27 ! (in,complex(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv))
28 ! evecfv : first-variational eigenvectors (in,complex(nmatmax,nstfv,nspnfv))
29 ! evecsv : second-variational eigenvectors (in,complex(nstsv,nstsv))
30 ! wfmt : muffin-tin part of the wavefunctions for every state in spherical
31 ! coordinates (out,complex(npcmtmax,natmtot,nspinor,nst))
32 ! ld : leading dimension of wfir (in,integer)
33 ! wfir : interstitial part of the wavefunctions for every state
34 ! (out,complex(ld,nspinor,nst))
35 ! !DESCRIPTION:
36 ! Calculates the second-variational spinor wavefunctions in both the
37 ! muffin-tin and interstitial regions for every state of a particular
38 ! $k$-point. A coarse radial mesh is assumed in the muffin-tins with angular
39 ! momentum cut-off of {\tt lmaxo}.
40 !
41 ! !REVISION HISTORY:
42 ! Created November 2004 (Sharma)
43 ! Updated for spin-spirals, June 2010 (JKD)
44 ! Packed muffin-tins, April 2016 (JKD)
45 !EOP
46 !BOC
47 implicit none
48 ! arguments
49 logical, intent(in) :: tsh,tgp
50 integer, intent(in) :: nst,idx(*),ngridg_(3),igfft_(*)
51 integer, intent(in) :: ngp(nspnfv),igpig(ngkmax,nspnfv)
52 complex(8), intent(in) :: apwalm(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv)
53 complex(8), intent(in) :: evecfv(nmatmax,nstfv,nspnfv),evecsv(nstsv,nstsv)
54 complex(8), intent(out) :: wfmt(npcmtmax,natmtot,nspinor,nst)
55 integer, intent(in) :: ld
56 complex(8), intent(out) :: wfir(ld,nspinor,nst)
57 ! local variables
58 integer is,ias,ldmt,nthd
59 if (nst < 1) return
60 ! muffin-tin wavefunction
61 ldmt=npcmtmax*natmtot
62 call holdthd(natmtot+1,nthd)
63 !$OMP PARALLEL DEFAULT(SHARED) &
64 !$OMP PRIVATE(ias,is) &
65 !$OMP NUM_THREADS(nthd)
66 !$OMP DO SCHEDULE(DYNAMIC)
67 do ias=1,natmtot
68  is=idxis(ias)
69  call wfmtsv(tsh,lradstp,is,ias,nst,idx,ngp,apwalm,evecfv,evecsv,ldmt, &
70  wfmt(1,ias,1,1))
71 end do
72 !$OMP END DO NOWAIT
73 ! interstitial wavefunction
74 !$OMP SINGLE
75 call wfirsv(tgp,nst,idx,ngridg_,igfft_,ngp,igpig,evecfv,evecsv,ld,wfir)
76 !$OMP END SINGLE
77 !$OMP END PARALLEL
78 call freethd(nthd)
79 end subroutine
80 !EOC
81 
subroutine genwfsv(tsh, tgp, nst, idx, ngridg_, igfft_, ngp, igpig, apwalm, evecfv, evecsv, wfmt, ld, wfir)
Definition: genwfsv.f90:11
Definition: modomp.f90:6
integer lradstp
Definition: modmain.f90:171
integer, dimension(maxatoms *maxspecies) idxis
Definition: modmain.f90:44
subroutine wfirsv(tgp, nst, idx, ngridg_, igfft_, ngp, igpig, evecfv, evecsv, ld, wfir)
Definition: wfirsv.f90:7
subroutine freethd(nthd)
Definition: modomp.f90:106
subroutine holdthd(nloop, nthd)
Definition: modomp.f90:78
subroutine wfmtsv(tsh, lrstp, is, ias, nst, idx, ngp, apwalm, evecfv, evecsv, ld, wfmt)
Definition: wfmtsv.f90:7