2004-05-14 23:33:08 +08:00
|
|
|
!
|
2005-03-21 22:33:57 +08:00
|
|
|
! Copyright (C) 2004 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 .
|
|
|
|
!
|
|
|
|
!
|
2004-05-14 23:33:08 +08:00
|
|
|
!--------------------------------------------------------------------------
|
2005-02-07 22:59:22 +08:00
|
|
|
subroutine descreening
|
|
|
|
!--------------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine descreens the local potential and the ddd
|
|
|
|
! coefficients (the latter only in the US case)
|
|
|
|
! The charge density is computed with the test configuration,
|
|
|
|
! not the one used to generate the pseudopotential
|
|
|
|
!
|
|
|
|
use ld1inc
|
|
|
|
implicit none
|
2004-05-14 23:33:08 +08:00
|
|
|
|
|
|
|
|
2005-02-11 19:18:07 +08:00
|
|
|
integer :: &
|
|
|
|
ns, & ! counter on pseudo functions
|
|
|
|
ns1, & ! counter on pseudo functions
|
2005-02-07 22:59:22 +08:00
|
|
|
ib,jb, & ! counter on beta functions
|
2005-02-11 19:18:07 +08:00
|
|
|
lam, & ! the angular momentum
|
|
|
|
ind
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: &
|
2005-02-07 22:59:22 +08:00
|
|
|
vaux(ndm,2),& ! work space
|
|
|
|
phist(ndm,nwfsx)! auxiliary to save the phi
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP), external :: int_0_inf_dr ! the integral function
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP), parameter :: &
|
2005-02-07 22:59:22 +08:00
|
|
|
thresh= 1.e-12_dp ! threshold for selfconsistency
|
|
|
|
|
|
|
|
integer :: &
|
|
|
|
m, n, l, n1, n2, nwf0, nst, ikl, imax, iwork(nwfsx), &
|
|
|
|
is, nbf, nc, ios
|
|
|
|
!
|
|
|
|
! descreening the local potential: NB: this descreening is done with
|
|
|
|
! the occupation of the test configuration. This is required
|
|
|
|
! for pseudopotentials with semicore states. In the other cases
|
|
|
|
! a test configuration equal to the one used for pseudopotential
|
|
|
|
! generation is strongly suggested
|
|
|
|
!
|
|
|
|
nc=1
|
|
|
|
nwfts=nwftsc(nc)
|
|
|
|
do n=1,nwfts
|
|
|
|
nnts(n)=nntsc(n,nc)
|
|
|
|
llts(n)=lltsc(n,nc)
|
|
|
|
elts(n)=eltsc(n,nc)
|
|
|
|
! rcutts(n)=rcut(n)
|
|
|
|
! rcutusts(n)=rcutus(n)
|
|
|
|
jjts(n) = jjtsc(n,nc)
|
|
|
|
iswts(n)=iswtsc(n,nc)
|
|
|
|
octs(n)=octsc(n,nc)
|
|
|
|
nstoae(n)=nstoaec(n,nc)
|
2006-01-25 02:37:56 +08:00
|
|
|
enlts(n)=enl(nstoae(n))
|
2005-02-07 22:59:22 +08:00
|
|
|
new(n)=.false.
|
|
|
|
enddo
|
|
|
|
|
2005-02-11 16:35:54 +08:00
|
|
|
do ns=1,nwfs
|
2005-02-07 22:59:22 +08:00
|
|
|
do n=1,mesh
|
|
|
|
phist(n,ns)=phis(n,ns)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
2005-02-11 16:35:54 +08:00
|
|
|
! compute the pseudowavefunctions in the test configuration
|
2005-02-07 22:59:22 +08:00
|
|
|
!
|
|
|
|
if (pseudotype.eq.1) then
|
|
|
|
nbf=0
|
|
|
|
else
|
|
|
|
nbf=nbeta
|
|
|
|
endif
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-02-07 22:59:22 +08:00
|
|
|
do ns=1,nwfts
|
|
|
|
if (octs(ns).gt.0.0_dp) then
|
|
|
|
is=iswts(ns)
|
2005-02-11 19:18:07 +08:00
|
|
|
if (pseudotype ==1) then
|
|
|
|
if ( rel < 2 .or. llts(ns) == 0 .or. &
|
|
|
|
abs(jjts(ns)-llts(ns)+0.5_dp) < 0.001_dp) then
|
|
|
|
ind=1
|
|
|
|
else if ( rel == 2 .and. llts(ns) > 0 .and. &
|
|
|
|
abs(jjts(ns)-llts(ns)-0.5_dp) < 0.001_dp) then
|
|
|
|
ind=2
|
|
|
|
endif
|
2005-02-07 22:59:22 +08:00
|
|
|
do n=1,mesh
|
2005-02-11 19:18:07 +08:00
|
|
|
vaux(n,1)=vpsloc(n)+vnl(n,llts(ns),ind)
|
2005-02-07 22:59:22 +08:00
|
|
|
enddo
|
|
|
|
else
|
|
|
|
do n=1,mesh
|
|
|
|
vaux(n,1)=vpsloc(n)
|
|
|
|
enddo
|
|
|
|
endif
|
2006-01-25 02:37:56 +08:00
|
|
|
call ascheqps(nnts(ns),llts(ns),jjts(ns),enlts(ns), &
|
2005-02-07 22:59:22 +08:00
|
|
|
mesh,ndm,dx,r,r2,sqr,vaux,thresh,phis(1,ns), &
|
2004-05-14 23:33:08 +08:00
|
|
|
betas,bmat,qq,nbf,nwfsx,lls,jjs,ikk)
|
2006-01-25 02:37:56 +08:00
|
|
|
! write(6,*) ns, nnts(ns),llts(ns), jjts(ns), enlts(ns)
|
2005-02-07 22:59:22 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! descreening the D coefficients
|
|
|
|
!
|
|
|
|
if (pseudotype.eq.3) then
|
|
|
|
do ib=1,nbeta
|
|
|
|
do jb=1,ib
|
|
|
|
if (lls(ib).eq.lls(jb).and.abs(jjs(ib)-jjs(jb)).lt.1.e-7_dp) then
|
|
|
|
lam=lls(ns)
|
|
|
|
nst=(lam+1)*2
|
|
|
|
do n=1,ikk(ib)
|
|
|
|
vaux(n,1)=qvan(n,ib,jb)*vpsloc(n)
|
|
|
|
enddo
|
|
|
|
bmat(ib,jb)= bmat(ib,jb) &
|
|
|
|
- int_0_inf_dr(vaux(1,1),r,r2,dx,ikk(ib),nst)
|
|
|
|
endif
|
|
|
|
bmat(jb,ib)=bmat(ib,jb)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
write(6,'(/5x,'' The ddd matrix'')')
|
|
|
|
do ns1=1,nbeta
|
|
|
|
write(6,'(6f12.5)') (bmat(ns1,ns),ns=1,nbeta)
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
!
|
|
|
|
! descreening the local pseudopotential
|
|
|
|
!
|
|
|
|
iwork=1
|
|
|
|
call normalize
|
|
|
|
call chargeps(nwfts,llts,jjts,octs,iwork)
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-02-07 22:59:22 +08:00
|
|
|
call new_potential(ndm,mesh,r,r2,sqr,dx,0.0_dp,vxt,lsd,nlcc,latt,enne, &
|
|
|
|
rhoc,rhos,vh,vaux)
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-02-07 22:59:22 +08:00
|
|
|
do n=1,mesh
|
|
|
|
vpstot(n,1)=vpsloc(n)
|
|
|
|
vpsloc(n)=vpsloc(n)-vaux(n,1)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
if (file_screen .ne.' ') then
|
|
|
|
open(unit=20,file=file_screen, status='unknown', iostat=ios, &
|
|
|
|
err=100 )
|
|
|
|
100 call errore('descreening','opening file'//file_screen,abs(ios))
|
|
|
|
do n=1,mesh
|
|
|
|
write(20,'(i5,7e12.4)') n,r(n), vpsloc(n)+vaux(n,1), vpsloc(n), &
|
|
|
|
vaux(n,1), rhos(n,1)
|
|
|
|
enddo
|
|
|
|
close(20)
|
|
|
|
endif
|
|
|
|
!
|
|
|
|
! copy the phis used to construct the pseudopotential
|
|
|
|
!
|
2005-02-11 16:35:54 +08:00
|
|
|
do ns=1,nwfs
|
2005-02-07 22:59:22 +08:00
|
|
|
do n=1,mesh
|
|
|
|
phis(n,ns)=phist(n,ns)
|
|
|
|
enddo
|
|
|
|
enddo
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-02-07 22:59:22 +08:00
|
|
|
return
|
|
|
|
end subroutine descreening
|