2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2001 PWSCF group
|
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine zstar_eu
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
! calculate the effective charges Z(E,Us) (E=scf,Us=bare)
|
|
|
|
!
|
|
|
|
! epsil =.true. is needed for this calculation to be meaningful
|
|
|
|
!
|
|
|
|
#include "machine.h"
|
|
|
|
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
use pwcom
|
|
|
|
use parameters, only : DP
|
|
|
|
use phcom
|
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
integer :: ibnd, ipol, jpol, icart, na, nu, mu, imode0, irr, &
|
|
|
|
imode, nrec, mode, ik
|
|
|
|
! counter on bands
|
|
|
|
! counter on polarization
|
|
|
|
! counter on cartesian coordinates
|
|
|
|
! counter on atoms and modes
|
|
|
|
! counter on modes
|
|
|
|
! counter on modes
|
|
|
|
! counter on records
|
|
|
|
! counter on modes
|
|
|
|
! counter on k points
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: work (3, 3, nat), weight
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliary space
|
|
|
|
!
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
complex(kind=DP) :: ZDOTC
|
2003-01-20 05:58:50 +08:00
|
|
|
! scalar product
|
2003-02-08 00:04:36 +08:00
|
|
|
call setv (2 * 9 * nat, 0.d0, zstareu0, 1)
|
|
|
|
call setv (9 * nat, 0.d0, zstareu, 1)
|
2003-01-21 23:25:13 +08:00
|
|
|
|
|
|
|
if (okvan) then
|
2003-02-21 22:57:00 +08:00
|
|
|
call errore('zstar_eu', 'Effective charges not implemented',-1)
|
2003-01-21 23:25:13 +08:00
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
2003-02-08 00:04:36 +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)
|
|
|
|
imode0 = 0
|
|
|
|
do irr = 1, nirr
|
|
|
|
do imode = 1, npert (irr)
|
|
|
|
mode = imode+imode0
|
|
|
|
call setv (2 * npwx * nbndx, 0.d0, dvpsi, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! recalculate DeltaV*psi(ion) for mode nu
|
|
|
|
!
|
2003-02-17 22:16:34 +08:00
|
|
|
call dvqpsi_us (ik, mode, u (1, mode),.true. )
|
2003-02-08 00:04:36 +08:00
|
|
|
do jpol = 1, 3
|
|
|
|
nrec = (jpol - 1) * nksq + ik
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! read DeltaV*psi(scf) for electric field in jpol direction
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call davcio (dpsi, lrdwf, iudwf, nrec, - 1)
|
|
|
|
do ibnd = 1, nbnd
|
2003-01-21 23:25:13 +08:00
|
|
|
zstareu0(jpol,mode)=zstareu0(jpol, mode)-2.d0*weight*&
|
|
|
|
ZDOTC(npw,dpsi(1,ibnd),1,dvpsi(1,ibnd),1)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
imode0 = imode0 + npert (irr)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-21 22:57:00 +08:00
|
|
|
#ifdef __PARA
|
2003-02-08 00:04:36 +08:00
|
|
|
call reduce (18 * nat, zstareu0)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call poolreduce (18 * nat, zstareu0)
|
2003-01-20 05:58:50 +08:00
|
|
|
#endif
|
|
|
|
!
|
|
|
|
! bring the mode index to cartesian coordinates
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do jpol = 1, 3
|
|
|
|
do mu = 1, 3 * nat
|
|
|
|
na = (mu - 1) / 3 + 1
|
|
|
|
icart = mu - 3 * (na - 1)
|
|
|
|
do nu = 1, 3 * nat
|
2003-01-20 05:58:50 +08:00
|
|
|
zstareu (jpol, icart, na) = zstareu (jpol, icart, na) + conjg (u ( &
|
|
|
|
mu, nu) ) * zstareu0 (jpol, nu)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
call setv (9 * nat, 0.d0, work, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! bring to crystal axis for symmetrization
|
|
|
|
! NOTA BENE: the electric fields are already in crystal axis
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do na = 1, nat
|
|
|
|
do ipol = 1, 3
|
|
|
|
do jpol = 1, 3
|
|
|
|
do icart = 1, 3
|
2003-01-20 05:58:50 +08:00
|
|
|
work (jpol, ipol, na) = work (jpol, ipol, na) + zstareu (jpol, &
|
|
|
|
icart, na) * at (icart, ipol)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
|
|
enddo
|
|
|
|
! write(6,'(/,10x,"Effective charges E-U in crystal axis ",/)')
|
|
|
|
! do na=1,nat
|
|
|
|
! write(6,'(10x," atom ",i6)') na
|
|
|
|
! write(6,'(10x,"(",3f15.5," )")') ((work(jpol,ipol,na),
|
|
|
|
! + ipol=1,3),jpol=1,3)
|
|
|
|
! enddo
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call symz (work, nsym, s, nat, irt)
|
|
|
|
do na = 1, nat
|
|
|
|
call trntns (work (1, 1, na), at, bg, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
call DCOPY (9 * nat, work, 1, zstareu, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! add the diagonal part
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do ipol = 1, 3
|
|
|
|
do na = 1, nat
|
2003-01-20 05:58:50 +08:00
|
|
|
zstareu (ipol, ipol, na) = zstareu (ipol, ipol, na) + zv (ityp ( &
|
|
|
|
na) )
|
|
|
|
enddo
|
|
|
|
|
|
|
|
enddo
|
|
|
|
write (6, '(/,10x,"Effective charges E-U in cartesian axis ",/)' &
|
|
|
|
&)
|
2003-02-08 00:04:36 +08:00
|
|
|
do na = 1, nat
|
|
|
|
write (6, '(10x," atom ",i6)') na
|
2003-01-20 05:58:50 +08:00
|
|
|
write (6, '(10x,"(",3f15.5," )")') ( (zstareu (ipol, jpol, na) &
|
|
|
|
, ipol = 1, 3) , jpol = 1, 3)
|
|
|
|
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine zstar_eu
|