6subroutine genephmat(iq,ik,de,a,dvmt,dvir,ephmat)
11integer,
intent(in) :: iq,ik
12real(8),
intent(in) :: de
13complex(8),
intent(in) :: a(nbph,nbph)
14complex(8),
intent(in) :: dvmt(npcmtmax,natmtot,nbph),dvir(ngtc,nbph)
15complex(8),
intent(out) :: ephmat(nstsv,nstsv,nbph)
18integer nst,nstq,ist,jst
19integer ispn,jspn,is,ias
20integer npc,nq,igp,i,j,l
23integer idx(nstsv),idxq(nstsv)
24integer ngp(nspnfv),ngpq(nspnfv)
25complex(4) cfmt1(npcmtmax),cfmt2(npcmtmax),c(ngkmax)
28integer,
allocatable :: igpig(:,:),igpqig(:,:)
29complex(4),
allocatable :: wfmt(:,:,:,:),wfgp(:,:,:)
30complex(4),
allocatable :: wfmtq(:,:,:,:),wfgpq(:,:,:)
31complex(4),
allocatable :: wfir1(:),wfir2(:)
35vpql(1:3)=
vkl(1:3,ik)+
vql(1:3,iq)
52allocate(igpig(ngkmax,nspnfv))
53allocate(wfmt(npcmtmax,natmtot,
nspinor,nst),wfgp(ngkmax,
nspinor,nst))
54call genwfsvp_sp(.false.,.true.,nst,idx,
ngridg,
igfft,
vkl(:,ik),ngp,igpig,wfmt, &
56allocate(igpqig(ngkmax,nspnfv))
57allocate(wfmtq(npcmtmax,natmtot,
nspinor,nstq),wfgpq(ngkmax,
nspinor,nstq))
58call genwfsvp_sp(.false.,.true.,nstq,idxq,
ngridg,
igfft,vpql,ngpq,igpqig,wfmtq, &
61ephmat(1:nstsv,1:nstsv,1:nbph)=0.d0
73 cfmt1(1:npc)=wfmtq(1:npc,ias,1,i)*conjg(wfmt(1:npc,ias,1,j)) &
74 +wfmtq(1:npc,ias,2,i)*conjg(wfmt(1:npc,ias,2,j))
76 cfmt1(1:npc)=wfmtq(1:npc,ias,1,i)*conjg(wfmt(1:npc,ias,1,j))
80 ephmat(ist,jst,l)=ephmat(ist,jst,l) &
81 +dot_product(cfmt2(1:npc),dvmt(1:npc,ias,l))
90allocate(wfir1(ngtc),wfir2(ngtc))
99 wfir1(
igfc(igpig(igp,jspn)))=wfgp(igp,ispn,j)
104 wfir2(1:ngtc)=dvir(1:ngtc,l)*wfir1(1:ngtc)
108 c(igp)=wfir2(
igfc(igpqig(igp,jspn)))
113 ephmat(ist,jst,l)=ephmat(ist,jst,l) &
114 +dot_product(wfgpq(1:nq,ispn,i),c(1:nq))
119deallocate(wfir1,wfir2)
126 x(1:nbph)=ephmat(ist,jst,1:nbph)
127 call zgemv(
'T',nbph,nbph,
zone,a,nbph,x,1,
zzero,ephmat(ist,jst,1),ld)
130deallocate(igpig,igpqig,wfgp,wfgpq)
subroutine genwfsvp_sp(tsh, tgp, nst, idx, ngridg_, igfft_, vpl, ngp, igpig, wfmt, ld, wfir)
complex(8), parameter zzero
integer, dimension(3) ngridg
integer, dimension(3) ngdgc
integer, dimension(maxspecies) nrcmt
integer, dimension(:,:), allocatable ivk
complex(8), parameter zone
integer, dimension(:), allocatable igfc
integer, dimension(maxatoms *maxspecies) idxis
real(8), dimension(:,:), allocatable vql
integer, dimension(maxspecies) npcmt
integer, dimension(:), allocatable igfft
integer, dimension(2) jspnfv
real(8), dimension(:,:), allocatable vkl
integer, dimension(:,:,:), allocatable ivkik
integer, dimension(maxspecies) nrcmti
real(8), dimension(:,:), allocatable evalsv