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 usnldiag (h_diag, s_diag)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! add nonlocal pseudopotential term to diagonal part of Hamiltonian
|
|
|
|
! compute the diagonal part of the S matrix
|
|
|
|
!
|
2007-01-22 04:09:10 +08:00
|
|
|
USE kinds, ONLY: DP
|
|
|
|
USE ions_base, ONLY : nat, ityp, ntyp => nsp
|
|
|
|
USE wvfct, ONLY: npw, npwx
|
|
|
|
USE lsda_mod, ONLY: current_spin
|
|
|
|
USE uspp, ONLY: deeq, vkb, qq, qq_so, deeq_nc
|
The following pseudopotential-related variables in module uspp_param:
zp, psd, dion, betar, jjj, qqq, qfunc, qfcoef, vloc_at, rinner,
nbeta, kkbeta, nqf, nqlc, lll, tvanp
have been replaced by the corresponding variables in structure 'upf'.
There shouldn't be any side effects, but who knows. There is still a
copy of the above variables that will be removed sooner or later.
Basically : variable([i,j,k,..,]n) => upf(n)%variable [(i,j,k,..)]
Note that upf%qfunc has for the time being three indices instead of two,
and that upf%kkbeta is the analogous of kkbeta and not what it used to be.
The logic of this operation will be clearer when it will be completed
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4308 c92efa57-630b-4861-b058-cf58834340f0
2007-10-05 17:26:23 +08:00
|
|
|
USE uspp_param, ONLY: upf, nh, newpseudo
|
2007-01-22 04:09:10 +08:00
|
|
|
USE spin_orb, ONLY: lspinorb
|
|
|
|
USE noncollin_module, ONLY: noncolin, npol
|
2004-06-12 21:44:18 +08:00
|
|
|
!
|
2003-01-20 05:58:50 +08:00
|
|
|
implicit none
|
|
|
|
!
|
|
|
|
! here the dummy variables
|
|
|
|
!
|
2007-01-22 04:09:10 +08:00
|
|
|
real(DP) :: h_diag (npwx,npol), s_diag (npwx,npol)
|
2003-01-20 05:58:50 +08:00
|
|
|
! input/output: the diagonal part of the hamiltonian
|
|
|
|
! output: the diagonal part of the S matrix
|
|
|
|
!
|
|
|
|
! and here the local variables
|
|
|
|
!
|
2007-01-22 04:09:10 +08:00
|
|
|
integer :: ikb, jkb, ih, jh, na, nt, ig, ijkb0, ipol
|
2003-01-20 05:58:50 +08:00
|
|
|
! counters
|
2007-01-22 04:09:10 +08:00
|
|
|
complex(DP) :: ps1(2), ps2(2), ar
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! initialise s_diag
|
|
|
|
!
|
2007-01-22 04:09:10 +08:00
|
|
|
s_diag = 1.d0
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! multiply on projectors
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
ijkb0 = 0
|
|
|
|
do nt = 1, ntyp
|
|
|
|
do na = 1, nat
|
2007-01-22 04:09:10 +08:00
|
|
|
if (ityp (na) == nt) then
|
2003-02-08 00:04:36 +08:00
|
|
|
do ih = 1, nh (nt)
|
|
|
|
ikb = ijkb0 + ih
|
2007-01-22 04:09:10 +08:00
|
|
|
if (lspinorb) then
|
|
|
|
ps1(1) = deeq_nc (ih, ih, na, 1)
|
|
|
|
ps1(2) = deeq_nc (ih, ih, na, 4)
|
|
|
|
ps2(1) = qq_so(ih, ih, 1, nt)
|
|
|
|
ps2(2) = qq_so(ih, ih, 4, nt)
|
|
|
|
else if (noncolin) then
|
|
|
|
ps1(1) = deeq_nc (ih, ih, na, 1)
|
|
|
|
ps1(2) = deeq_nc (ih, ih, na, 4)
|
|
|
|
ps2(1) = qq (ih, ih, nt)
|
|
|
|
ps2(2) = qq (ih, ih, nt)
|
|
|
|
else
|
|
|
|
ps1(1) = deeq (ih, ih, na, current_spin)
|
|
|
|
ps2(1) = qq (ih, ih, nt)
|
|
|
|
end if
|
|
|
|
do ipol =1, npol
|
|
|
|
do ig = 1, npw
|
|
|
|
ar = vkb (ig, ikb)*CONJG(vkb (ig, ikb))
|
|
|
|
h_diag (ig,ipol) = h_diag (ig,ipol) + ps1(ipol) * ar
|
|
|
|
s_diag (ig,ipol) = s_diag (ig,ipol) + ps2(ipol) * ar
|
|
|
|
enddo
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
The following pseudopotential-related variables in module uspp_param:
zp, psd, dion, betar, jjj, qqq, qfunc, qfcoef, vloc_at, rinner,
nbeta, kkbeta, nqf, nqlc, lll, tvanp
have been replaced by the corresponding variables in structure 'upf'.
There shouldn't be any side effects, but who knows. There is still a
copy of the above variables that will be removed sooner or later.
Basically : variable([i,j,k,..,]n) => upf(n)%variable [(i,j,k,..)]
Note that upf%qfunc has for the time being three indices instead of two,
and that upf%kkbeta is the analogous of kkbeta and not what it used to be.
The logic of this operation will be clearer when it will be completed
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@4308 c92efa57-630b-4861-b058-cf58834340f0
2007-10-05 17:26:23 +08:00
|
|
|
if ( upf(nt)%tvanp .or.newpseudo (nt) ) then
|
2007-01-22 04:09:10 +08:00
|
|
|
do jh = 1, nh (nt)
|
|
|
|
if (jh.ne.ih) then
|
|
|
|
jkb = ijkb0 + jh
|
|
|
|
if (lspinorb) then
|
|
|
|
ps1(1) = deeq_nc (ih, jh, na, 1)
|
|
|
|
ps1(2) = deeq_nc (ih, jh, na, 4)
|
|
|
|
ps2(1) = qq_so(ih, jh, 1, nt)
|
|
|
|
ps2(2) = qq_so(ih, jh, 4, nt)
|
|
|
|
else if (noncolin) then
|
|
|
|
ps1(1) = deeq_nc (ih, jh, na, 1)
|
|
|
|
ps1(2) = deeq_nc (ih, jh, na, 4)
|
|
|
|
ps2(1) = qq (ih, jh, nt)
|
|
|
|
ps2(2) = qq (ih, jh, nt)
|
|
|
|
else
|
|
|
|
ps1(1) = deeq (ih, jh, na, current_spin)
|
|
|
|
ps2(1) = qq (ih, jh, nt)
|
|
|
|
end if
|
|
|
|
do ipol = 1, npol
|
|
|
|
do ig = 1, npw
|
|
|
|
ar = vkb (ig, ikb) *CONJG( vkb (ig, jkb))
|
|
|
|
h_diag (ig,ipol) = h_diag (ig,ipol) + &
|
|
|
|
ps1(ipol) * ar
|
|
|
|
s_diag (ig,ipol) = s_diag (ig,ipol) + &
|
|
|
|
ps2(ipol) * ar
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
endif
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
ijkb0 = ijkb0 + nh (nt)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
2007-01-22 04:09:10 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine usnldiag
|