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 compute_becalp (becq, alpq)
|
2003-01-20 05:58:50 +08:00
|
|
|
!---------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine is used only if .not.lgamma and in this case
|
|
|
|
! computes the scalar product of vkb and psi_{k+q}
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
use pwcom
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, only : DP
|
2003-11-10 02:30:08 +08:00
|
|
|
USE io_files, ONLY: iunigk
|
2003-02-08 00:04:36 +08:00
|
|
|
use phcom
|
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: becq(nkb, nbnd, nksq), alpq(nkb,nbnd,3,nksq)
|
2003-01-20 05:58:50 +08:00
|
|
|
! the becp with psi_{k+q}
|
|
|
|
! the alphap with psi_{k+q}
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: ik, ikq, ipol, ibnd, ig, ios
|
2003-01-20 05:58:50 +08:00
|
|
|
! counter on k points
|
|
|
|
! counter on polarizations, bands and
|
|
|
|
! used for i/o control
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: fact
|
|
|
|
complex(DP), allocatable :: aux (:,:)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
if (lgamma) return
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
allocate (aux ( npwx , nbnd))
|
|
|
|
if (nksq.gt.1) rewind (iunigk)
|
|
|
|
do ik = 1, nksq
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
ikq = 2 * ik
|
|
|
|
if (nksq.gt.1) then
|
|
|
|
read (iunigk, err = 100, iostat = ios) npw, igk
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-21 22:57:00 +08:00
|
|
|
100 call errore ('compute_becalp', 'reading igk', abs (ios) )
|
2003-02-08 00:04:36 +08:00
|
|
|
read (iunigk, err = 200, iostat = ios) npwq, igkq
|
2003-02-21 22:57:00 +08:00
|
|
|
200 call errore ('compute_becalp', 'reading igkq', abs (ios) )
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
call init_us_2 (npwq, igkq, xk (1, ikq), vkb)
|
|
|
|
call davcio (evq, lrwfc, iuwfc, ikq, - 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
call ccalbec (nkb, npwx, npwq, nbnd, becq (1, 1, ik), vkb, evq)
|
2003-02-08 00:04:36 +08:00
|
|
|
do ipol = 1, 3
|
|
|
|
do ibnd = 1, nbnd
|
|
|
|
do ig = 1, npwq
|
2003-01-20 05:58:50 +08:00
|
|
|
aux (ig, ibnd) = evq (ig, ibnd) * &
|
|
|
|
(xk (ipol, ikq) + g (ipol, igkq(ig) ) )
|
|
|
|
enddo
|
|
|
|
|
|
|
|
enddo
|
|
|
|
|
|
|
|
call ccalbec (nkb, npwx, npwq, nbnd, alpq(1, 1, ipol, ik),vkb, aux)
|
|
|
|
enddo
|
|
|
|
enddo
|
General cleanup of intrinsic functions:
conversion to real => DBLE
(including real part of a complex number)
conversion to complex => CMPLX
complex conjugate => CONJG
imaginary part => AIMAG
All functions are uppercase.
CMPLX is preprocessed by f_defs.h and performs an explicit cast:
#define CMPLX(a,b) cmplx(a,b,kind=DP)
This implies that 1) f_defs.h must be included whenever a CMPLX is present,
2) CMPLX should stay in a single line, 3) DP must be defined.
All occurrences of real, float, dreal, dfloat, dconjg, dimag, dcmplx
removed - please do not reintroduce any of them.
Tested only with ifc7 and g95 - beware unintended side effects
Maybe not the best solution (explicit casts everywhere would be better)
but it can be easily changed with a script if the need arises.
The following code might be used to test for possible trouble:
program test_intrinsic
implicit none
integer, parameter :: dp = selected_real_kind(14,200)
real (kind=dp) :: a = 0.123456789012345_dp
real (kind=dp) :: b = 0.987654321098765_dp
complex (kind=dp) :: c = ( 0.123456789012345_dp, 0.987654321098765_dp)
print *, ' A = ', a
print *, ' DBLE(A)= ', DBLE(a)
print *, ' C = ', c
print *, 'CONJG(C)= ', CONJG(c)
print *, 'DBLE(c),AIMAG(C) = ', DBLE(c), AIMAG(c)
print *, 'CMPLX(A,B,kind=dp)= ', CMPLX( a, b, kind=dp)
end program test_intrinsic
Note that CMPLX and REAL without a cast yield single precision numbers on
ifc7 and g95 !!!
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@2133 c92efa57-630b-4861-b058-cf58834340f0
2005-08-27 01:44:42 +08:00
|
|
|
fact = CMPLX (0.d0, tpiba)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call ZSCAL (nkb * nbnd * 3 * nksq, fact, alpq, 1)
|
|
|
|
deallocate (aux)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine compute_becalp
|