2 ! Copyright (C) 2007 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.
6 subroutine genvmatk(vmt
,vir
,wfmt
,wfir
,vmat
)
10 real(8), intent(in
) :: vmt(lmmaxvr
,nrcmtmax
,natmtot
)
11 real(8), intent(in
) :: vir(ngrtot
)
12 complex(8), intent(in
) :: wfmt(lmmaxvr
,nrcmtmax
,natmtot
,nspinor
,nstsv
)
13 complex(8), intent(in
) :: wfir(ngrtot
,nspinor
,nstsv
)
14 complex(8), intent(out
) :: vmat(nstsv
,nstsv
)
16 integer is
,ia
,ias
,nr
,irc
21 real(8), allocatable
:: rfir(:)
22 complex(8), allocatable
:: zfmt(:,:)
23 complex(8), allocatable
:: zfir(:)
25 complex(8) zfmtinp
,zdotc
26 external zfmtinp
,zdotc
27 ! allocate local arrays
28 allocate(rfir(ngrtot
))
29 allocate(zfmt(lmmaxvr
,nrcmtmax
))
30 allocate(zfir(ngrtot
))
31 ! zero the matrix elements
33 !-------------------------!
35 !-------------------------!
42 ! apply potential to wavefunction
44 zfmt(:,irc
)=vmt(:,irc
,ias
)*wfmt(:,irc
,ias
,ispn
,jst
)
47 ! compute inner product (functions are in spherical coordinates)
48 zt1
=zfmtinp(.false
.,lmaxvr
,nr
,rcmt(1,is
),lmmaxvr
, &
49 wfmt(1,1,ias
,ispn
,ist
),zfmt
)
50 vmat(ist
,jst
)=vmat(ist
,jst
)+zt1
56 !---------------------------!
58 !---------------------------!
59 rfir(:)=vir(:)*cfunir(:)
63 ! apply potential to wavefunction
64 zfir(:)=rfir(:)*wfir(:,ispn
,jst
)
66 zt1
=zdotc(ngrtot
,wfir(1,ispn
,ist
),1,zfir
,1)
67 vmat(ist
,jst
)=vmat(ist
,jst
)+t1
*zt1
71 ! lower triangular part
74 vmat(ist
,jst
)=conjg(vmat(jst
,ist
))
77 deallocate(rfir
,zfmt
,zfir
)