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 .
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!---------------------------------------------------------------------
|
|
|
|
subroutine set_irr_mode (nat, at, bg, xq, s, invs, nsym, rtau, &
|
2003-07-21 21:35:53 +08:00
|
|
|
irt, irgq, nsymq, minus_q, irotmq, t, tmq, max_irr_dim, u, &
|
|
|
|
npert, nirr, gi, gimq, iverbosity, modenum)
|
2003-01-20 05:58:50 +08:00
|
|
|
!---------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine computes the symmetry matrix of the mode defined
|
|
|
|
! by modenum. It sets also the modes u for all the other
|
|
|
|
! representation
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, only : DP
|
2004-03-07 21:47:42 +08:00
|
|
|
USE constants, ONLY: tpi
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! first the dummy variables
|
|
|
|
!
|
|
|
|
|
|
|
|
integer :: nat, nsym, s (3, 3, 48), invs (48), irt (48, nat), &
|
|
|
|
iverbosity, modenum, npert (3 * nat), irgq (48), nsymq, irotmq, &
|
2003-01-28 00:42:47 +08:00
|
|
|
nirr, max_irr_dim
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: the number of atoms
|
|
|
|
! input: the number of symmetries
|
|
|
|
! input: the symmetry matrices
|
|
|
|
! input: the inverse of each matrix
|
|
|
|
! input: the rotated of each atom
|
|
|
|
! input: write control
|
|
|
|
! input: the mode to be done
|
|
|
|
! output: the dimension of each represe
|
|
|
|
! output: the small group of q
|
|
|
|
! output: the order of the small group
|
|
|
|
! output: the symmetry sending q -> -q+
|
|
|
|
! output: the number of irr. representa
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: xq (3), rtau (3, 48, nat), at (3, 3), bg (3, 3), &
|
2003-01-20 05:58:50 +08:00
|
|
|
gi (3, 48), gimq (3)
|
|
|
|
! input: the q point
|
|
|
|
! input: the R associated to each tau
|
|
|
|
! input: the direct lattice vectors
|
|
|
|
! input: the reciprocal lattice vectors
|
|
|
|
! output: [S(irotq)*q - q]
|
|
|
|
! output: [S(irotmq)*q + q]
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: u(3*nat, 3*nat), t(max_irr_dim, max_irr_dim, 48, 3*nat),&
|
2003-01-28 00:42:47 +08:00
|
|
|
tmq (max_irr_dim, max_irr_dim, 3 * nat)
|
2003-01-20 05:58:50 +08:00
|
|
|
! output: the pattern vectors
|
|
|
|
! output: the symmetry matrices
|
|
|
|
! output: the matrice sending q -> -q+G
|
2003-02-08 00:04:36 +08:00
|
|
|
logical :: minus_q
|
2004-03-07 21:47:42 +08:00
|
|
|
! output: if true one symmetry send q -> -q+G
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! here the local variables
|
|
|
|
!
|
|
|
|
integer :: na, imode, jmode, ipert, jpert, nsymtot, imode0, irr, &
|
|
|
|
ipol, jpol, isymq, irot, sna
|
2004-03-07 21:47:42 +08:00
|
|
|
! counters and auxilary variables
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: modul, arg
|
2003-01-20 05:58:50 +08:00
|
|
|
! the modulus of the mode
|
|
|
|
! the argument of the phase
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: wrk_u (3, nat), wrk_ru (3, nat), fase
|
2003-01-20 05:58:50 +08:00
|
|
|
! one pattern
|
|
|
|
! the rotated of one pattern
|
|
|
|
! the phase factor
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
logical :: lgamma
|
2003-01-20 05:58:50 +08:00
|
|
|
! if true gamma point
|
|
|
|
!
|
|
|
|
! Allocate the necessary quantities
|
|
|
|
!
|
2004-03-07 21:47:42 +08:00
|
|
|
lgamma = (xq (1) == 0.d0 .and. xq (2) == 0.d0 .and. xq (3) == 0.d0)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! find the small group of q
|
|
|
|
!
|
2003-01-28 00:42:47 +08:00
|
|
|
call smallgq (xq, at, bg, s, nsym, irgq, nsymq, irotmq, minus_q, gi, gimq)
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! set the modes to be done
|
|
|
|
!
|
2004-03-07 21:47:42 +08:00
|
|
|
u (:, :) = (0.d0, 0.d0)
|
2003-02-08 00:04:36 +08:00
|
|
|
do imode = 1, 3 * nat
|
|
|
|
u (imode, imode) = (1.d0, 0.d0)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! Here we count the irreducible representations and their dimensions
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
nirr = 3 * nat
|
2004-03-07 21:47:42 +08:00
|
|
|
! initialization
|
|
|
|
npert (:) = 1
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! And we compute the matrices which represent the symmetry transformat
|
|
|
|
! in the basis of the displacements
|
|
|
|
!
|
2004-03-07 21:47:42 +08:00
|
|
|
|
|
|
|
t(:, :, :, :) = (0.d0, 0.d0)
|
|
|
|
tmq (:, :, :) = (0.d0, 0.d0)
|
2003-02-08 00:04:36 +08:00
|
|
|
if (minus_q) then
|
|
|
|
nsymtot = nsymq + 1
|
|
|
|
else
|
|
|
|
nsymtot = nsymq
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2004-03-07 21:47:42 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
do isymq = 1, nsymtot
|
|
|
|
if (isymq.le.nsymq) then
|
|
|
|
irot = irgq (isymq)
|
|
|
|
else
|
|
|
|
irot = irotmq
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
imode0 = 0
|
|
|
|
do irr = 1, nirr
|
|
|
|
do ipert = 1, npert (irr)
|
|
|
|
imode = imode0 + ipert
|
|
|
|
do na = 1, nat
|
|
|
|
do ipol = 1, 3
|
|
|
|
jmode = 3 * (na - 1) + ipol
|
|
|
|
wrk_u (ipol, na) = u (jmode, imode)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! transform this pattern to crystal basis
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do na = 1, nat
|
|
|
|
call trnvecc (wrk_u (1, na), at, bg, - 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! the patterns are rotated with this symmetry
|
|
|
|
!
|
2004-03-07 21:47:42 +08:00
|
|
|
wrk_ru(:,:) = (0.d0, 0.d0)
|
2003-02-08 00:04:36 +08:00
|
|
|
do na = 1, nat
|
|
|
|
sna = irt (irot, na)
|
|
|
|
arg = 0.d0
|
|
|
|
do ipol = 1, 3
|
|
|
|
arg = arg + xq (ipol) * rtau (ipol, irot, na)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
arg = arg * tpi
|
2004-03-07 21:47:42 +08:00
|
|
|
if (isymq == nsymtot .and. minus_q) then
|
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
|
|
|
fase = CMPLX (cos (arg), sin (arg) )
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
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
|
|
|
fase = CMPLX (cos (arg), - sin (arg) )
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
do ipol = 1, 3
|
|
|
|
do jpol = 1, 3
|
2004-03-07 21:47:42 +08:00
|
|
|
wrk_ru (ipol, sna) = wrk_ru (ipol, sna) + fase * &
|
|
|
|
s (jpol, ipol, irot) * wrk_u (jpol, na)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! Transform back the rotated pattern
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do na = 1, nat
|
|
|
|
call trnvecc (wrk_ru (1, na), at, bg, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! Computes the symmetry matrices on the basis of the pattern
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do jpert = 1, npert (irr)
|
|
|
|
imode = imode0 + jpert
|
|
|
|
do na = 1, nat
|
|
|
|
do ipol = 1, 3
|
|
|
|
jmode = ipol + (na - 1) * 3
|
2004-03-07 21:47:42 +08:00
|
|
|
if (isymq == nsymtot .and. minus_q) then
|
|
|
|
tmq (jpert, ipert, irr) = tmq (jpert, ipert, irr) + &
|
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(u (jmode, imode) * wrk_ru (ipol, na) )
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
2003-01-20 05:58:50 +08:00
|
|
|
t (jpert, ipert, irot, irr) = t (jpert, ipert, irot, irr) &
|
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(u (jmode, imode) ) * wrk_ru (ipol, na)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
imode0 = imode0 + npert (irr)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
|
|
|
|
enddo
|
2003-11-06 03:01:20 +08:00
|
|
|
! WRITE( stdout,*) 'nsymq',nsymq
|
2003-01-20 05:58:50 +08:00
|
|
|
! do isymq=1,nsymq
|
|
|
|
! irot=irgq(isymq)
|
2003-11-06 03:01:20 +08:00
|
|
|
! WRITE( stdout,'("t(1,1,irot,modenum)",i5,2f10.5)')
|
2003-01-20 05:58:50 +08:00
|
|
|
! + irot,t(1,1,irot,modenum)
|
|
|
|
! enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine set_irr_mode
|