6 subroutine drhomagk(ngp,ngpq,igpig,igpqig,occsvp,doccsvp,apwalm,apwalmq, &
7 dapwalm,evecfv,devecfv,evecsv,devecsv)
12 integer,
intent(in) :: ngp(nspnfv),ngpq(nspnfv)
13 integer,
intent(in) :: igpig(ngkmax,nspnfv),igpqig(ngkmax,nspnfv)
14 real(8),
intent(in) :: occsvp(nstsv),doccsvp(nstsv)
15 complex(8),
intent(in) :: apwalm(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv)
16 complex(8),
intent(in) :: apwalmq(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv)
17 complex(8),
intent(in) :: dapwalm(ngkmax,apwordmax,lmmaxapw,nspnfv)
18 complex(8),
intent(in) :: evecfv(nmatmax,nstfv,nspnfv)
19 complex(8),
intent(in) :: devecfv(nmatmax,nstfv,nspnfv)
20 complex(8),
intent(in) :: evecsv(nstsv,nstsv),devecsv(nstsv,nstsv)
28 complex(8),
allocatable :: wfmt(:,:,:,:),wfir(:,:,:)
29 complex(8),
allocatable :: dwfmt(:,:,:,:),dwfir(:,:,:)
33 if (abs(occsvp(ist)) <
epsocc) cycle
39 call genwfsv(.false.,.false.,nst,idx,
ngdgc,
igfc,ngp,igpig,apwalm,evecfv,evecsv,&
43 call gendwfsv(.false.,.false.,nst,idx,ngp,ngpq,igpqig,apwalmq,dapwalm,evecfv, &
44 devecfv,evecsv,devecsv,dwfmt,
ngtc,dwfir)
61 call drmk1(npc,wo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
62 dwfmt(:,ias,1,jst),dwfmt(:,ias,2,jst),
drhomt(:,ias),
dmagmt(:,ias,1), &
65 call drmk01(npc,dwo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
66 drhomt(:,ias),
dmagmt(:,ias,1),
dmagmt(:,ias,2),
dmagmt(:,ias,3))
70 call drmk2(npc,wo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
71 dwfmt(:,ias,1,jst),dwfmt(:,ias,2,jst),
drhomt(:,ias),
dmagmt(:,ias,1))
73 call drmk02(npc,dwo,wfmt(:,ias,1,jst),wfmt(:,ias,2,jst), &
79 call drmk3(npc,wo,wfmt(:,ias,1,jst),dwfmt(:,ias,1,jst),
drhomt(:,ias))
93 call drmk1(
ngtc,wo,wfir(:,1,jst),wfir(:,2,jst),dwfir(:,1,jst), &
96 call drmk01(
ngtc,dwo,wfir(:,1,jst),wfir(:,2,jst),
drhoir,
dmagir, &
101 call drmk2(
ngtc,wo,wfir(:,1,jst),wfir(:,2,jst),dwfir(:,1,jst), &
117 deallocate(wfmt,wfir,dwfmt,dwfir)
121 pure subroutine drmk1(n,wo,wf1,wf2,dwf1,dwf2,drho,dmag1,dmag2,dmag3)
124 integer,
intent(in) :: n
125 real(8),
intent(in) :: wo
126 complex(8),
intent(in) :: wf1(n),wf2(n)
127 complex(8),
intent(in) :: dwf1(n),dwf2(n)
128 complex(8),
intent(inout) :: drho(n)
129 complex(8),
intent(inout) :: dmag1(n),dmag2(n),dmag3(n)
132 complex(8) z1,z2,z3,z4,z5,z6
140 drho(i)=drho(i)+wo*(z5+z6)
141 dmag3(i)=dmag3(i)+wo*(z5-z6)
144 dmag1(i)=dmag1(i)+wo*(z5+z6)
146 dmag2(i)=dmag2(i)+wo*cmplx(z5%im,-z5%re,8)
150 pure subroutine drmk01(n,dwo,wf1,wf2,drho,dmag1,dmag2,dmag3)
153 integer,
intent(in) :: n
154 real(8),
intent(in) :: dwo
155 complex(8),
intent(in) :: wf1(n),wf2(n)
156 complex(8),
intent(inout) :: drho(n)
157 complex(8),
intent(inout) :: dmag1(n),dmag2(n),dmag3(n)
168 drho(i)=drho(i)+dwo*(t1+t2)
169 dmag1(i)=dmag1(i)+dwo*2.d0*z1%re
170 dmag2(i)=dmag2(i)+dwo*2.d0*z1%im
171 dmag3(i)=dmag3(i)+dwo*(t1-t2)
175 pure subroutine drmk2(n,wo,wf1,wf2,dwf1,dwf2,drho,dmag)
178 integer,
intent(in) :: n
179 real(8),
intent(in) :: wo
180 complex(8),
intent(in) :: wf1(n),wf2(n)
181 complex(8),
intent(in) :: dwf1(n),dwf2(n)
182 complex(8),
intent(inout) :: drho(n),dmag(n)
187 z1=conjg(wf1(i))*dwf1(i)
188 z2=conjg(wf2(i))*dwf2(i)
189 drho(i)=drho(i)+wo*(z1+z2)
190 dmag(i)=dmag(i)+wo*(z1-z2)
194 pure subroutine drmk02(n,dwo,wf1,wf2,drho,dmag)
197 integer,
intent(in) :: n
198 real(8),
intent(in) :: dwo
199 complex(8),
intent(in) :: wf1(n),wf2(n)
200 complex(8),
intent(inout) :: drho(n),dmag(n)
205 t1=dble(wf1(i))**2+aimag(wf1(i))**2
206 t2=dble(wf2(i))**2+aimag(wf2(i))**2
207 drho(i)=drho(i)+dwo*(t1+t2)
208 dmag(i)=dmag(i)+dwo*(t1-t2)
212 pure subroutine drmk3(n,wo,wf,dwf,drho)
215 integer,
intent(in) :: n
216 real(8),
intent(in) :: wo
217 complex(8),
intent(in) :: wf(n),dwf(n)
218 complex(8),
intent(inout) :: drho(n)
219 drho(1:n)=drho(1:n)+wo*conjg(wf(1:n))*dwf(1:n)
222 pure subroutine drmk03(n,dwo,wf,drho)
225 integer,
intent(in) :: n
226 real(8),
intent(in) :: dwo
227 complex(8),
intent(in) :: wf(n)
228 complex(8),
intent(inout) :: drho(n)
229 drho(1:n)=drho(1:n)+dwo*(dble(wf(1:n))**2+aimag(wf(1:n))**2)
subroutine drhomagk(ngp, ngpq, igpig, igpqig, occsvp, doccsvp, apwalm, apwalmq, dapwalm, evecfv, devecfv, evecsv, devecsv)
complex(8), dimension(:,:), pointer, contiguous dmagir
integer, dimension(maxspecies) npcmt
subroutine genwfsv(tsh, tgp, nst, idx, ngridg_, igfft_, ngp, igpig, apwalm, evecfv, evecsv, wfmt, ld, wfir)
complex(8), dimension(:,:), pointer, contiguous drhomt
pure subroutine drmk1(n, wo, wf1, wf2, dwf1, dwf2, drho, dmag1, dmag2, dmag3)
pure subroutine drmk02(n, dwo, wf1, wf2, drho, dmag)
pure subroutine drmk01(n, dwo, wf1, wf2, drho, dmag1, dmag2, dmag3)
complex(8), dimension(:,:,:), pointer, contiguous dmagmt
pure subroutine drmk3(n, wo, wf, dwf, drho)
integer, dimension(:), allocatable igfc
subroutine gendwfsv(tsh, tgp, nst, idx, ngp, ngpq, igpqig, apwalmq, dapwalm, evecfv, devecfv, evecsv, devecsv, dwfmt, ld, dwfir)
integer, dimension(maxatoms *maxspecies) idxis
pure subroutine drmk03(n, dwo, wf, drho)
complex(8), dimension(:), pointer, contiguous drhoir
integer, dimension(3) ngdgc
pure subroutine drmk2(n, wo, wf1, wf2, dwf1, dwf2, drho, dmag)