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 .
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2004-06-12 21:44:18 +08:00
|
|
|
!
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine stres_cc (sigmaxcc)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
2004-06-12 21:44:18 +08:00
|
|
|
!
|
|
|
|
USE kinds, ONLY : DP
|
|
|
|
USE atom, ONLY : rho_atc, numeric, mesh, r, rab, nlcc
|
|
|
|
USE ions_base, ONLY : ntyp => nsp
|
|
|
|
USE cell_base, ONLY : alat, omega, tpiba, tpiba2
|
|
|
|
USE gvect, ONLY : ngm, gstart, nr1, nr2, nr3, nrx1, nrx2, &
|
|
|
|
nrx3, nrxx, nl, g, gg, ngl, gl, igtongl
|
|
|
|
USE ener, ONLY : etxc, vtxc
|
|
|
|
USE lsda_mod, ONLY : nspin
|
|
|
|
USE pseud, ONLY : a_nlcc, b_nlcc, alpha_nlcc
|
|
|
|
USE scf, ONLY : rho, rho_core
|
|
|
|
USE vlocal, ONLY : strf
|
|
|
|
USE wvfct, ONLY : gamma_only
|
|
|
|
USE wavefunctions_module, ONLY : psic
|
|
|
|
!
|
2003-01-20 05:58:50 +08:00
|
|
|
implicit none
|
|
|
|
! output
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: sigmaxcc (3, 3)
|
2003-01-20 05:58:50 +08:00
|
|
|
! local variables
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: nt, ng, l, m, ir
|
2003-01-20 05:58:50 +08:00
|
|
|
! counters
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: fact, sigmadiag
|
|
|
|
real(DP) , allocatable:: rhocg (:), vxc (:,:)
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
sigmaxcc(:,:) = 0.d0
|
2003-02-08 00:04:36 +08:00
|
|
|
do nt = 1, ntyp
|
|
|
|
if (nlcc (nt) ) goto 15
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
15 continue
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! recalculate the exchange-correlation potential
|
|
|
|
!
|
|
|
|
allocate ( vxc(nrxx,nspin) )
|
|
|
|
call v_xc (rho, rho_core, nr1, nr2, nr3, nrx1, nrx2, nrx3, nrxx, &
|
|
|
|
nl, ngm, g, nspin, alat, omega, etxc, vtxc, vxc)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (nspin.eq.1) then
|
|
|
|
do ir = 1, nrxx
|
|
|
|
psic (ir) = vxc (ir, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
|
|
|
do ir = 1, nrxx
|
|
|
|
psic (ir) = 0.5d0 * (vxc (ir, 1) + vxc (ir, 2) )
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
deallocate (vxc)
|
|
|
|
call cft3 (psic, nr1, nr2, nr3, nrx1, nrx2, nrx3, - 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! psic contains now Vxc(G)
|
|
|
|
!
|
|
|
|
allocate(rhocg(ngl))
|
2003-02-08 00:04:36 +08:00
|
|
|
sigmadiag = 0.0
|
2003-01-20 05:58:50 +08:00
|
|
|
if (gamma_only) then
|
|
|
|
fact = 2.d0
|
|
|
|
else
|
|
|
|
fact = 1.d0
|
|
|
|
end if
|
2003-02-08 00:04:36 +08:00
|
|
|
do nt = 1, ntyp
|
|
|
|
if (nlcc (nt) ) then
|
2003-01-20 05:58:50 +08:00
|
|
|
call drhoc (ngl, gl, omega, tpiba2, numeric (nt), a_nlcc (nt), &
|
|
|
|
b_nlcc (nt), alpha_nlcc (nt), mesh (nt), r (1, nt), rab (1, nt) &
|
|
|
|
, rho_atc (1, nt), rhocg)
|
|
|
|
! diagonal term
|
|
|
|
if (gstart==2) sigmadiag = sigmadiag + &
|
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
|
|
|
CONJG(psic (nl(1) ) ) * strf (1,nt) * rhocg (igtongl (1) )
|
2003-02-08 00:04:36 +08:00
|
|
|
do ng = gstart, ngm
|
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
|
|
|
sigmadiag = sigmadiag + CONJG(psic (nl (ng) ) ) * &
|
2003-01-20 05:58:50 +08:00
|
|
|
strf (ng,nt) * rhocg (igtongl (ng) ) * fact
|
|
|
|
enddo
|
|
|
|
|
|
|
|
call deriv_drhoc (ngl, gl, omega, tpiba2, numeric (nt), &
|
|
|
|
a_nlcc (nt), b_nlcc (nt), alpha_nlcc (nt), mesh (nt), r (1, nt), &
|
|
|
|
rab (1, nt), rho_atc (1, nt), rhocg)
|
|
|
|
! non diagonal term (g=0 contribution missing)
|
2003-02-08 00:04:36 +08:00
|
|
|
do ng = gstart, ngm
|
|
|
|
do l = 1, 3
|
|
|
|
do m = 1, 3
|
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
|
|
|
sigmaxcc (l, m) = sigmaxcc (l, m) + CONJG(psic (nl (ng) ) ) &
|
2003-01-20 05:58:50 +08:00
|
|
|
* strf (ng, nt) * rhocg (igtongl (ng) ) * tpiba * &
|
|
|
|
g (l, ng) * g (m, ng) / sqrt (gg (ng) ) * fact
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
do l = 1, 3
|
|
|
|
sigmaxcc (l, l) = sigmaxcc (l, l) + sigmadiag
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-21 22:57:00 +08:00
|
|
|
#ifdef __PARA
|
2003-02-08 00:04:36 +08:00
|
|
|
call reduce (9, sigmaxcc)
|
2003-01-20 05:58:50 +08:00
|
|
|
#endif
|
2003-02-08 00:04:36 +08:00
|
|
|
deallocate (rhocg)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine stres_cc
|
|
|
|
|