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 hinit0
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! configuration-independent hamiltonian initialization
|
|
|
|
!
|
2004-01-23 23:08:03 +08:00
|
|
|
USE basis, ONLY: nat, ntyp, ityp, tau, startingconfig
|
2004-04-02 18:30:15 +08:00
|
|
|
USE cell_base, ONLY: at, bg, omega, tpiba2
|
2004-01-23 23:08:03 +08:00
|
|
|
USE cellmd, ONLY: omega_old, at_old, lmovecell
|
|
|
|
USE klist, ONLY: nks, xk
|
|
|
|
USE gvect, ONLY: nr1, nr2, nr3, ngm, ecutwfc, ig_l2g, &
|
|
|
|
g, eigts1, eigts2, eigts3
|
|
|
|
USE vlocal, ONLY: strf
|
|
|
|
USE wvfct, ONLY: npw, g2kin, igk, igk_l2g
|
|
|
|
USE pseud, ONLY: lloc, lmax, nnl, aps, alps
|
2003-11-10 02:30:08 +08:00
|
|
|
USE io_files, ONLY: iunigk
|
2003-01-20 05:58:50 +08:00
|
|
|
implicit none
|
|
|
|
! counter on k points
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: ik
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! calculate the local part of the pseudopotentials
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call init_vloc
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! k-point independent parameters of non-local pseudopotentials
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call init_us_1
|
2004-01-24 22:44:20 +08:00
|
|
|
call init_at_1
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
rewind (iunigk)
|
|
|
|
do ik = 1, nks
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! g2kin is used here as work space
|
|
|
|
!
|
|
|
|
call gk_sort (xk (1, ik), ngm, g, ecutwfc / tpiba2, npw, igk, g2kin)
|
|
|
|
!
|
|
|
|
call gk_l2gmap (ngm, ig_l2g(1), npw, igk, igk_l2g(1,ik) )
|
|
|
|
!
|
|
|
|
! if there is only one k-point npw and igk stay in memory
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
if (nks.gt.1) write (iunigk) npw, igk
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
if (lmovecell.and.startingconfig.eq.'file') then
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! if lmovecell and restart are both true the cell shape read from the
|
2003-02-08 00:04:36 +08:00
|
|
|
! restart file and stored in the xxx_old variable should be used
|
2003-01-20 05:58:50 +08:00
|
|
|
! instead of the current (read from input) ones.
|
|
|
|
! swap them, rescale the atomic positions and scale the hamiltonian
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call cryst_to_cart (nat, tau, bg, - 1)
|
|
|
|
call swap (9, at, at_old)
|
|
|
|
call swap (1, omega, omega_old)
|
|
|
|
call cryst_to_cart (nat, tau, at, + 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
call recips (at (1, 1), at (1, 2), at (1, 3), &
|
|
|
|
bg (1, 1), bg (1, 2), bg (1, 3) )
|
2003-02-08 00:04:36 +08:00
|
|
|
call scale_h
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
!
|
|
|
|
! initialize the structure factor
|
|
|
|
!
|
|
|
|
call struc_fact (nat, tau, ntyp, ityp, ngm, g, bg, nr1, nr2, nr3, &
|
|
|
|
strf, eigts1, eigts2, eigts3)
|
|
|
|
!
|
|
|
|
! calculate the total local potential
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call setlocal
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! calculate the core charge (if any) for the nonlinear core correction
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call set_rhoc
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine hinit0
|
|
|
|
|