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
|
|
|
logical function lchk_tauxk (nvec, vec, trmat)
|
2003-01-20 05:58:50 +08:00
|
|
|
!-----------------------------------------------------------------------
|
|
|
|
!
|
|
|
|
! This routine tests that the atomic coordinates and/or k-points
|
|
|
|
! are different (except for a lattice translation).
|
|
|
|
!
|
|
|
|
! Last revision 15 June 1995 by A. Di Pomponio
|
|
|
|
!
|
2004-06-26 01:25:37 +08:00
|
|
|
#include "f_defs.h"
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
2004-01-23 23:08:03 +08:00
|
|
|
USE kinds
|
2003-02-08 00:04:36 +08:00
|
|
|
implicit none
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! first the dummy variables
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: nvec
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: number of vectors (atom. pos. or k-p
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP) :: vec (3, nvec), trmat (3, 3)
|
2003-01-20 05:58:50 +08:00
|
|
|
! input: cryst./cart. coord. of the vectors
|
|
|
|
! (atom. pos. or k-points)
|
|
|
|
! input: transf. matrix
|
|
|
|
! ( = bg , basis of the real-space lat
|
|
|
|
! for atoms or
|
|
|
|
! = at , basis of the rec.-space lat
|
|
|
|
! for k-points
|
|
|
|
!
|
|
|
|
! here the local variables
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
integer :: nv1, nv2, kpol
|
2003-01-20 05:58:50 +08:00
|
|
|
! first counter on vectors
|
|
|
|
! second counter on vectors
|
|
|
|
! counter on polarizations
|
2003-02-08 00:04:36 +08:00
|
|
|
real(kind=DP), allocatable :: vaux (:,:)
|
2004-04-03 21:24:17 +08:00
|
|
|
! auxiliary vectors (atom. coord. or k-points in cryst. units)
|
|
|
|
real(kind=DP) :: vdf (3)
|
2003-01-20 05:58:50 +08:00
|
|
|
! auxiliary vector
|
|
|
|
!
|
|
|
|
! Here, set the value of the acceptance parameter
|
|
|
|
!
|
2004-04-03 21:24:17 +08:00
|
|
|
real(kind=DP), parameter :: accep = 1.0d-5
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
!
|
|
|
|
! allocate work space
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
allocate (vaux( 3 , nvec))
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! The vectors are in cart. coordinates; they are transformed
|
|
|
|
! in crystall. units
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do nv1 = 1, nvec
|
|
|
|
do kpol = 1, 3
|
2003-01-20 05:58:50 +08:00
|
|
|
vaux (kpol, nv1) = trmat (1, kpol) * vec (1, nv1) + trmat (2, &
|
|
|
|
kpol) * vec (2, nv1) + trmat (3, kpol) * vec (3, nv1)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
|
|
|
! Test that all the atomic coordinates and/or k-points are different
|
|
|
|
! (if true, set the logical function lchk_tauxk as .true.)
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
do nv1 = 1, nvec - 1
|
|
|
|
do nv2 = nv1 + 1, nvec
|
|
|
|
do kpol = 1, 3
|
|
|
|
vdf (kpol) = vaux (kpol, nv2) - vaux (kpol, nv1)
|
2004-04-03 21:24:17 +08:00
|
|
|
vdf (kpol) = abs (vdf (kpol) - dble (nint (vdf (kpol) ) ) )
|
2003-01-20 05:58:50 +08:00
|
|
|
enddo
|
2004-04-03 21:24:17 +08:00
|
|
|
if ( (vdf (1) < accep) .and. (vdf (2) < accep) .and. &
|
|
|
|
(vdf (3) < accep) ) then
|
2003-02-08 00:04:36 +08:00
|
|
|
lchk_tauxk = .false.
|
|
|
|
goto 10
|
2003-01-20 05:58:50 +08:00
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
lchk_tauxk = .true.
|
2003-01-20 05:58:50 +08:00
|
|
|
!
|
|
|
|
! deallocate work space
|
|
|
|
!
|
2003-02-08 00:04:36 +08:00
|
|
|
10 deallocate(vaux)
|
|
|
|
return
|
2003-01-20 05:58:50 +08:00
|
|
|
end function lchk_tauxk
|
|
|
|
|