9subroutine rhomagk(ngp,igpig,wppt,occsvp,apwalm,evecfv,evecsv,rhomt_,rhoir_, &
48integer,
intent(in) :: ngp(nspnfv),igpig(ngkmax,nspnfv)
49real(8),
intent(in) :: wppt,occsvp(nstsv)
50complex(8),
intent(in) :: apwalm(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv)
51complex(8),
intent(in) :: evecfv(nmatmax,nstfv,nspnfv),evecsv(nstsv,nstsv)
52real(8),
intent(inout) :: rhomt_(npcmtmax,natmtot),rhoir_(ngtc)
53real(8),
intent(inout) :: magmt_(npcmtmax,natmtot,ndmag),magir_(ngtc,ndmag)
55integer ispn,jspn,nst,ist
56integer is,ias,npc,i,j,k
62complex(8) wfir(ngtc,nspinor),wfgp(ngkmax)
64complex(8),
allocatable :: wfmt(:,:,:)
69 if (abs(occsvp(ist)) <
epsocc) cycle
76call holdthd(max(natmtot,nst),nthd)
82allocate(wfmt(npcmtmax,nspinor,nst))
87 call wfmtsv(.false.,
lradstp,is,ias,nst,idx,ngp,apwalm,evecfv,evecsv,npcmtmax,&
97 call rmk1(npc,wo,wfmt(:,1,j),wfmt(:,2,j),rhomt_(:,ias),magmt_(:,ias,1),&
98 magmt_(:,ias,2),magmt_(:,ias,3))
101 call rmk2(npc,wo,wfmt(:,1,j),wfmt(:,2,j),rhomt_(:,ias),magmt_(:,ias,1))
105 call rmk3(npc,wo,wfmt(:,1,j),rhomt_(:,ias))
117 wo=occsvp(k)*wppt/
omega
127 if (abs(z1%re)+abs(z1%im) > 1.d-10)
then
128 wfgp(1:n)=wfgp(1:n)+z1*evecfv(1:n,ist,jspn)
131 wfir(1:ngtc,ispn)=0.d0
133 wfir(
igfc(igpig(igp,jspn)),ispn)=wfgp(igp)
142 wfir(
igfc(igpig(igp,1)),1)=evecfv(igp,k,1)
152 call rmk1(ngtc,wo,wfir,wfir(:,2),rhoir_,magir_,magir_(:,2),magir_(:,3))
155 call rmk2(ngtc,wo,wfir,wfir(:,2),rhoir_,magir_)
159 call rmk3(ngtc,wo,wfir,rhoir_)
173pure subroutine rmk1(n,wo,wf1,wf2,rho,mag1,mag2,mag3)
176integer,
intent(in) :: n
177real(8),
intent(in) :: wo
178complex(8),
intent(in) :: wf1(n),wf2(n)
179real(8),
intent(inout) :: rho(n),mag1(n),mag2(n),mag3(n)
187 a1=dble(wf1(i)); b1=aimag(wf1(i))
188 a2=dble(wf2(i)); b2=aimag(wf2(i))
189 t1=a1**2+b1**2; t2=a2**2+b2**2
190 mag1(i)=mag1(i)+wo2*(a1*a2+b1*b2)
191 mag2(i)=mag2(i)+wo2*(a1*b2-b1*a2)
192 mag3(i)=mag3(i)+wo*(t1-t2)
193 rho(i)=rho(i)+wo*(t1+t2)
197pure subroutine rmk2(n,wo,wf1,wf2,rho,mag)
200integer,
intent(in) :: n
201real(8),
intent(in) :: wo
202complex(8),
intent(in) :: wf1(n),wf2(n)
203real(8),
intent(inout) :: rho(n),mag(n)
209 t1=dble(wf1(i))**2+aimag(wf1(i))**2
210 t2=dble(wf2(i))**2+aimag(wf2(i))**2
211 mag(i)=mag(i)+wo*(t1-t2)
212 rho(i)=rho(i)+wo*(t1+t2)
216pure subroutine rmk3(n,wo,wf,rho)
219integer,
intent(in) :: n
220real(8),
intent(in) :: wo
221complex(8),
intent(in) :: wf(n)
222real(8),
intent(inout) :: rho(n)
223rho(1:n)=rho(1:n)+wo*(dble(wf(1:n))**2+aimag(wf(1:n))**2)
integer, dimension(3) ngdgc
integer, dimension(:), allocatable igfc
integer, dimension(maxatoms *maxspecies) idxis
integer, dimension(maxspecies) npcmt
integer, dimension(2) jspnfv
subroutine rhomagk(ngp, igpig, wppt, occsvp, apwalm, evecfv, evecsv, rhomt_, rhoir_, magmt_, magir_)
subroutine wfmtsv(tsh, lrstp, is, ias, nst, idx, ngp, apwalm, evecfv, evecsv, ld, wfmt)