2003-01-23 22:51:02 +08:00
|
|
|
!
|
2008-08-24 01:55:06 +08:00
|
|
|
! Copyright (C) 2001-2008 Quantum_ESPRESSO group
|
2005-03-21 22:01:19 +08:00
|
|
|
! 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 .
|
|
|
|
!
|
2004-06-01 01:55:33 +08:00
|
|
|
subroutine adddvepsi_us(becp2,ipol,kpoint)
|
|
|
|
! This subdoutine adds to dvpsi the terms which depend on the augmentation
|
|
|
|
! charge. It assume that the variable dpqq, has been set.
|
2009-02-12 16:56:50 +08:00
|
|
|
! It calculates the last two terms of Eq.10 in JCP 21, 9934 (2004).
|
|
|
|
! P^+_c is applied in solve_e.
|
2004-06-01 01:55:33 +08:00
|
|
|
!
|
2003-01-23 22:51:02 +08:00
|
|
|
|
2008-08-24 01:55:06 +08:00
|
|
|
USE kinds, only : DP
|
|
|
|
USE lsda_mod, ONLY : nspin
|
|
|
|
USE spin_orb, ONLY : lspinorb
|
|
|
|
USE uspp, ONLY : nkb, vkb, qq, qq_so
|
|
|
|
USE wvfct, ONLY : npwx, npw, nbnd
|
|
|
|
USE cell_base, ONLY : at
|
2004-06-12 21:44:18 +08:00
|
|
|
USE ions_base, ONLY : nat, ityp, ntyp => nsp
|
2007-10-09 00:17:11 +08:00
|
|
|
USE noncollin_module, ONLY : noncolin, npol
|
2004-06-01 01:55:33 +08:00
|
|
|
USE uspp_param, only: nh
|
2009-02-02 18:52:58 +08:00
|
|
|
USE phus, ONLY : becp1, becp1_nc, dpqq, dpqq_so
|
|
|
|
USE control_ph, ONLY: nbnd_occ
|
|
|
|
USE eqv, ONLY : dvpsi
|
2004-06-01 01:55:33 +08:00
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
integer, intent(in) :: ipol, kpoint
|
2007-10-09 00:17:11 +08:00
|
|
|
complex(DP), intent(in) :: becp2(nkb,npol,nbnd)
|
2004-06-01 01:55:33 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: fact
|
2007-10-09 00:17:11 +08:00
|
|
|
complex(DP), allocatable :: ps(:), ps_nc(:,:), fact_so(:)
|
|
|
|
integer:: ijkb0, nt, na, ih, jh, ikb, jkb, ibnd, ip, is
|
2004-06-01 01:55:33 +08:00
|
|
|
|
2007-10-09 00:17:11 +08:00
|
|
|
IF (noncolin) THEN
|
|
|
|
allocate (ps_nc(nbnd,npol))
|
|
|
|
allocate (fact_so(nspin))
|
|
|
|
ELSE
|
|
|
|
allocate (ps(nbnd))
|
|
|
|
END IF
|
2004-06-01 01:55:33 +08:00
|
|
|
|
|
|
|
ijkb0 = 0
|
|
|
|
do nt = 1, ntyp
|
|
|
|
do na = 1, nat
|
|
|
|
if (ityp(na).eq.nt) then
|
|
|
|
do ih = 1, nh (nt)
|
|
|
|
ikb = ijkb0 + ih
|
2007-10-09 00:17:11 +08:00
|
|
|
IF (noncolin) THEN
|
|
|
|
ps_nc = (0.d0,0.d0)
|
|
|
|
ELSE
|
|
|
|
ps = (0.d0,0.d0)
|
|
|
|
END IF
|
2004-06-01 01:55:33 +08:00
|
|
|
do jh = 1, nh (nt)
|
|
|
|
jkb = ijkb0 + jh
|
2007-10-09 00:17:11 +08:00
|
|
|
IF (lspinorb) THEN
|
|
|
|
do is=1,nspin
|
|
|
|
fact_so(is)=at(1,ipol)*dpqq_so(ih,jh,is,1,nt)+ &
|
|
|
|
at(2,ipol)*dpqq_so(ih,jh,is,2,nt)+ &
|
|
|
|
at(3,ipol)*dpqq_so(ih,jh,is,3,nt)
|
|
|
|
enddo
|
|
|
|
ELSE
|
|
|
|
fact=at(1,ipol)*dpqq(ih,jh,1,nt)+ &
|
|
|
|
at(2,ipol)*dpqq(ih,jh,2,nt)+ &
|
|
|
|
at(3,ipol)*dpqq(ih,jh,3,nt)
|
|
|
|
END IF
|
2004-06-01 01:55:33 +08:00
|
|
|
do ibnd=1, nbnd_occ(kpoint)
|
2007-10-09 00:17:11 +08:00
|
|
|
IF (noncolin) THEN
|
|
|
|
DO ip=1,npol
|
|
|
|
IF (lspinorb) THEN
|
|
|
|
ps_nc(ibnd,ip)=ps_nc(ibnd,ip) + &
|
|
|
|
(0.d0,1.d0)*(becp2(jkb,1,ibnd)* &
|
|
|
|
qq_so(ih,jh,1+(ip-1)*2,nt) + &
|
|
|
|
becp2(jkb,2,ibnd) * &
|
|
|
|
qq_so(ih,jh,2+(ip-1)*2,nt) ) &
|
|
|
|
+ becp1_nc(jkb,1,ibnd,kpoint)* &
|
|
|
|
fact_so(1+(ip-1)*2) &
|
|
|
|
+ becp1_nc(jkb,2,ibnd,kpoint)* &
|
|
|
|
fact_so(2+(ip-1)*2)
|
|
|
|
ELSE
|
|
|
|
ps_nc(ibnd,ip)=ps_nc(ibnd,ip)+ &
|
|
|
|
becp2(jkb,ip,ibnd)*(0.d0,1.d0)* &
|
|
|
|
qq(ih,jh,nt)+becp1_nc(jkb,ip,ibnd,kpoint) &
|
|
|
|
*fact
|
|
|
|
END IF
|
|
|
|
END DO
|
|
|
|
ELSE
|
|
|
|
ps(ibnd) = ps(ibnd) &
|
|
|
|
+ becp2(jkb,1,ibnd)*(0.d0,1.d0)*qq(ih,jh,nt)+ &
|
|
|
|
becp1(jkb,ibnd,kpoint)*fact
|
|
|
|
|
|
|
|
END IF
|
2004-06-01 01:55:33 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
do ibnd = 1, nbnd_occ (kpoint)
|
2007-10-09 00:17:11 +08:00
|
|
|
IF (noncolin) THEN
|
2009-08-03 17:19:02 +08:00
|
|
|
CALL zaxpy(npw,ps_nc(ibnd,1),vkb(1,ikb),1, &
|
2007-10-09 00:17:11 +08:00
|
|
|
dvpsi(1,ibnd),1)
|
2009-08-03 17:19:02 +08:00
|
|
|
CALL zaxpy(npw,ps_nc(ibnd,2),vkb(1,ikb),1, &
|
2007-10-09 00:17:11 +08:00
|
|
|
dvpsi(1+npwx,ibnd),1)
|
|
|
|
ELSE
|
2009-08-03 17:19:02 +08:00
|
|
|
CALL zaxpy(npw,ps(ibnd),vkb(1,ikb),1,dvpsi(1,ibnd),1)
|
2007-10-09 00:17:11 +08:00
|
|
|
END IF
|
2004-06-01 01:55:33 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
ijkb0=ijkb0+nh(nt)
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
if (jkb.ne.nkb) call errore ('adddvepsi_us', 'unexpected error', 1)
|
|
|
|
|
2007-10-09 00:17:11 +08:00
|
|
|
IF (noncolin) THEN
|
|
|
|
deallocate(ps_nc)
|
|
|
|
deallocate(fact_so)
|
|
|
|
ELSE
|
|
|
|
deallocate(ps)
|
|
|
|
END IF
|
|
|
|
|
2004-06-01 01:55:33 +08:00
|
|
|
|
2007-10-09 00:17:11 +08:00
|
|
|
RETURN
|
|
|
|
END SUBROUTINE adddvepsi_us
|