11integer,
intent(in) :: ik
12complex(8),
intent(in) :: vclcv(ncrmax,natmtot,nstsv,nkpt)
13complex(8),
intent(in) :: vclvv(nstsv,nstsv,nkpt)
17integer nrc,nrci,npc,nthd
21complex(4) wfcr(npcmtmax,2),cfmt1(npcmtmax),cvfmt1(npcmtmax,ndmag)
23complex(8),
allocatable :: apwalm(:,:,:,:),evecfv(:,:),evecsv(:,:)
24complex(4),
allocatable :: wfmt(:,:,:,:),wfir(:,:,:)
25complex(4),
allocatable :: cfmt2(:,:),cfir2(:)
26complex(4),
allocatable :: cvfmt2(:,:,:),cvfir2(:,:)
28complex(8),
external :: rcfinp,rcfmtinp
36call match(
ngk(1,ik),
vgkc(:,:,1,ik),
gkc(:,1,ik),
sfacgk(:,:,1,ik),apwalm)
39call genwfsv_sp(.false.,.false.,nstsv,[0],
ngridg,
igfft,
ngk(1,ik),
igkig(:,1,ik),&
40 apwalm,evecfv,evecsv,wfmt,
ngtot,wfir)
41deallocate(apwalm,evecfv,evecsv)
59 if (.not.
spcore(ist,is)) cycle
60 do m=-
ksp(ist,is),
ksp(ist,is)-1
71 call gencrm(npc,wfcr,wfcr(:,2),wfmt(:,ias,1,jst),wfmt(:,ias,2,jst),&
72 cfmt1,npcmtmax,cvfmt1)
75 cfmt1(1:npc)=conjg(wfcr(1:npc,1))*wfmt(1:npc,ias,1,jst)
77 z1=conjg(vclcv(ic,ias,jst,ik))
90 call rcadd(npc,z1,cvfmt1(:,idm),
dbxmt(:,ias,idm))
105allocate(cfmt2(npcmtmax,natmtot),cfir2(
ngtot))
107 allocate(cvfmt2(npcmtmax,natmtot,ndmag),cvfir2(
ngtot,ndmag))
116 call gencfrm(wfmt(:,:,1,ist),wfmt(:,:,2,ist),wfir(:,1,ist),wfir(:,2,ist),&
117 wfmt(:,:,1,jst),wfmt(:,:,2,jst),wfir(:,1,jst),wfir(:,2,jst),cfmt2,cfir2,&
121 call gencrho(.false.,.true.,
ngtot,wfmt(:,:,:,ist),wfir(:,:,ist), &
122 wfmt(:,:,:,jst),wfir(:,:,jst),cfmt2,cfir2)
124 z1=conjg(vclvv(ist,jst,ik))
128 z2=rcfinp(
bxmt(:,:,idm),
bxir(:,idm),cvfmt2(:,:,idm),cvfir2(:,idm))
137 call rcfadd(z1,cvfmt2(:,:,idm),cvfir2(:,idm),
dbxmt(:,:,idm),
dbxir(:,idm))
145deallocate(cfmt2,cfir2)
146if (
spinpol)
deallocate(cvfmt2,cvfir2)
153pure subroutine rcfadd(z,cfmt,cfir,rfmt,rfir)
156complex(8),
intent(in) :: z
157complex(4),
intent(in) :: cfmt(npcmtmax,natmtot),cfir(
ngtot)
158real(8),
intent(inout) :: rfmt(npcmtmax,natmtot),rfir(
ngtot)
163 call rcadd(
npcmt(is),z,cfmt(:,ias),rfmt(:,ias))
171integer,
intent(in) :: n
172complex(8),
intent(in) :: z
173complex(4),
intent(in) :: cv(n)
174real(8),
intent(out) :: rv(n)
180if (abs(a) > 1.d-12)
then
181 if (abs(b) > 1.d-12)
then
183 rv(i)=rv(i)+a*real(cv(i))+b*aimag(cv(i))
186 rv(1:n)=rv(1:n)+a*real(cv(1:n))
189 if (abs(b) > 1.d-12) rv(1:n)=rv(1:n)+b*aimag(cv(1:n))
subroutine gencfrm(wfmt11, wfmt12, wfir11, wfir12, wfmt21, wfmt22, wfir21, wfir22, crhomt, crhoir, cmagmt, cmagir)
subroutine gencrho(tsh, tspc, ngt, wfmt1, wfir1, wfmt2, wfir2, crhomt, crhoir)
pure subroutine gencrm(n, wf11, wf12, wf21, wf22, crho, ld, cmag)
subroutine genwfsv_sp(tsh, tgp, nst, idx, ngridg_, igfft_, ngp, igpig, apwalm, evecfv, evecsv, wfmt, ld, wfir)
subroutine getevalsv(fext, ikp, vpl, evalsv_)
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 evalcr
real(8), dimension(:), allocatable wkpt
integer, dimension(3) ngridg
real(8), dimension(:,:,:), allocatable gkc
integer, dimension(maxspecies) natoms
logical, dimension(maxstsp, maxspecies) spcore
real(8), dimension(:,:), allocatable dbxir
real(8), dimension(:,:), allocatable bxir
integer, dimension(maxatoms, maxspecies) idxas
integer, dimension(:,:), allocatable ngk
integer, dimension(:,:,:), allocatable igkig
integer, dimension(maxspecies) nrcmt
integer, dimension(maxatoms *maxspecies) idxis
integer, dimension(maxspecies) nstsp
real(8), dimension(:,:), allocatable wr2cmt
real(8), dimension(:), allocatable vxir
real(8), dimension(:,:,:,:), allocatable vgkl
integer, dimension(maxspecies) npcmt
integer, dimension(:), allocatable igfft
integer, dimension(maxstsp, maxspecies) ksp
real(8), dimension(:,:,:), allocatable bxmt
real(8), dimension(:,:), allocatable vkl
real(8), dimension(:,:), allocatable dvxmt
real(8), dimension(:,:), allocatable vxmt
complex(8), dimension(:,:,:,:), allocatable sfacgk
integer, dimension(maxspecies) nrcmti
real(8), dimension(:), allocatable dvxir
real(8), dimension(:,:,:), allocatable dbxmt
real(8), dimension(:,:), allocatable evalsv
subroutine holdthd(nloop, nthd)
pure subroutine rcadd(n, z, cv, rv)
pure subroutine rcfadd(z, cfmt, cfir, rfmt, rfir)
subroutine oepresk(ik, vclcv, vclvv)
pure complex(8) function rcfmtinp(nr, nri, wr, rfmt, cfmt)
pure subroutine wavefcr(tsh, lrstp, is, ia, ist, m, ld, wfcr)