2003-01-23 22:55:06 +08:00
|
|
|
subroutine compute_qdipol
|
|
|
|
!
|
|
|
|
! This routine computes the term dpqq, i.e. the dipole moment of the
|
|
|
|
! augmentation charge.
|
|
|
|
!
|
|
|
|
use pwcom
|
|
|
|
use parameters, only: DP
|
|
|
|
use phcom
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=dp), allocatable :: qrad2(:,:,:), qtot(:,:,:), aux(:)
|
2003-01-23 22:55:06 +08:00
|
|
|
|
|
|
|
real(kind=dp) :: fact
|
|
|
|
|
|
|
|
integer :: nt, l, ir, nb, mb, ilast, ipol, ih, ivl, jh, jvl, lp
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
allocate (qrad2( nbrx , nbrx, ntyp))
|
|
|
|
allocate (aux( ndm))
|
|
|
|
allocate (qtot( ndm, nbrx, nbrx))
|
2003-01-23 22:55:06 +08:00
|
|
|
|
|
|
|
qrad2(:,:,:)=0.d0
|
|
|
|
dpqq=0.d0
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
do nt = 1, ntyp
|
|
|
|
if (tvanp (nt) ) then
|
2003-01-23 22:55:06 +08:00
|
|
|
l=1
|
|
|
|
!
|
|
|
|
! Only l=1 terms enter in the dipole of Q
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do nb = 1, nbeta (nt)
|
|
|
|
do mb = nb, nbeta (nt)
|
2003-01-23 22:55:06 +08:00
|
|
|
if ((l.ge.abs(lll(nb,nt)-lll(mb,nt))) .and. &
|
|
|
|
(l.le.lll(nb,nt)+lll(mb,nt)) .and. &
|
|
|
|
(mod (l+lll(nb,nt)+lll(mb,nt),2) .eq.0) ) then
|
2003-02-08 00:04:36 +08:00
|
|
|
do ir = 1, kkbeta (nt)
|
|
|
|
if (r(ir, nt).ge.rinner(l+1, nt)) then
|
2003-01-23 22:55:06 +08:00
|
|
|
qtot(ir, nb, mb)=qfunc(ir,nb,mb,nt)
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
|
|
|
ilast = ir
|
2003-01-23 22:55:06 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
if (rinner(l+1, nt).gt.0.d0) &
|
|
|
|
call setqf(qfcoef (1, l+1, nb, mb, nt), &
|
|
|
|
qtot(1,nb,mb), r(1,nt), nqf(nt),l,ilast)
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
do nb=1, nbeta(nt)
|
2003-01-23 22:55:06 +08:00
|
|
|
!
|
|
|
|
! the Q are symmetric with respect to indices
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do mb=nb, nbeta(nt)
|
2003-01-23 22:55:06 +08:00
|
|
|
if ( (l.ge.abs(lll(nb,nt)-lll(mb,nt) ) ) .and. &
|
|
|
|
(l.le.lll(nb,nt) + lll(mb,nt) ) .and. &
|
|
|
|
(mod(l+lll(nb,nt)+lll(mb,nt), 2).eq.0) ) then
|
|
|
|
do ir = 1, kkbeta (nt)
|
|
|
|
aux(ir)=r(ir, nt)*qtot(ir, nb, mb)
|
|
|
|
enddo
|
|
|
|
call simpson (kkbeta(nt),aux,rab(1,nt),qrad2(nb,mb,nt))
|
|
|
|
endif
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
enddo
|
2003-01-23 22:55:06 +08:00
|
|
|
endif
|
|
|
|
! ntyp
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
|
|
do ipol = 1,3
|
|
|
|
fact=-sqrt(fpi/3.d0)
|
|
|
|
if (ipol.eq.1) lp=3
|
|
|
|
if (ipol.eq.2) lp=4
|
2003-02-08 00:04:36 +08:00
|
|
|
if (ipol.eq.3) then
|
2003-01-23 22:55:06 +08:00
|
|
|
lp=2
|
|
|
|
fact=-fact
|
|
|
|
endif
|
|
|
|
do nt = 1,ntyp
|
|
|
|
if (tvanp(nt)) then
|
|
|
|
do ih = 1, nh(nt)
|
|
|
|
ivl = nhtol(ih, nt)*nhtol(ih, nt)+nhtom(ih,nt)
|
|
|
|
mb = indv(ih, nt)
|
|
|
|
do jh = ih, nh (nt)
|
|
|
|
jvl = nhtol(jh, nt)*nhtol(jh,nt)+nhtom(jh,nt)
|
|
|
|
nb=indv(jh,nt)
|
|
|
|
if (ivl.gt.nlx) call error('compute_qdipol',' ivl.gt.nlx', ivl)
|
|
|
|
if (jvl.gt.nlx) call error('compute_qdipol',' jvl.gt.nlx', jvl)
|
|
|
|
if (nb.gt.nbrx) call error('compute_qdipol',' nb.gt.nbrx', nb)
|
|
|
|
if (mb.gt.nbrx) call error('compute_qdipol',' mb.gt.nbrx', mb)
|
|
|
|
if (mb.gt.nb) call error('compute_qdipol',' mb.gt.nb', 1)
|
|
|
|
dpqq(ih,jh,ipol,nt)=fact*ap(lp,ivl,jvl)*qrad2(mb,nb,nt)
|
|
|
|
dpqq(jh,ih,ipol,nt)=dpqq(ih,jh,ipol,nt)
|
|
|
|
! write(6,'(3i5,2f15.9)') ih,jh,ipol,dpqq(ih,jh,ipol,nt)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
deallocate(qtot)
|
|
|
|
deallocate(aux)
|
|
|
|
deallocate(qrad2)
|
2003-01-23 22:55:06 +08:00
|
|
|
|
|
|
|
return
|
|
|
|
end
|