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 readnewvan (is, iunps)
|
2003-01-20 05:58:50 +08:00
|
|
|
!---------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine reads the quantities which defines the Vanderbilt
|
|
|
|
! pseudopotential from the file produced by the atomic program.
|
|
|
|
! It is compatible only with the ld1 atomic code
|
|
|
|
!
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, only: dp
|
2004-04-24 01:10:44 +08:00
|
|
|
USE parameters, ONLY: nchix, lmaxx, nbrx, ndmx, npsx, lqmax
|
2004-01-16 17:18:28 +08:00
|
|
|
use constants, only: fpi
|
2004-04-27 21:44:55 +08:00
|
|
|
use atom, only: zmesh, mesh, xmin, dx, r, rab, chi, oc, nchi, &
|
|
|
|
lchi, rho_at, rho_atc, nlcc
|
2004-01-16 17:18:28 +08:00
|
|
|
use pseud, only: zp, lmax, lloc
|
2004-05-26 19:04:07 +08:00
|
|
|
use uspp_param, only: vloc_at, dion, betar, qqq, qfcoef, qfunc, nqlc, &
|
|
|
|
rinner, nbeta, kkbeta, lll, psd
|
|
|
|
use us, only: tvanp
|
2003-02-08 00:04:36 +08:00
|
|
|
use funct
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
implicit none
|
|
|
|
! First the arguments passed to the subroutine
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: is, iunps
|
2003-01-20 05:58:50 +08:00
|
|
|
! The number of the pseudopotential
|
|
|
|
! the unit with the pseudopotential
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: nb, mb, n, ir, pseudotype, ios, nwfs, ndum, l, ikk
|
2003-01-20 05:58:50 +08:00
|
|
|
! counters on beta functions
|
|
|
|
! counter on mesh points
|
|
|
|
! counters on mesh points
|
|
|
|
! the type of pseudopotential
|
|
|
|
! I/O control
|
|
|
|
! the number of pseudo wavefunctions
|
|
|
|
! dummy integer variable
|
|
|
|
! counter on angular momentum
|
|
|
|
! the kkbeta for each beta
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: x, etotps, rdum
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliary variable
|
|
|
|
! total energy of the pseudoatom
|
|
|
|
! dummy real variable
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
logical :: rel
|
2003-01-20 05:58:50 +08:00
|
|
|
! if true the atomic calculation is relativistic
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
character (len=75) :: titleps
|
2003-01-20 05:58:50 +08:00
|
|
|
! the title of the pseudo
|
|
|
|
|
2004-01-19 18:57:53 +08:00
|
|
|
if (is.lt.0.or.is.gt.npsx) call errore ('readnewvan', 'Wrong is number', 1)
|
2003-02-08 00:04:36 +08:00
|
|
|
read (iunps, '(a75)', err = 100, iostat = ios) titleps
|
|
|
|
|
|
|
|
psd (is) = titleps (7:8)
|
|
|
|
read (iunps, '(i5)', err = 100, iostat = ios) pseudotype
|
|
|
|
if (pseudotype.eq.3) then
|
|
|
|
tvanp (is) = .true.
|
|
|
|
else
|
|
|
|
tvanp (is) = .false.
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
read (iunps, '(2l5)', err = 100, iostat = ios) rel, nlcc (is)
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(4i5)', err = 100, iostat = ios) iexch, icorr, igcx, &
|
|
|
|
igcc
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
dft = '?'
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
read (iunps, '(2e17.11,i5)') zp (is) , etotps, lmax (is)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
read (iunps, '(4e17.11,i5)', err = 100, iostat = ios) xmin (is) , &
|
|
|
|
rdum, zmesh (is) , dx (is) , mesh (is)
|
|
|
|
|
|
|
|
|
2004-04-24 01:10:44 +08:00
|
|
|
if (mesh (is) > ndmx) call errore ('readnewvan', 'mesh is too big', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
read (iunps, '(2i5)', err = 100, iostat = ios) nwfs, nbeta (is)
|
2003-02-21 22:57:00 +08:00
|
|
|
if (nbeta (is) .gt.nbrx) call errore ('readnewvan', 'nbeta is too large', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-21 22:57:00 +08:00
|
|
|
if (nwfs.gt.nchix) call errore ('readnewvan', 'nwfs is too large', 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) (rdum, nb = 1, nwfs)
|
|
|
|
|
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) (rdum, nb = 1, nwfs)
|
2003-02-08 00:04:36 +08:00
|
|
|
do nb = 1, nwfs
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(a2,2i3,f6.2)', err = 100, iostat = ios) &
|
|
|
|
rdum, ndum, lchi (nb, is) , oc (nb, is)
|
2003-02-08 00:04:36 +08:00
|
|
|
lll (nb, is) = lchi (nb, is)
|
2004-05-26 19:04:07 +08:00
|
|
|
!
|
|
|
|
! workaround to distinguish bound states from unbound states
|
|
|
|
!
|
|
|
|
if (oc (nb, is) <= 0.d0) oc (nb, is) = -1.0
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
kkbeta (is) = 0
|
|
|
|
do nb = 1, nbeta (is)
|
|
|
|
read (iunps, '(i6)', err = 100, iostat = ios) ikk
|
|
|
|
kkbeta (is) = max (kkbeta (is), ikk)
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) &
|
|
|
|
(betar (ir, nb, is) , ir = 1, ikk)
|
2003-02-08 00:04:36 +08:00
|
|
|
do ir = ikk + 1, mesh (is)
|
|
|
|
betar (ir, nb, is) = 0.d0
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
do mb = 1, nb
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) dion (nb, mb, is)
|
2003-02-08 00:04:36 +08:00
|
|
|
dion (mb, nb, is) = dion (nb, mb, is)
|
|
|
|
if (pseudotype.eq.3) then
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) qqq (nb, mb, is)
|
2003-02-08 00:04:36 +08:00
|
|
|
qqq (mb, nb, is) = qqq (nb, mb, is)
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) &
|
|
|
|
(qfunc (n, nb, mb, is) , n = 1, mesh (is) )
|
2004-04-24 19:58:24 +08:00
|
|
|
do n = 1, mesh (is)
|
2003-02-08 00:04:36 +08:00
|
|
|
qfunc (n, mb, nb, is) = qfunc (n, nb, mb, is)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
|
|
|
qqq (nb, mb, is) = 0.d0
|
|
|
|
qqq (mb, nb, is) = 0.d0
|
|
|
|
do n = 0, mesh (is)
|
|
|
|
qfunc (n, nb, mb, is) = 0.d0
|
|
|
|
qfunc (n, mb, nb, is) = 0.d0
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! reads the local potential
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
lloc (is) = 0
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) rdum, &
|
2004-04-26 15:25:01 +08:00
|
|
|
(vloc_at (ir, is) , ir = 1, mesh (is) )
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! reads the atomic charge
|
|
|
|
!
|
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) (rho_at (ir, &
|
|
|
|
is) , ir = 1, mesh (is) )
|
|
|
|
|
|
|
|
!
|
|
|
|
! if present reads the core charge
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
if (nlcc (is) ) then
|
2003-01-20 05:58:50 +08:00
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) (rho_atc ( &
|
|
|
|
ir, is) , ir = 1, mesh (is) )
|
|
|
|
endif
|
|
|
|
!
|
|
|
|
! read the pseudo wavefunctions of the atom
|
|
|
|
!
|
|
|
|
read (iunps, '(1p4e19.11)', err = 100, iostat = ios) ( (chi (ir, &
|
|
|
|
nb, is) , ir = 1, mesh (is) ) , nb = 1, nwfs)
|
|
|
|
|
2004-01-19 18:57:53 +08:00
|
|
|
100 call errore ('readnewvan', 'Reading pseudo file', abs (ios) )
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! set several variables for compatibility with the rest of the
|
|
|
|
! code
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
nchi (is) = nwfs
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
nqlc (is) = 2 * lmax (is) + 1
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-21 22:57:00 +08:00
|
|
|
if (nqlc (is) .gt.lqmax.or.nqlc (is) .lt.0) call errore (' readnewvan ',&
|
2003-01-20 05:58:50 +08:00
|
|
|
'Wrong nqlc', nqlc (is) )
|
2003-02-08 00:04:36 +08:00
|
|
|
do l = 1, nqlc (is)
|
|
|
|
rinner (l, is) = 0.d0
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! compute the radial mesh
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do ir = 1, mesh (is)
|
2004-04-03 21:24:17 +08:00
|
|
|
x = xmin (is) + dble (ir - 1) * dx (is)
|
2003-02-08 00:04:36 +08:00
|
|
|
r (ir, is) = exp (x) / zmesh (is)
|
|
|
|
rab (ir, is) = dx (is) * r (ir, is)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! For compatibility with rho_atc in the non-US case
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
if (nlcc (is) ) then
|
|
|
|
do ir = 1, mesh (is)
|
|
|
|
rho_atc (ir, is) = rho_atc (ir, is) / fpi / r (ir, is) **2
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
close (iunps)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine readnewvan
|
|
|
|
|