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 dynmat0
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine computes the part of the dynamical matrix which
|
|
|
|
! does not depend upon the change of the Bloch wavefunctions.
|
|
|
|
! It is a driver which calls the routines dynmat_## and d2ionq
|
|
|
|
! for computing respectively the electronic part and
|
|
|
|
! the ionic part
|
|
|
|
!
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2004-06-12 21:44:18 +08:00
|
|
|
!
|
|
|
|
USE ions_base, ONLY : nat,ntyp => nsp, ityp, zv, tau
|
2005-12-21 19:20:28 +08:00
|
|
|
USE cell_base, ONLY: alat, omega, at, bg
|
|
|
|
USE gvect, ONLY: g, gg, ngm, gcutm
|
|
|
|
USE symme, ONLY: irt, s
|
2004-12-10 23:20:46 +08:00
|
|
|
USE control_flags, ONLY : modenum
|
2004-04-02 21:01:15 +08:00
|
|
|
USE kinds, ONLY : DP
|
2003-02-08 00:04:36 +08:00
|
|
|
use phcom
|
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: nu_i, nu_j, na_icart, nb_jcart
|
2003-01-20 05:58:50 +08:00
|
|
|
! counters
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: wrk, dynwrk (3 * nat, 3 * nat)
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliary space
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call start_clock ('dynmat0')
|
|
|
|
call ZCOPY (9 * nat * nat, dyn00, 1, dyn, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! first electronic contribution arising from the term <psi|d2v|psi>
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call dynmat_us
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Here the ionic contribution
|
|
|
|
!
|
|
|
|
call d2ionq (nat, ntyp, ityp, zv, tau, alat, omega, xq, at, bg, g, &
|
|
|
|
gg, ngm, gcutm, nmodes, u, dyn)
|
|
|
|
!
|
|
|
|
! Add non-linear core-correction (NLCC) contribution (if any)
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call dynmatcc
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! Symmetrizes the dynamical matrix w.r.t. the small group of q and of
|
|
|
|
! mode. This is done here, because this part of the dynmical matrix is
|
2003-04-23 00:03:45 +08:00
|
|
|
! saved with recover and in the other runs the symmetry group might change
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2004-12-10 23:20:46 +08:00
|
|
|
if (modenum .ne. 0) then
|
2003-01-20 05:58:50 +08:00
|
|
|
|
|
|
|
call symdyn_munu (dyn, u, xq, s, invs, rtau, irt, irgq, at, bg, &
|
|
|
|
nsymq, nat, irotmq, minus_q)
|
|
|
|
!
|
|
|
|
! rotate again in the pattern basis
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
call ZCOPY (9 * nat * nat, dyn, 1, dynwrk, 1)
|
|
|
|
do nu_i = 1, 3 * nat
|
|
|
|
do nu_j = 1, 3 * nat
|
|
|
|
wrk = (0.d0, 0.d0)
|
|
|
|
do nb_jcart = 1, 3 * nat
|
|
|
|
do na_icart = 1, 3 * nat
|
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
|
|
|
wrk = wrk + CONJG(u (na_icart, nu_i) ) * &
|
2003-04-23 00:03:45 +08:00
|
|
|
dynwrk (na_icart, nb_jcart) * &
|
|
|
|
u (nb_jcart, nu_j)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
dyn (nu_i, nu_j) = wrk
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
call ZCOPY (9 * nat * nat, dyn, 1, dyn00, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
! call tra_write_matrix('dynmat0 dyn',dyn,u,nat)
|
2003-02-08 00:04:36 +08:00
|
|
|
call stop_clock ('dynmat0')
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine dynmat0
|