2004-06-12 21:44:18 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2003-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-02-26 23:33:58 +08:00
|
|
|
MODULE paw
|
|
|
|
|
|
|
|
USE kinds, ONLY: DP
|
2004-04-24 01:10:44 +08:00
|
|
|
USE parameters, ONLY: nbrx, npsx, ndmx
|
2004-02-26 23:33:58 +08:00
|
|
|
!
|
|
|
|
! ... These parameters are needed for the paw variables
|
|
|
|
!
|
|
|
|
SAVE
|
|
|
|
!
|
2005-08-28 22:09:42 +08:00
|
|
|
REAL(DP) :: &
|
2004-04-24 01:10:44 +08:00
|
|
|
paw_betar(ndmx,nbrx,npsx) ! radial beta_{mu} functions
|
2004-02-26 23:33:58 +08:00
|
|
|
INTEGER :: &
|
|
|
|
paw_nh(npsx), &! number of beta functions per atomic type
|
|
|
|
paw_nbeta(npsx), &! number of beta functions
|
|
|
|
paw_kkbeta(npsx), &! point where the beta are zero
|
|
|
|
paw_lll(nbrx,npsx) ! angular momentum of the beta function
|
|
|
|
INTEGER :: &
|
|
|
|
paw_nhm, &! max number of different beta functions per atom
|
|
|
|
paw_nkb, &! total number of beta functions, with st.fact.
|
|
|
|
paw_nqxq, &! size of interpolation table
|
|
|
|
paw_lmaxkb, &! max angular momentum
|
2004-06-01 01:55:33 +08:00
|
|
|
paw_lmaxq, &! max angular momentum + 1 for Q functions
|
2004-02-26 23:33:58 +08:00
|
|
|
paw_nqx ! number of interpolation points
|
|
|
|
INTEGER, ALLOCATABLE ::&
|
|
|
|
paw_indv(:,:), &! correspondence of betas atomic <-> soli
|
|
|
|
paw_nhtol(:,:), &! correspondence n <-> angular momentum
|
|
|
|
paw_nhtom(:,:), &! correspondence n <-> magnetic angular m
|
|
|
|
paw_nl(:,:), &! number of projectors for each l
|
|
|
|
paw_iltonh(:,:,:) ! corresp l, num <--> n for each type
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP), ALLOCATABLE, TARGET :: &
|
2004-02-26 23:33:58 +08:00
|
|
|
paw_vkb(:,:), & ! all beta functions in reciprocal space
|
|
|
|
paw_becp(:,:) ! products of wavefunctions and proj
|
2005-08-28 22:09:42 +08:00
|
|
|
REAL(DP), ALLOCATABLE :: &
|
2004-02-26 23:33:58 +08:00
|
|
|
paw_tab(:,:,:) ! interpolation table for PPs
|
|
|
|
!
|
|
|
|
type wfc_label
|
2004-04-08 23:00:29 +08:00
|
|
|
integer :: na , & ! Atom number
|
|
|
|
nt , & ! Type
|
|
|
|
n , & ! Chi index
|
|
|
|
l , & ! l
|
2004-10-11 00:22:05 +08:00
|
|
|
m , & ! m
|
|
|
|
nrc ! indice of core radius in mesh
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: rc ! paw core radius
|
2004-02-26 23:33:58 +08:00
|
|
|
end type wfc_label
|
|
|
|
|
|
|
|
type at_wfc
|
|
|
|
type(wfc_label) :: label
|
2004-04-08 23:00:29 +08:00
|
|
|
integer :: kkpsi
|
2005-08-28 22:09:42 +08:00
|
|
|
! real(DP) :: rmt = 0.0_DP ! Like FLAPW or LMTO Muffin Tinradius
|
|
|
|
real(DP) , pointer :: psi(:)
|
2004-02-26 23:33:58 +08:00
|
|
|
end type at_wfc
|
|
|
|
|
|
|
|
type(at_wfc),pointer :: aephi(:,:), psphi(:,:) ! Atom
|
|
|
|
|
2004-04-08 23:00:29 +08:00
|
|
|
CONTAINS
|
|
|
|
|
|
|
|
subroutine paw_wfc_init(phi)
|
2004-04-14 19:59:52 +08:00
|
|
|
!
|
|
|
|
! Initialize default values for labe end kkpsi
|
|
|
|
!
|
|
|
|
|
2004-04-08 23:00:29 +08:00
|
|
|
type(at_wfc) :: phi(:,:)
|
|
|
|
|
|
|
|
phi%label%na = 0
|
|
|
|
phi%label%nt = 0
|
|
|
|
phi%label%n = 0
|
|
|
|
phi%label%l = -99
|
|
|
|
phi%label%m = -99
|
2004-10-11 00:22:05 +08:00
|
|
|
phi%label%nrc = 0
|
2004-04-08 23:00:29 +08:00
|
|
|
phi%kkpsi = 0
|
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine paw_wfc_init
|
|
|
|
|
2004-04-14 19:59:52 +08:00
|
|
|
subroutine read_recon(filerec)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Read all-electron and pseudo atomic wavefunctions
|
|
|
|
! needed for PAW reconstruction
|
|
|
|
!
|
|
|
|
|
2004-06-12 21:44:18 +08:00
|
|
|
use read_pseudo_module, only: scan_begin, scan_end
|
|
|
|
USE ions_base, ONLY : ntyp => nsp
|
2004-04-14 19:59:52 +08:00
|
|
|
use atom, only: mesh
|
|
|
|
use kinds, only: DP
|
|
|
|
use parameters, only : ntypx
|
|
|
|
USE io_global, ONLY : stdout
|
|
|
|
implicit none
|
|
|
|
|
2004-10-26 17:32:48 +08:00
|
|
|
character (len=256) :: filerec(ntypx)
|
2004-04-14 19:59:52 +08:00
|
|
|
integer :: l,j,i,jtyp,kkphi,nbetam
|
|
|
|
|
|
|
|
do jtyp=1,ntyp
|
|
|
|
open(14,file=filerec(jtyp))
|
|
|
|
call scan_begin(14,'PAW',.true.)
|
|
|
|
read(14,*) paw_nbeta(jtyp)
|
|
|
|
call scan_end(14,'PAW')
|
|
|
|
close(14)
|
|
|
|
enddo
|
|
|
|
nbetam=maxval(paw_nbeta)
|
|
|
|
allocate( psphi(ntyp,nbetam) )
|
|
|
|
allocate( aephi(ntyp,nbetam) )
|
|
|
|
|
|
|
|
call paw_wfc_init(psphi)
|
|
|
|
call paw_wfc_init(aephi)
|
|
|
|
|
|
|
|
|
|
|
|
recphi_read: do jtyp=1,ntyp
|
|
|
|
open(14,file=filerec(jtyp))
|
|
|
|
write (stdout,*) "N_AEwfc atom",jtyp,":",paw_nbeta(jtyp)
|
|
|
|
recphi_loop: do i=1,paw_nbeta(jtyp)
|
|
|
|
allocate(aephi(jtyp,i)%psi(maxval(mesh(1:ntyp))))
|
|
|
|
aephi(jtyp,i)%label%nt=jtyp
|
|
|
|
aephi(jtyp,i)%label%n=i
|
|
|
|
call scan_begin(14,'REC',.false.)
|
|
|
|
call scan_begin(14,'kkbeta',.false.)
|
|
|
|
read(14,*) kkphi
|
|
|
|
call scan_end(14,'kkbeta')
|
|
|
|
aephi(jtyp,i)%kkpsi=kkphi
|
|
|
|
call scan_begin(14,'L',.false.)
|
|
|
|
read(14,*) aephi(jtyp,i)%label%l
|
|
|
|
call scan_end(14,'L')
|
|
|
|
call scan_begin(14,'REC_AE',.false.)
|
|
|
|
read(14,*) (aephi(jtyp,i)%psi(j),j=1,kkphi)
|
|
|
|
call scan_end(14,'REC_AE')
|
|
|
|
allocate (psphi(jtyp,i)%psi(maxval(mesh(1:ntyp))))
|
|
|
|
psphi(jtyp,i)%label%nt=jtyp
|
|
|
|
psphi(jtyp,i)%label%n=i
|
|
|
|
psphi(jtyp,i)%label%l=aephi(jtyp,i)%label%l
|
|
|
|
psphi(jtyp,i)%kkpsi=kkphi
|
|
|
|
call scan_begin(14,'REC_PS',.false.)
|
|
|
|
read(14,*) (psphi(jtyp,i)%psi(j),j=1,kkphi)
|
|
|
|
call scan_end(14,'REC_PS')
|
|
|
|
call scan_end(14,'REC')
|
|
|
|
end do recphi_loop
|
|
|
|
close(14)
|
|
|
|
end do recphi_read
|
|
|
|
|
|
|
|
end subroutine read_recon
|
|
|
|
|
2004-04-08 23:00:29 +08:00
|
|
|
|
2004-02-26 23:33:58 +08:00
|
|
|
END MODULE paw
|