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 ortho
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
#include "machine.h"
|
|
|
|
!
|
|
|
|
! orthonormalize the old wavefunctions with the new S matrix, it must be
|
|
|
|
! after any move of atoms and only if the US problem is solved with
|
|
|
|
! overlap=.false.
|
|
|
|
!
|
2004-01-24 23:43:09 +08:00
|
|
|
USE kinds, ONLY: DP
|
2003-11-10 02:30:08 +08:00
|
|
|
USE io_files, ONLY: iunwfc, nwordwfc, iunigk
|
2004-01-24 23:43:09 +08:00
|
|
|
USE klist, ONLY: nks, xk
|
|
|
|
USE wvfct, ONLY: npw, npwx, nbnd, nbndx, igk
|
2003-11-09 18:42:50 +08:00
|
|
|
USE wavefunctions_module, ONLY : evc
|
2004-01-24 23:43:09 +08:00
|
|
|
USE us, ONLY: nkb, vkb
|
2003-01-20 05:58:50 +08:00
|
|
|
use becmod
|
|
|
|
implicit none
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: ik
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
complex(kind=DP), allocatable :: sevc (:,:), dummy (:,:)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
allocate (sevc ( npwx , nbnd))
|
|
|
|
allocate (dummy( npwx , nbnd))
|
2003-04-23 00:03:45 +08:00
|
|
|
sevc(:,:) = (0.d0,0.d0)
|
|
|
|
dummy(:,:) = (0.d0,0.d0)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (nks.gt.1) rewind (iunigk)
|
|
|
|
do ik = 1, nks
|
|
|
|
if (nks.gt.1) read (iunigk) npw, igk
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! read the wavefunctions
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call davcio (evc, nwordwfc, iunwfc, ik, - 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! calculate becp
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call init_us_2 (npw, igk, xk (1, ik), vkb)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call ccalbec (nkb, npwx, npw, nbnd, becp, vkb, evc)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! find S|psi> with the new "moved" S
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call s_psi (npwx, npw, nbnd, evc, sevc)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! orthonormalize
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call cgramg1 (npwx, nbndx, npw, 1, nbnd, evc, sevc, dummy)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! now <psi_i|S|psi_j> = delta_ij; write the wavefunctions on file
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call davcio (evc, nwordwfc, iunwfc, ik, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
deallocate (sevc)
|
|
|
|
deallocate (dummy)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine ortho
|
|
|
|
|