2003-10-16 22:39:25 +08:00
|
|
|
!--------------------------------------------------------
|
|
|
|
subroutine add_zstar_ue_us(imode0,npe)
|
|
|
|
!----------===============-------------------------------
|
|
|
|
! add the contribution of the modes imode0+1 -> imode+npe
|
|
|
|
! to the effective charges Z(Us,E) (Us=scf,E=bare)
|
|
|
|
!
|
|
|
|
! This subroutine is just for the USPP case
|
|
|
|
!
|
|
|
|
! trans =.true. is needed for this calculation to be meaningful
|
|
|
|
!
|
|
|
|
#include "machine.h"
|
|
|
|
|
|
|
|
USE pwcom
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, ONLY : DP
|
2003-11-09 18:42:50 +08:00
|
|
|
USE wavefunctions_module, ONLY : evc
|
2003-11-10 02:30:08 +08:00
|
|
|
USE io_files, ONLY: iunigk
|
2003-10-16 22:39:25 +08:00
|
|
|
USE phcom
|
|
|
|
USE becmod
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
integer, intent(in) :: imode0, npe
|
|
|
|
|
|
|
|
integer :: ik, jpol, nrec, mode, ipert, ibnd, jbnd, i,j
|
|
|
|
|
|
|
|
real(kind = dp) :: weight
|
|
|
|
|
|
|
|
complex(kind=DP), allocatable :: pdsp(:,:)
|
2003-10-24 23:57:43 +08:00
|
|
|
complex(kind=DP), allocatable :: dvkb(:,:,:)
|
2003-10-16 22:39:25 +08:00
|
|
|
! auxiliary space for <psi|ds/du|psi>
|
|
|
|
|
|
|
|
!
|
|
|
|
! Here we calculate the dipole of q
|
|
|
|
! (Just to be sure, this has already beeen done in phq_setup)
|
|
|
|
!
|
2003-10-24 23:57:43 +08:00
|
|
|
call start_clock('add_zstar_us')
|
2003-10-16 22:39:25 +08:00
|
|
|
call compute_qdipol
|
|
|
|
|
|
|
|
allocate (pdsp(nbnd,nbnd))
|
2003-10-24 23:57:43 +08:00
|
|
|
allocate (dvkb(npwx,nkb,3))
|
2003-10-16 22:39:25 +08:00
|
|
|
if (nksq.gt.1) rewind (iunigk)
|
|
|
|
do ik = 1, nksq
|
|
|
|
if (nksq.gt.1) read (iunigk) npw, igk
|
|
|
|
npwq = npw
|
|
|
|
weight = wk (ik)
|
|
|
|
if (nksq.gt.1) call davcio (evc, lrwfc, iuwfc, ik, - 1)
|
|
|
|
call init_us_2 (npw, igk, xk (1, ik), vkb)
|
2003-10-24 23:57:43 +08:00
|
|
|
call dvkb3(ik,dvkb)
|
2003-10-16 22:39:25 +08:00
|
|
|
do ipert = 1, npe
|
|
|
|
mode = imode0 + ipert
|
|
|
|
do jpol = 1, 3
|
|
|
|
dvpsi = (0.d0,0.d0)
|
|
|
|
!
|
2003-10-24 23:57:43 +08:00
|
|
|
! read/compute the Commutator with the additional term
|
|
|
|
call dvpsi_e(ik,jpol)
|
2003-10-16 22:39:25 +08:00
|
|
|
!
|
|
|
|
! Calculate the matrix elements <psi_v'k|dS/du|psi_vk>
|
|
|
|
! Note: we need becp1
|
|
|
|
!
|
|
|
|
pdsp = (0.d0,0.d0)
|
|
|
|
call psidspsi (ik, u (1, mode), pdsp,npw)
|
|
|
|
#ifdef __PARA
|
2003-10-24 23:57:43 +08:00
|
|
|
call reduce(2*nbnd*nbnd,pdsp)
|
2003-10-16 22:39:25 +08:00
|
|
|
#endif
|
|
|
|
!
|
|
|
|
! add the term of the double summation
|
|
|
|
!
|
|
|
|
do ibnd = 1, nbnd
|
|
|
|
do jbnd = 1, nbnd
|
|
|
|
zstarue0(mode,jpol)=zstarue0(mode,jpol) + &
|
|
|
|
weight * &
|
|
|
|
dot_product(evc(1:npw,ibnd),dvpsi(1:npw,jbnd))* &
|
|
|
|
pdsp(jbnd,ibnd)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
dvpsi = (0.d0,0.d0)
|
|
|
|
dpsi = (0.d0,0.d0)
|
|
|
|
!
|
|
|
|
! For the last part, we read the commutator from disc,
|
|
|
|
! but this time we calculate
|
|
|
|
! dS/du P_c [H-eS]|psi> + (dK(r)/du - dS/du)r|psi>
|
|
|
|
!
|
|
|
|
! first we read P_c [H-eS]|psi> and store it in dpsi
|
|
|
|
!
|
|
|
|
nrec = (jpol - 1) * nksq + ik
|
|
|
|
call davcio (dpsi, lrcom, iucom, nrec, -1)
|
|
|
|
!
|
|
|
|
! Apply the matrix dS/du, the result is stored in dvpsi
|
|
|
|
!
|
|
|
|
call add_for_charges(ik, u(1,mode))
|
|
|
|
!
|
|
|
|
! Add (dK(r)/du - dS/du) r | psi>
|
|
|
|
!
|
2003-10-24 23:57:43 +08:00
|
|
|
call add_dkmds(ik, u(1,mode),jpol, dvkb)
|
2003-10-16 22:39:25 +08:00
|
|
|
!
|
|
|
|
! And calculate finally the scalar product
|
|
|
|
!
|
|
|
|
do ibnd = 1, nbnd
|
|
|
|
zstarue0(mode,jpol)=zstarue0(mode,jpol) - weight * &
|
|
|
|
dot_product(evc(1:npw,ibnd),dvpsi(1:npw,ibnd))
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
2003-10-24 23:57:43 +08:00
|
|
|
deallocate(dvkb)
|
2003-10-16 22:39:25 +08:00
|
|
|
deallocate(pdsp)
|
2003-10-24 23:57:43 +08:00
|
|
|
call stop_clock('add_zstar_us')
|
2003-10-16 22:39:25 +08:00
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine add_zstar_ue_us
|
|
|
|
|