12 integer,
intent(in) :: ik0
13 integer(omp_lock_kind),
intent(inout) :: lock(nqpt)
14 complex(8),
intent(in) :: evecu(nstulr,nstulr)
17 integer nst,ist,jst,i,j
26 complex(8),
allocatable :: apwalm(:,:,:,:),evecfv(:,:),evecsv(:,:)
27 complex(8),
allocatable :: evectv(:,:,:),evecsvt(:,:)
28 complex(4),
allocatable :: wfmt(:,:,:,:),wfir(:,:,:)
40 call match(ngk0,
vgkc(:,:,1,ik),
gkc(:,1,ik),
sfacgk(:,:,1,ik),apwalm)
41 allocate(evectv(nstsv,nstsv,nqpt))
48 allocate(evecsvt(nstsv,nstsv))
66 j=(jkpa-1)*nstsv+idx(jst)
72 zfft(
iqfft(ikpa))=evecu(i,j)
76 evectv(ist,jst,1:nqpt)=zfft(1:nqpt)
84 call zgemm(
'N',
'N',nstsv,nst,nstsv,
zone,evecsv,nstsv,evectv(:,:,ir), &
85 nstsv,
zzero,evecsvt,nstsv)
87 call genwfsv_sp(.false.,.false.,nst,[0],
ngdgc,
igfc,ngk0,
igkig(:,1,ik), &
88 apwalm,evecfv,evecsvt,wfmt,
ngtc,wfir)
91 j=(jkpa-1)*nstsv+idx(jst)
94 call omp_set_lock(lock(ir))
101 call rmk1(npc,wo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
102 rhormt(:,ias,ir),
magrmt(:,ias,1,ir),
magrmt(:,ias,2,ir), &
105 call rmk2(npc,wo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
109 call rmk3(npc,wo,wfmt(:,ias,1,jst),
rhormt(:,ias,ir))
115 call rmk1(
ngtc,wo,wfir(:,1,jst),wfir(:,2,jst),
rhorir(:,ir), &
118 call rmk2(
ngtc,wo,wfir(:,1,jst),wfir(:,2,jst),
rhorir(:,ir), &
124 call omp_unset_lock(lock(ir))
130 deallocate(evecsvt,wfmt,wfir)
133 deallocate(apwalm,evecfv,evecsv,evectv)
140 pure subroutine rmk1(n,wo,wf1,wf2,rho,mag1,mag2,mag3)
143 integer,
intent(in) :: n
144 real(4),
intent(in) :: wo
145 complex(4),
intent(in) :: wf1(n),wf2(n)
146 real(8),
intent(inout) :: rho(n),mag1(n),mag2(n),mag3(n)
149 real(4) wo2,a1,b1,a2,b2,t1,t2
153 a1=
real(wf1(i)); b1=aimag(wf1(i))
154 a2=
real(wf2(i)); b2=aimag(wf2(i))
155 t1=a1**2+b1**2; t2=a2**2+b2**2
156 mag1(i)=mag1(i)+wo2*(a1*a2+b1*b2)
157 mag2(i)=mag2(i)+wo2*(a1*b2-b1*a2)
158 mag3(i)=mag3(i)+wo*(t1-t2)
159 rho(i)=rho(i)+wo*(t1+t2)
163 pure subroutine rmk2(n,wo,wf1,wf2,rho,mag)
166 integer,
intent(in) :: n
167 real(4),
intent(in) :: wo
168 complex(4),
intent(in) :: wf1(n),wf2(n)
169 real(8),
intent(inout) :: rho(n),mag(n)
175 t1=
real(wf1(i))**2+aimag(wf1(i))**2
176 t2=
real(wf2(i))**2+aimag(wf2(i))**2
177 mag(i)=mag(i)+wo*(t1-t2)
178 rho(i)=rho(i)+wo*(t1+t2)
182 pure subroutine rmk3(n,wo,wf,rho)
185 integer,
intent(in) :: n
186 real(4),
intent(in) :: wo
187 complex(4),
intent(in) :: wf(n)
188 real(8),
intent(inout) :: rho(n)
189 rho(1:n)=rho(1:n)+wo*(
real(wf(1:n))**2+aimag(wf(1:n))**2)
integer, dimension(maxspecies) npcmt
subroutine getevecsv(fext, ikp, vpl, evecsv)
subroutine getevecfv(fext, ikp, vpl, vgpl, evecfv)
subroutine match(ngp, vgpc, gpc, sfacgp, apwalm)
complex(8), parameter zone
complex(8), dimension(:,:,:,:), allocatable sfacgk
integer, dimension(:), allocatable iqfft
integer, dimension(:,:), allocatable ngk
subroutine zfftifc(nd, n, sgn, z)
real(8), dimension(:), allocatable wkpt
real(8), dimension(:,:,:,:), pointer, contiguous magrmt
subroutine genwfsv_sp(tsh, tgp, nst, idx, ngridg_, igfft_, ngp, igpig, apwalm, evecfv, evecsv, wfmt, ld, wfir)
real(8), dimension(:,:), allocatable occulr
real(8), dimension(:,:,:,:), allocatable vgkl
integer, dimension(:), allocatable igfc
real(8), dimension(:,:,:), pointer, contiguous rhormt
real(8), dimension(:,:,:,:), allocatable vgkc
real(8), dimension(:,:), pointer, contiguous rhorir
complex(8), parameter zzero
integer, dimension(3) ngridq
real(8), dimension(:,:), allocatable vkl
integer, dimension(maxatoms *maxspecies) idxis
pure subroutine rmk3(n, wo, wf, rho)
real(8), dimension(:,:,:), allocatable gkc
integer, dimension(3) ngdgc
subroutine rhomaguk(ik0, lock, evecu)
real(8), dimension(:,:,:), pointer, contiguous magrir
subroutine holdthd(nloop, nthd)
pure subroutine rmk1(n, wo, wf1, wf2, rho, mag1, mag2, mag3)
pure subroutine rmk2(n, wo, wf1, wf2, rho, mag)
integer, dimension(:,:,:), allocatable igkig