9subroutine genpmatk(ngp,igpig,vgpc,wfmt,wfgp,pmat)
39integer,
intent(in) :: ngp(nspnfv),igpig(ngkmax,nspnfv)
40real(8),
intent(in) :: vgpc(3,ngkmax,nspnfv)
41complex(8),
intent(in) :: wfmt(npcmtmax,natmtot,nspinor,nstsv)
42complex(8),
intent(in) :: wfgp(ngkmax,nspinor,nstsv)
43complex(8),
intent(out) :: pmat(nstsv,nstsv,3)
45integer ist,jst,ispn,jspn
46integer is,ia,ias,nrc,nrci,npc
47integer ld1,ld2,igp,ifg,i
49complex(8) z1,z2,z11,z12,z21,z22,z31,z32
52complex(8) gwfmt(npcmtmax,3,nspinor),gvmt(npcmtmax,3)
53complex(8) zfmt1(npcmtmax,nspinor),zfmt2(npcmtmax,3,nspinor)
54complex(8) gwfir(ngtc,3),z(ngkmax)
56cso=1.d0/(4.d0*
solsc**2)
58ld1=npcmtmax*natmtot*nspinor
61pmat(1:nstsv,1:nstsv,1:3)=0.d0
74 call rtozfmt(nrc,nrci,rfmt,zfmt1)
75 call gradzfmt(nrc,nrci,
rlcmt(:,-1,is),
wcrcmt(:,:,is),zfmt1,npcmtmax,gvmt)
78 call zbshtip(nrc,nrci,gvmt(:,i))
85 wfmt(:,ias,ispn,jst),npcmtmax,gwfmt(:,:,ispn))
91 call zbsht(nrc,nrci,wfmt(:,ias,ispn,jst),zfmt1(:,ispn))
97 z11=gvmt(i,1)*z1; z12=gvmt(i,1)*z2
98 z21=gvmt(i,2)*z1; z22=gvmt(i,2)*z2
99 z31=gvmt(i,3)*z1; z32=gvmt(i,3)*z2
100 zfmt2(i,1,1)=
zmi*z32-z21
101 zfmt2(i,1,2)=
zi*z31+z22
103 zfmt2(i,2,2)=-z12-z31
104 zfmt2(i,3,1)=
zi*z12+z22
105 zfmt2(i,3,2)=
zmi*z11+z21
110 call zfsht(nrc,nrci,zfmt2(:,i,ispn),zfmt1)
111 gwfmt(1:npc,i,ispn)=gwfmt(1:npc,i,ispn)+cso*zfmt1(1:npc,1)
120 call zgemv(
'C',npc,jst,
zone,wfmt(1,ias,ispn,1),ld1,gwfmt(1,i,ispn),1,&
121 zone,pmat(1,jst,i),1)
134 gwfir(1:ngtc,1:3)=0.d0
136 ifg=
igfc(igpig(igp,jspn))
137 z1=wfgp(igp,ispn,jst)
138 gwfir(ifg,1:3)=vgpc(1:3,igp,jspn)*
zi*z1
144 gwfir(1:ngtc,i)=gwfir(1:ngtc,i)*
cfrc(1:ngtc)
151 ifg=
igfc(igpig(igp,jspn))
154 call zgemv(
'C',ngp(jspn),jst,
zone,wfgp(1,ispn,1),ld2,z,1,
zone, &
163 z1=
zmi*pmat(ist,jst,i)
165 pmat(jst,ist,i)=conjg(z1)
167 pmat(jst,jst,i)=aimag(pmat(jst,jst,i))
complex(8), parameter zmi
real(8), dimension(:), allocatable cfrc
integer, dimension(3) ngdgc
integer, dimension(maxspecies) natoms
integer, dimension(maxatoms, maxspecies) idxas
integer, dimension(maxspecies) nrcmt
complex(8), parameter zone
integer, dimension(:), allocatable igfc
real(8), dimension(:,:,:), allocatable rlcmt
real(8), dimension(:,:), allocatable wr2cmt
real(8), dimension(:,:,:), allocatable wcrcmt
integer, dimension(maxspecies) npcmt
real(8), dimension(:,:), pointer, contiguous vsmt
integer, dimension(2) jspnfv
integer, dimension(maxspecies) nrcmti