kpttet.f 7.83 KB
Newer Older
1 2 3 4
      MODULE m_kpttet
      use m_juDFT
      CONTAINS
      SUBROUTINE kpttet(
Daniel Wortmann's avatar
Daniel Wortmann committed
5 6
     >                  kmidtet,mkpt,ndiv3,
     >                  rltv,voluni,
7 8 9 10
     >                  nsym,ccr,mdir,mface,
     >                  ncorn,nface,fdist,fnorm,cpoint,
     <                  voltet,ntetra,ntet,vktet,
     =                  nkpt,
Daniel Wortmann's avatar
Daniel Wortmann committed
11
     <                  vkxyz,wghtkp)
12 13 14
c
c
c ---> This program generates k-points
Daniel Wortmann's avatar
Daniel Wortmann committed
15
c           in irreducible wedge of BZ  
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
c      (BZ = 1. Brillouin-zone) for all canonical Bravais lattices
c      in 3 dimensions,
c      using the basis vectors of the reciprocal lattice,
c      the corner points of the irreducible wedge of the BZ
c      and the bordering planes of the irreducible wedge.
c
c      The k-points are generated by the tetrahedron method.
c      by generating a set of k-points which are maximally far apart
c      for the rquired number of points.
c      The method and the subroutines were obtained via St.Bluegel.
c      The information about the irr wedge of the BZ
c      is taken from BRZONE.
c
c-----------------------------------------------------------------------
c    Meaning of variables:
c    INPUT:
c
c    Symmetry of lattice:
c    rltv     : cartesian coordinates of basis vectors for
c               reciprocal lattice: rltv(ix,jn), ix=1,3; jn=1,3
c    voluni   : volume of the Bravais lattice unit cell
c    nsym     : number of symmetry elements of points group
c    ccr     : rotation matrix for symmetry element
c                   in cartesian representation
c
c    representation of the irreducible part of the BZ:
c    fnorm    : normal vector of the planes bordering the irrBZ
c    fdist    : distance vector of the planes bordering the irrBZ
c    ncorn    : number of corners of the irrBZ
c    nface    : number of faces of the irrBZ
c    cpoint   : cartesian coordinates of corner points of irrBZ
c
c    characterization of the tetrahedron-method k-point set:
c    nkpt     : on input: required number of k-points inside irrBZ
c               to build the tetrahedrons
c    ntet     : number of tetrahedra generated
c    ntetra   : list of four points for each tetrahedron
c               containing the indices of the respective corner points
c    vktet    : corner points of tetrahedra
c
c    kmidtet  : key to generate mid-tetrahedron k-points
c               1 mid-points are generated; 0 not generated
c
c    OUTPUT: k-point set
c    nkpt     : number of k-points generated in set
c    vkxyz    : vector of kpoint generated; in cartesian representation
c    wghtkp   : weight associated with k-points for BZ integration
c
c-----------------------------------------------------------------------
      USE m_constants, ONLY : pimach
      USE m_tetcon
      USE m_kvecon
      USE m_fulstar
      IMPLICIT NONE
C
C-----> PARAMETER STATEMENTS
C
      INTEGER, INTENT (IN) :: mkpt,ndiv3,mface,mdir
c
c
c ---> running mode parameter
C
C----->  Symmetry information
C
      INTEGER, INTENT (IN) :: nsym
      REAL,    INTENT (IN) :: ccr(3,3,48)
C
C----->  BRAVAIS LATTICE INFORMATION
C
      REAL,    INTENT (IN) ::  voluni
C
C----->  RECIPROCAL LATTICE INFORMATION
C
      INTEGER, INTENT (IN) :: ncorn,nface
      REAL,    INTENT (IN) :: rltv(3,3),fnorm(3,mface),fdist(mface)
      REAL,    INTENT (IN) :: cpoint(3,mface)
C
C----->  BRILLOUINE ZONE INTEGRATION
C
Daniel Wortmann's avatar
Daniel Wortmann committed
95
      INTEGER, INTENT (IN) :: kmidtet
96 97 98
      INTEGER, INTENT (INOUT) :: nkpt
      INTEGER, INTENT (OUT) :: ntetra(4,ndiv3),ntet
      REAL,    INTENT (OUT) :: voltet(ndiv3),vktet(3,mkpt)
Daniel Wortmann's avatar
Daniel Wortmann committed
99
      REAL,    INTENT (OUT) :: vkxyz(3,mkpt),wghtkp(mkpt)
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

C
C --->  local variables
c
      INTEGER   i,j,ii, nkstar
      REAL      sumwght,eps,one,tpi,sumvol,volirbz
      REAL      vkmid(3,mkpt)
C
C --->  set local constants
c
      SAVE      eps,one
      DATA      eps/1.0e-9/,one/1.0/
c
c======================================================================
c
      tpi = 2.0 * pimach()
c
Daniel Wortmann's avatar
Daniel Wortmann committed
117 118
   
      WRITE (6,'('' k-points generated with tetrahedron '',
119
     >                                              ''method'')')
Daniel Wortmann's avatar
Daniel Wortmann committed
120
      WRITE (6,'(''# k-points generated with tetrahedron '',
121
     >                                              ''method'')')
Daniel Wortmann's avatar
Daniel Wortmann committed
122 123 124
      WRITE (6,'(3x,'' in irred wedge of 1. Brillouin zone'')')
      WRITE (6,'(3x,'' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'')')
    
125
      CALL kvecon(
Daniel Wortmann's avatar
Daniel Wortmann committed
126
     >            6,6,mkpt,mface,
127 128 129 130 131 132 133 134 135 136
     >            nkpt,ncorn,nsym,nface,rltv,fdist,fnorm,cpoint,
     <            vktet )
