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