12integer,
intent(in) :: ik0
13integer(omp_lock_kind),
intent(inout) :: lock(nqpt)
14complex(8),
intent(in) :: evecu(nstulr,nstulr)
17integer nst,ist,jst,i,j
26complex(8),
allocatable :: apwalm(:,:,:,:),evecfv(:,:),evecsv(:,:)
27complex(8),
allocatable :: evectv(:,:,:),evecsvt(:,:)
28complex(4),
allocatable :: wfmt(:,:,:,:),wfir(:,:,:)
40call match(ngk0,
vgkc(:,:,1,ik),
gkc(:,1,ik),
sfacgk(:,:,1,ik),apwalm)
41allocate(evectv(nstsv,nstsv,nqpt))
48allocate(evecsvt(nstsv,nstsv))
65 j=(jkpa-1)*nstsv+idx(jst)
71 zfft(
iqfft(ikpa))=evecu(i,j)
75 evectv(ist,jst,1:nqpt)=zfft(1:nqpt)
83 call zgemm(
'N',
'N',nstsv,nst,nstsv,
zone,evecsv,nstsv,evectv(:,:,ir), &
84 nstsv,
zzero,evecsvt,nstsv)
86 call genwfsv_sp(.false.,.false.,nst,[0],
ngdgc,
igfc,ngk0,
igkig(:,1,ik), &
87 apwalm,evecfv,evecsvt,wfmt,
ngtc,wfir)
90 j=(jkpa-1)*nstsv+idx(jst)
93 call omp_set_lock(lock(ir))
100 call rmk1(npc,wo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
101 rhormt(:,ias,ir),
magrmt(:,ias,1,ir),
magrmt(:,ias,2,ir), &
104 call rmk2(npc,wo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
108 call rmk3(npc,wo,wfmt(:,ias,1,jst),
rhormt(:,ias,ir))
114 call rmk1(
ngtc,wo,wfir(:,1,jst),wfir(:,2,jst),
rhorir(:,ir), &
117 call rmk2(
ngtc,wo,wfir(:,1,jst),wfir(:,2,jst),
rhorir(:,ir), &
123 call omp_unset_lock(lock(ir))
129deallocate(evecsvt,wfmt,wfir)
132deallocate(apwalm,evecfv,evecsv,evectv)
140pure subroutine rmk1(n,wo,wf1,wf2,rho,mag1,mag2,mag3)
143integer,
intent(in) :: n
144real(4),
intent(in) :: wo
145complex(4),
intent(in) :: wf1(n),wf2(n)
146real(8),
intent(inout) :: rho(n),mag1(n),mag2(n),mag3(n)
154 a1=real(wf1(i)); b1=aimag(wf1(i))
155 a2=real(wf2(i)); b2=aimag(wf2(i))
156 t1=a1**2+b1**2; t2=a2**2+b2**2
157 mag1(i)=mag1(i)+wo2*(a1*a2+b1*b2)
158 mag2(i)=mag2(i)+wo2*(a1*b2-b1*a2)
159 mag3(i)=mag3(i)+wo*(t1-t2)
160 rho(i)=rho(i)+wo*(t1+t2)
164pure subroutine rmk2(n,wo,wf1,wf2,rho,mag)
167integer,
intent(in) :: n
168real(4),
intent(in) :: wo
169complex(4),
intent(in) :: wf1(n),wf2(n)
170real(8),
intent(inout) :: rho(n),mag(n)
176 t1=real(wf1(i))**2+aimag(wf1(i))**2
177 t2=real(wf2(i))**2+aimag(wf2(i))**2
178 mag(i)=mag(i)+wo*(t1-t2)
179 rho(i)=rho(i)+wo*(t1+t2)
183pure subroutine rmk3(n,wo,wf,rho)
186integer,
intent(in) :: n
187real(4),
intent(in) :: wo
188complex(4),
intent(in) :: wf(n)
189real(8),
intent(inout) :: rho(n)
190rho(1:n)=rho(1:n)+wo*(real(wf(1:n))**2+aimag(wf(1:n))**2)
subroutine genwfsv_sp(tsh, tgp, nst, idx, ngridg_, igfft_, ngp, igpig, apwalm, evecfv, evecsv, wfmt, ld, wfir)
subroutine getevecfv(fext, ikp, vpl, vgpl, evecfv)
subroutine getevecsv(fext, ikp, vpl, evecsv)
subroutine match(ngp, vgpc, gpc, sfacgp, apwalm)
real(8), dimension(:,:,:,:), allocatable vgkc
real(8), dimension(:), allocatable wkpt
complex(8), parameter zzero
real(8), dimension(:,:,:), allocatable gkc
integer, dimension(3) ngdgc
integer, dimension(:,:), allocatable ngk
integer, dimension(:,:,:), allocatable igkig
complex(8), parameter zone
integer, dimension(:), allocatable igfc
integer, dimension(maxatoms *maxspecies) idxis
real(8), dimension(:,:,:,:), allocatable vgkl
integer, dimension(maxspecies) npcmt
real(8), dimension(:,:), allocatable vkl
integer, dimension(:), allocatable iqfft
complex(8), dimension(:,:,:,:), allocatable sfacgk
integer, dimension(3) ngridq
subroutine holdthd(nloop, nthd)
real(8), dimension(:,:,:), allocatable rhormt
real(8), dimension(:,:,:,:), allocatable magrmt
real(8), dimension(:,:), allocatable occulr
real(8), dimension(:,:,:), allocatable magrir
real(8), dimension(:,:), allocatable rhorir
pure subroutine rmk2(n, wo, wf1, wf2, rho, mag)
pure subroutine rmk3(n, wo, wf, rho)
pure subroutine rmk1(n, wo, wf1, wf2, rho, mag1, mag2, mag3)
subroutine rhomaguk(ik0, lock, evecu)
subroutine zfftifc(nd, n, sgn, z)