!
! --->  generate tetrahedra and mid-tetrahedron k-points
!
! --->  (a) Determine the corner K-POINTs for X number of Tetrahedra for
!           doing a very pretty Brillouine zone Integration;
! --->      determine the volume of each tetrahedron
!
      CALL tetcon(
Daniel Wortmann's avatar
Daniel Wortmann committed
137
     >            6,6,mkpt,ndiv3,
138 139 140 141
     >            nkpt,voluni,vktet,
     =            nsym,
     <            ntet,voltet,ntetra)
c
Daniel Wortmann's avatar
Daniel Wortmann committed
142 143 144 145
      WRITE (6,'('' the number of tetrahedra '')')
      WRITE (6,*) ntet
      WRITE (6,'('' volumes of the tetrahedra '')')
      WRITE (6,'(e19.12,1x,i5,5x,''voltet(i),i'')')
146
     >                               (voltet(i),i,i=1,ntet)
Daniel Wortmann's avatar
Daniel Wortmann committed
147 148 149 150 151 152
      WRITE (6,'('' corners of the tetrahedra '')')
      WRITE (6, 999) ((ntetra(j,i),j=1,4),i=1,ntet)
      WRITE (6,'('' the # of different k-points '')')
      WRITE (6,*) nkpt
      WRITE (6,'('' k-points used to construct tetrahedra'')')
      WRITE (6,'(3(4x,f10.6))') ((vktet(i,j),i=1,3),j=1,nkpt)
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
  999 FORMAT (4(3x,4i4))
c
c --->   calculate weights from volume of tetrahedra
c
      volirbz =  tpi**3 /(real(nsym)*voluni)
      sumvol = 0.0
      DO i = 1, ntet
         sumvol = sumvol + voltet(i)
         voltet(i) = ntet * voltet(i) / volirbz 
      ENDDO
c
      IF ((sumvol-volirbz)/volirbz .LE. eps) THEN
        IF (kmidtet.EQ.1) THEN
          DO i = 1, ntet
            wghtkp(i) = voltet(i)/sumvol
          ENDDO
        ELSE
          DO i = 1, nkpt
            wghtkp(i) = 1./nkpt
          ENDDO
        ENDIF
      ELSE
Daniel Wortmann's avatar
Daniel Wortmann committed
175
        WRITE (6, '(2(e19.12,1x),5x,''summvol.ne.volirbz'')')
176 177 178 179 180 181 182 183 184 185
     >                                     sumvol,volirbz
         CALL juDFT_error("sumvol =/= volirbz",calledby="kpttet")
      ENDIF
c
c --->  prepare the final set of kpoints in irrBZ (depending on kmidtet)
c
      IF ( kmidtet.EQ.0) THEN
c
        DO i = 1, nkpt
           vkxyz(:,i) = vktet(:,i)
Daniel Wortmann's avatar
Daniel Wortmann committed
186
           WRITE (6,'(3(f10.7,1x),f12.10,1x,i4,3x,
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
     +           ''vkxyz, wghtkp'')') (vkxyz(ii,i),ii=1,3),wghtkp(i),i
        ENDDO  
        nkstar = nkpt

      ELSEIF ( kmidtet.EQ.1) THEN
c
c --->  (b) calculate mid-tetrahedron k-points
c
         DO i=1,ntet
            vkmid(:,i) = 0.0
            DO j=1,4
               vkmid(:,i) = vkmid(:,i) + vktet(:,ntetra(j,i))
            ENDDO
            vkmid(:,i) = vkmid(:,i) * 0.25
         ENDDO

         nkpt = ntet
Daniel Wortmann's avatar
Daniel Wortmann committed
204 205
         WRITE (6,'('' the new number of k-points is '',i4)') nkpt
         WRITE (6,'('' the new k-points are the '',
206
     +                        ''mid-tetrahedron-points '')')
Daniel Wortmann's avatar
Daniel Wortmann committed
207
         WRITE (6,'(''# the new k-points are the '',
208 209 210 211 212 213 214 215 216 217
     +                        ''mid-tetrahedron-points '')')
         sumwght = 0.00
         DO i=1,ntet
           vkxyz(:,i) = vkmid(:,i)
           sumwght = sumwght + wghtkp(i)
         ENDDO
!
! ---> check sumwght; if abs(sumwght-1).lt.eps print kpoints and weights
!
         IF ( abs(sumwght - one).LT.eps) THEN
Daniel Wortmann's avatar
Daniel Wortmann committed
218
            WRITE (6,'(1x,f12.10,1x,'' sumwght .eq. one'')')
219 220
     +                                                   sumwght
            DO i=1,nkpt
Daniel Wortmann's avatar
Daniel Wortmann committed
221
               WRITE (6,'(3(f10.7,1x),f12.10,1x,i4,3x,
222 223 224 225 226
     +            ''vkxyz, wghtkp'')') (vkxyz(ii,i),ii=1,3),wghtkp(i), i
            ENDDO
            nkstar = ntet

         ELSE
Daniel Wortmann's avatar
Daniel Wortmann committed
227
            WRITE (6,'(1x,f12.10,1x,'' sumwght .ne. one'')')
228 229 230 231 232 233 234 235 236 237
     +                                                   sumwght
             CALL juDFT_error("sumwght",calledby="kpttet")
         ENDIF

      END IF ! end of generation of mid-tetrahedron k-points


      RETURN
      END SUBROUTINE kpttet
      END MODULE m_kpttet