The Elk Code
 
Loading...
Searching...
No Matches
wfmtfv.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: wfmtfv
8! !INTERFACE:
9subroutine wfmtfv(ias,ngp,apwalm,evecfv,wfmt)
10! !USES:
11use modmain
12! !INPUT/OUTPUT PARAMETERS:
13! ias : joint atom and species number (in,integer)
14! ngp : number of G+p-vectors (in,integer)
15! apwalm : APW matching coefficients (in,complex(ngkmax,apwordmax,lmmaxapw))
16! evecfv : first-variational eigenvector (in,complex(nmatmax))
17! wfmt : complex muffin-tin wavefunction passed in as real array
18! (out,real(2,*))
19! !DESCRIPTION:
20! Calculates the first-variational wavefunction in the muffin-tin in terms of
21! a spherical harmonic expansion. For atom $\alpha$ and a particular $k$-point
22! ${\bf p}$, the $r$-dependent $(l,m)$-coefficients of the wavefunction for
23! the $i$th state are given by
24! $$ \Phi^{i{\bf p}}_{\alpha lm}(r)=\sum_{\bf G}b^{i{\bf p}}_{\bf G}
25! \sum_{j=1}^{M^{\alpha}_l}A^{\alpha}_{jlm}({\bf G+p})u^{\alpha}_{jl}(r)
26! +\sum_{j=1}^{N^{\alpha}}b^{i{\bf p}}_{(\alpha,j,m)}v^{\alpha}_j(r)
27! \delta_{l,l_j}, $$
28! where $b^{i{\bf p}}$ is the $i$th eigenvector returned from routine
29! {\tt eveqn}; $A^{\alpha}_{jlm}({\bf G+p})$ is the matching coefficient;
30! $M^{\alpha}_l$ is the order of the APW; $u^{\alpha}_{jl}$ is the APW radial
31! function; $N^{\alpha}$ is the number of local-orbitals; $v^{\alpha}_j$ is
32! the $j$th local-orbital radial function; and $(\alpha,j,m)$ is a compound
33! index for the location of the local-orbital in the eigenvector. See routines
34! {\tt genapwfr}, {\tt genlofr}, {\tt match} and {\tt eveqn}.
35!
36! !REVISION HISTORY:
37! Created April 2003 (JKD)
38! Fixed description, October 2004 (C. Brouder)
39! Removed argument ist, November 2006 (JKD)
40! Changed arguments and optimised, December 2014 (JKD)
41!EOP
42!BOC
43implicit none
44! arguments
45integer, intent(in) :: ias,ngp
46complex(8), intent(in) :: apwalm(ngkmax,apwordmax,lmmaxapw),evecfv(nmatmax)
47complex(8), intent(out) :: wfmt(*)
48! local variables
49integer is,io,ilo
50integer nrci,nrco,iro
51integer l,lm,npci,i
52complex(8) z
53! external functions
54complex(8), external :: zdotu
55is=idxis(ias)
56iro=nrmti(is)+lradstp
57nrci=nrcmti(is)
58nrco=nrcmt(is)-nrci
59npci=npcmti(is)
60! zero the wavefunction
61wfmt(1:npcmt(is))=0.d0
62!---------------------------------!
63! local-orbital functions !
64!---------------------------------!
65do ilo=1,nlorb(is)
66 l=lorbl(ilo,is)
67 do lm=l**2+1,(l+1)**2
68 i=npci+lm
69 z=evecfv(ngp+idxlo(lm,ilo,ias))
70 if (abs(z%re)+abs(z%im) > 1.d-10) then
71 if (l <= lmaxi) call zfzrf(nrci,lofr(1,1,ilo,ias),lmmaxi,wfmt(lm))
72 call zfzrf(nrco,lofr(iro,1,ilo,ias),lmmaxo,wfmt(i))
73 end if
74 end do
75end do
76!-----------------------!
77! APW functions !
78!-----------------------!
79do l=0,lmaxo
80 do lm=l**2+1,(l+1)**2
81 i=npci+lm
82 do io=1,apword(l,is)
83 z=zdotu(ngp,evecfv,1,apwalm(:,io,lm),1)
84 if (abs(z%re)+abs(z%im) > 1.d-10) then
85 if (l <= lmaxi) call zfzrf(nrci,apwfr(1,1,io,l,ias),lmmaxi,wfmt(lm))
86 call zfzrf(nrco,apwfr(iro,1,io,l,ias),lmmaxo,wfmt(i))
87 end if
88 end do
89 end do
90end do
91return
92
93contains
94
95pure subroutine zfzrf(n,rf,ld,zf)
96implicit none
97! arguments
98integer, intent(in) :: n
99real(8), intent(in) :: rf(lradstp,n)
100integer, intent(in) :: ld
101complex(8), intent(inout) :: zf(ld,n)
102zf(1,1:n)=zf(1,1:n)+z*rf(1,1:n)
103end subroutine
104
105end subroutine
106!EOC
107
pure subroutine zfzrf(n, ld1, rf, ld2, zf)
Definition dwfmtfv.f90:67
integer, dimension(maxspecies) nrmti
Definition modmain.f90:211
integer, dimension(:,:,:), allocatable idxlo
Definition modmain.f90:850
integer, dimension(maxspecies) npcmti
Definition modmain.f90:214
integer lmmaxi
Definition modmain.f90:207
integer, dimension(maxspecies) nrcmt
Definition modmain.f90:173
integer, dimension(0:maxlapw, maxspecies) apword
Definition modmain.f90:758
integer, dimension(maxatoms *maxspecies) idxis
Definition modmain.f90:44
integer lradstp
Definition modmain.f90:171
integer, dimension(maxspecies) npcmt
Definition modmain.f90:214
real(8), dimension(:,:,:,:,:), allocatable apwfr
Definition modmain.f90:774
integer lmaxo
Definition modmain.f90:201
integer lmaxi
Definition modmain.f90:205
integer, dimension(maxspecies) nlorb
Definition modmain.f90:786
integer lmmaxo
Definition modmain.f90:203
integer, dimension(maxspecies) nrcmti
Definition modmain.f90:211
real(8), dimension(:,:,:,:), allocatable lofr
Definition modmain.f90:814
integer, dimension(maxlorb, maxspecies) lorbl
Definition modmain.f90:796
subroutine wfmtfv(ias, ngp, apwalm, evecfv, wfmt)
Definition wfmtfv.f90:10