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
|
|
|
|
!
|
2007-08-18 05:54:59 +08:00
|
|
|
use kinds, only: dp
|
2007-06-26 17:49:04 +08:00
|
|
|
use io_global, only : stdout, ionode, ionode_id
|
|
|
|
use mp, only : mp_bcast
|
2007-08-18 05:54:59 +08:00
|
|
|
use radial_grids, only: ndmx
|
|
|
|
use ld1_parameters, only: nwfsx
|
|
|
|
use ld1inc, only: grid, nlcc, vxt, lsd, vpstot, vpsloc, file_screen, &
|
|
|
|
vh, enne, rhoc, latt, rhos, enl, &
|
2007-11-14 01:42:29 +08:00
|
|
|
nbeta, bmat, qvan, qvanl, jjs, lls, ikk, pseudotype, &
|
|
|
|
nwfts, enlts, octs, llts, jjts, phits, nstoaets, lpaw, &
|
|
|
|
which_augfun
|
2005-02-07 22:59:22 +08:00
|
|
|
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
|
2009-02-25 23:58:53 +08:00
|
|
|
lam ! the angular momentum
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: &
|
2007-08-12 08:08:53 +08:00
|
|
|
vaux(ndmx,2) ! work space
|
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 :: &
|
2009-02-25 23:58:53 +08:00
|
|
|
n, nst, iwork(nwfsx), ios, nerr
|
2005-02-07 22:59:22 +08:00
|
|
|
!
|
|
|
|
! 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
|
|
|
|
!
|
|
|
|
do n=1,nwfts
|
2007-05-12 19:01:56 +08:00
|
|
|
enlts(n)=enl(nstoaets(n))
|
2005-02-07 22:59:22 +08:00
|
|
|
enddo
|
|
|
|
!
|
2005-02-11 16:35:54 +08:00
|
|
|
! compute the pseudowavefunctions in the test configuration
|
2005-02-07 22:59:22 +08:00
|
|
|
!
|
2007-10-11 23:14:49 +08:00
|
|
|
call ascheqps_drv(vpsloc, 1, thresh, .false., nerr)
|
2005-02-07 22:59:22 +08:00
|
|
|
!
|
|
|
|
! 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
|
2007-08-25 19:38:10 +08:00
|
|
|
lam=lls(ib)
|
2005-02-07 22:59:22 +08:00
|
|
|
nst=(lam+1)*2
|
2007-12-20 23:36:19 +08:00
|
|
|
IF (which_augfun=='PSQ') then
|
2007-11-14 01:42:29 +08:00
|
|
|
do n=1,ikk(ib)
|
|
|
|
vaux(n,1)=qvanl(n,ib,jb,0)*vpsloc(n)
|
|
|
|
enddo
|
|
|
|
ELSE
|
|
|
|
do n=1,ikk(ib)
|
|
|
|
vaux(n,1)=qvan(n,ib,jb)*vpsloc(n)
|
|
|
|
enddo
|
|
|
|
ENDIF
|
2005-02-07 22:59:22 +08:00
|
|
|
bmat(ib,jb)= bmat(ib,jb) &
|
2007-08-12 08:08:53 +08:00
|
|
|
- int_0_inf_dr(vaux(1,1),grid,ikk(ib),nst)
|
2005-02-07 22:59:22 +08:00
|
|
|
endif
|
|
|
|
bmat(jb,ib)=bmat(ib,jb)
|
|
|
|
enddo
|
|
|
|
enddo
|
2007-06-26 17:49:04 +08:00
|
|
|
write(stdout,'(/5x,'' The ddd matrix'')')
|
2005-02-07 22:59:22 +08:00
|
|
|
do ns1=1,nbeta
|
2007-06-26 17:49:04 +08:00
|
|
|
write(stdout,'(6f12.5)') (bmat(ns1,ns),ns=1,nbeta)
|
2005-02-07 22:59:22 +08:00
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
!
|
|
|
|
! descreening the local pseudopotential
|
|
|
|
!
|
|
|
|
iwork=1
|
2007-05-12 19:01:56 +08:00
|
|
|
call chargeps(rhos,phits,nwfts,llts,jjts,octs,iwork)
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2007-08-12 08:08:53 +08:00
|
|
|
call new_potential(ndmx,grid%mesh,grid,0.0_dp,vxt,lsd,nlcc,latt,enne,&
|
2007-08-17 00:09:50 +08:00
|
|
|
rhoc,rhos,vh,vaux,1)
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2007-08-12 08:08:53 +08:00
|
|
|
do n=1,grid%mesh
|
2005-02-07 22:59:22 +08:00
|
|
|
vpstot(n,1)=vpsloc(n)
|
|
|
|
vpsloc(n)=vpsloc(n)-vaux(n,1)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
if (file_screen .ne.' ') then
|
2007-06-26 17:49:04 +08:00
|
|
|
if (ionode) &
|
|
|
|
open(unit=20,file=file_screen, status='unknown', iostat=ios, err=100 )
|
|
|
|
100 call mp_bcast(ios, ionode_id)
|
|
|
|
call errore('descreening','opening file'//file_screen,abs(ios))
|
|
|
|
if (ionode) then
|
2007-08-12 08:08:53 +08:00
|
|
|
do n=1,grid%mesh
|
2007-10-11 23:14:49 +08:00
|
|
|
write(20,'(i5,7e12.4)') n,grid%r(n), vpsloc(n)+vaux(n,1), &
|
|
|
|
vpsloc(n), vaux(n,1), rhos(n,1)
|
2007-06-26 17:49:04 +08:00
|
|
|
enddo
|
|
|
|
close(20)
|
|
|
|
endif
|
2005-02-07 22:59:22 +08:00
|
|
|
endif
|
2004-05-14 23:33:08 +08:00
|
|
|
|
2005-02-07 22:59:22 +08:00
|
|
|
return
|
|
|
|
end subroutine descreening
|