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-10-26 17:32:48 +08:00
|
|
|
#include "f_defs.h"
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
!-----------------------------------------------------------------------
|
2003-02-08 00:04:36 +08:00
|
|
|
subroutine trntnsc (phi, at, bg, iflg)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! trasforms a COMPLEX tensor (like the dynamical matrix)
|
|
|
|
! from crystal to cartesian axis (iflg >= 1) or viceversa (iflg <= -1)
|
|
|
|
!
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds, only : DP
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: iflg
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: gives the versus of the trans.
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: phi (3, 3)
|
2003-01-20 05:58:50 +08:00
|
|
|
! inp/out: the matrix to transform
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
real(DP) :: at (3, 3), bg (3, 3)
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: the direct lattice vectors
|
|
|
|
! input: the reciprocal lattice
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: i, j, k, l
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! counters on polarizations
|
|
|
|
! /
|
|
|
|
!/
|
|
|
|
|
|
|
|
|
2005-08-28 22:09:42 +08:00
|
|
|
complex(DP) :: wrk (3, 3)
|
2003-01-20 05:58:50 +08:00
|
|
|
! a working array
|
2003-02-08 00:04:36 +08:00
|
|
|
if (iflg.gt.0) then
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! forward transformation (crystal to cartesian axis)
|
|
|
|
!
|
|
|
|
|
2003-02-08 00:04:36 +08:00
|
|
|
call ZCOPY (9, phi, 1, wrk, 1)
|
|
|
|
do i = 1, 3
|
|
|
|
do j = 1, 3
|
|
|
|
phi (i, j) = (0.d0, 0.d0)
|
|
|
|
do k = 1, 3
|
|
|
|
do l = 1, 3
|
|
|
|
phi (i, j) = phi (i, j) + wrk (k, l) * bg (i, k) * bg (j, l)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
else
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! backward transformation (cartesian to crystal axis)
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do i = 1, 3
|
|
|
|
do j = 1, 3
|
|
|
|
wrk (i, j) = (0.d0, 0.d0)
|
|
|
|
do k = 1, 3
|
|
|
|
do l = 1, 3
|
|
|
|
wrk (i, j) = wrk (i, j) + phi (k, l) * at (k, i) * at (l, j)
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2003-02-08 00:04:36 +08:00
|
|
|
call ZCOPY (9, wrk, 1, phi, 1)
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
2003-02-08 00:04:36 +08:00
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end subroutine trntnsc
|