TABLE OF CONTENTS


ABINIT/symkchk [ Functions ]

[ Top ] [ Functions ]

NAME

 symkchk

FUNCTION

 Checks that the set of k points chosen for a response function
 calculation has the full space group symmetry, modulo time reversal if appropriate.
 Returns ierr/=0 with error message if not satisfied
 Currently used only when strain perturbation is treated. Based on symkpt.

COPYRIGHT

 Copyright (C) 1999-2017 ABINIT group (DRH, XG, LSI)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributors, see ~abinit/doc/developers/contributors.txt .

INPUTS

 kptns(3,nkpt)= k vectors in reciprocal space
 nkpt = number of k-points whose weights are wtk
 nsym=number of space group symmetries
 symrec(3,3,nsym)=3x3 matrices of the group symmetries (reciprocal space)
 timrev: if 1, the time reversal operation has to be taken into account
 if 0, no time reversal symmetry.

OUTPUT

  msg=Error message if ierr /= 0

PARENTS

      respfn

CHILDREN

      wrtout

SOURCE

 38 #if defined HAVE_CONFIG_H
 39 #include "config.h"
 40 #endif
 41 
 42 #include "abi_common.h"
 43 
 44 
 45 integer function symkchk(kptns,nkpt,nsym,symrec,timrev,errmsg) result(ierr)
 46 
 47  use defs_basis
 48  use m_errors
 49  use m_profiling_abi
 50 
 51  use m_fstrings,    only : itoa, sjoin
 52 
 53 !This section has been created automatically by the script Abilint (TD).
 54 !Do not modify the following lines by hand.
 55 #undef ABI_FUNC
 56 #define ABI_FUNC 'symkchk'
 57  use interfaces_14_hidewrite
 58 !End of the abilint section
 59 
 60  implicit none
 61 
 62 !Arguments -------------------------------
 63 !scalars
 64  integer,intent(in) :: nkpt,nsym,timrev
 65  character(len=*),intent(out) :: errmsg
 66 !arrays
 67  integer,intent(in) :: symrec(3,3,nsym)
 68  real(dp),intent(in) :: kptns(3,nkpt)
 69 
 70 !Local variables -------------------------
 71 !scalars
 72  integer :: identi,ii,ikpt,ikpt2,imatch,isym,jj,tident
 73  real(dp) :: difk,reduce
 74  character(len=500) :: message
 75 !arrays
 76  real(dp) :: ksym(3)
 77 
 78 ! *********************************************************************
 79  ierr = 0
 80 
 81  if(timrev/=1 .and. timrev/=0)then
 82    write(errmsg, '(3a,i0,a)' )&
 83 &   'timrev should be 0 or 1, while',ch10,&
 84 &   'it is equal to ',timrev,'.'
 85    ierr = 1; return
 86  end if
 87 
 88  if(nsym/=1)then
 89 !  Find the identity symmetry operation
 90    do isym=1,nsym
 91      tident=1
 92      do jj=1,3
 93        if(symrec(jj,jj,isym)/=1)tident=0
 94        do ii=1,3
 95          if( ii/=jj .and.&
 96 &         symrec(ii,jj,isym)/=0)tident=0
 97        end do
 98      end do
 99      if(tident==1)then
100        identi=isym
101        call wrtout(std_out,sjoin(' symkchk: found identity with number:', itoa(identi)))
102        exit
103      end if
104    end do
105    if(tident==0)then
106      errmsg = 'Did not found the identity operation.'
107      ierr = 1; return
108    end if
109  end if
110 
111 !Here begins the serious business
112 !The length sorting, etc. of symkpt have been dropped because the
113 !computational cost is estimated to be negligible.
114 
115  if(nsym>1 .or. timrev==1)then
116 
117 !  Outer loop over kpts
118    do ikpt=1,nkpt-1
119 
120 !    Loop on the symmetries
121 !    For each k-point and each symmetry transformation, a matching
122 !    k-pointpt must be found, modulo time reversal if appropriate
123      do isym=1,nsym
124 
125 !      Get the symmetric of the vector
126        do ii=1,3
127          ksym(ii)= kptns(1,ikpt)*symrec(ii,1,isym)&
128 &         +kptns(2,ikpt)*symrec(ii,2,isym)&
129 &         +kptns(3,ikpt)*symrec(ii,3,isym)
130        end do
131 
132 !      Second loop k-points
133        do ikpt2=1,nkpt
134 
135 !        Test for match of symmetric and any vector (including original)
136          imatch=1
137          do ii=1,3
138            difk= ksym(ii)-kptns(ii,ikpt2)
139            reduce=difk-anint(difk)
140            if(abs(reduce)>tol8)imatch=0
141          end do
142          if(imatch==1)exit
143 
144 !        Test for match with time reversal
145          if(timrev==1)then
146            imatch=1
147            do ii=1,3
148              difk= ksym(ii)+kptns(ii,ikpt2)
149              reduce=difk-anint(difk)
150              if(abs(reduce)>tol8)imatch=0
151            end do
152            if(imatch==1)exit
153          end if
154 
155        end do ! End secondary loop over k-points
156        if (imatch/=1) then
157          write(errmsg, '(a,a,a,i4,a,i4,a,a,a,a)' )&
158 &         'k-point set must have full space-group symmetry',ch10,&
159 &         'there is no match for kpt',ikpt,' transformed by symmetry',isym,ch10,&
160 &         'Action: change kptopt to 2 or 3 and/or change or use shiftk',ch10,&
161 &         'shiftk = 0 0 0 is always a safe choice.'
162          ierr = 2; return
163        end if
164 
165      end do ! End loop on isym
166    end do ! End primary loop over k-points
167 
168    write(message,'(a)')' symkchk : k-point set has full space-group symmetry.'
169    call wrtout(std_out,message,'COLL')
170    call wrtout(ab_out,message,'COLL')
171  end if
172 
173 end function symkchk