6subroutine drhomagk(ngp,ngpq,igpig,igpqig,occsvp,doccsvp,apwalm,apwalmq, &
7 dapwalm,evecfv,devecfv,evecsv,devecsv)
12integer,
intent(in) :: ngp(nspnfv),ngpq(nspnfv)
13integer,
intent(in) :: igpig(ngkmax,nspnfv),igpqig(ngkmax,nspnfv)
14real(8),
intent(in) :: occsvp(nstsv),doccsvp(nstsv)
15complex(8),
intent(in) :: apwalm(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv)
16complex(8),
intent(in) :: apwalmq(ngkmax,apwordmax,lmmaxapw,natmtot,nspnfv)
17complex(8),
intent(in) :: dapwalm(ngkmax,apwordmax,lmmaxapw,nspnfv)
18complex(8),
intent(in) :: evecfv(nmatmax,nstfv,nspnfv)
19complex(8),
intent(in) :: devecfv(nmatmax,nstfv,nspnfv)
20complex(8),
intent(in) :: evecsv(nstsv,nstsv),devecsv(nstsv,nstsv)
28complex(8),
allocatable :: wfmt(:,:,:,:),wfir(:,:,:)
29complex(8),
allocatable :: dwfmt(:,:,:,:),dwfir(:,:,:)
33 if (abs(occsvp(ist)) <
epsocc) cycle
39call genwfsv(.false.,.false.,nst,idx,
ngdgc,
igfc,ngp,igpig,apwalm,evecfv,evecsv,&
43call 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), &
117deallocate(wfmt,wfir,dwfmt,dwfir)
122pure subroutine drmk1(n,wo,wf1,wf2,dwf1,dwf2,drho,dmag1,dmag2,dmag3)
125integer,
intent(in) :: n
126real(8),
intent(in) :: wo
127complex(8),
intent(in) :: wf1(n),wf2(n)
128complex(8),
intent(in) :: dwf1(n),dwf2(n)
129complex(8),
intent(inout) :: drho(n)
130complex(8),
intent(inout) :: dmag1(n),dmag2(n),dmag3(n)
133complex(8) z1,z2,z3,z4,z5,z6
141 drho(i)=drho(i)+wo*(z5+z6)
142 dmag3(i)=dmag3(i)+wo*(z5-z6)
145 dmag1(i)=dmag1(i)+wo*(z5+z6)
147 dmag2(i)=dmag2(i)+wo*
zmi*z5
151pure subroutine drmk01(n,dwo,wf1,wf2,drho,dmag1,dmag2,dmag3)
154integer,
intent(in) :: n
155real(8),
intent(in) :: dwo
156complex(8),
intent(in) :: wf1(n),wf2(n)
157complex(8),
intent(inout) :: drho(n)
158complex(8),
intent(inout) :: dmag1(n),dmag2(n),dmag3(n)
169 drho(i)=drho(i)+dwo*(t1+t2)
170 dmag1(i)=dmag1(i)+dwo*2.d0*z1%re
171 dmag2(i)=dmag2(i)+dwo*2.d0*z1%im
172 dmag3(i)=dmag3(i)+dwo*(t1-t2)
176pure subroutine drmk2(n,wo,wf1,wf2,dwf1,dwf2,drho,dmag)
179integer,
intent(in) :: n
180real(8),
intent(in) :: wo
181complex(8),
intent(in) :: wf1(n),wf2(n)
182complex(8),
intent(in) :: dwf1(n),dwf2(n)
183complex(8),
intent(inout) :: drho(n),dmag(n)
188 z1=conjg(wf1(i))*dwf1(i)
189 z2=conjg(wf2(i))*dwf2(i)
190 drho(i)=drho(i)+wo*(z1+z2)
191 dmag(i)=dmag(i)+wo*(z1-z2)
195pure subroutine drmk02(n,dwo,wf1,wf2,drho,dmag)
198integer,
intent(in) :: n
199real(8),
intent(in) :: dwo
200complex(8),
intent(in) :: wf1(n),wf2(n)
201complex(8),
intent(inout) :: drho(n),dmag(n)
206 t1=dble(wf1(i))**2+aimag(wf1(i))**2
207 t2=dble(wf2(i))**2+aimag(wf2(i))**2
208 drho(i)=drho(i)+dwo*(t1+t2)
209 dmag(i)=dmag(i)+dwo*(t1-t2)
213pure subroutine drmk3(n,wo,wf,dwf,drho)
216integer,
intent(in) :: n
217real(8),
intent(in) :: wo
218complex(8),
intent(in) :: wf(n),dwf(n)
219complex(8),
intent(inout) :: drho(n)
220drho(1:n)=drho(1:n)+wo*conjg(wf(1:n))*dwf(1:n)
226integer,
intent(in) :: n
227real(8),
intent(in) :: dwo
228complex(8),
intent(in) :: wf(n)
229complex(8),
intent(inout) :: drho(n)
230drho(1:n)=drho(1:n)+dwo*(dble(wf(1:n))**2+aimag(wf(1:n))**2)