bandstr1.F 19.4 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8
      MODULE m_bandstr1
      use m_juDFT
9
      USE m_types
10
      use m_unfold_band_kpts
11 12 13 14
!----------------------------------------------------------------------
!----------------------------------------------------------------------
      CONTAINS
      SUBROUTINE bandstr1(
15
     >               idsyst,idtype,bmat,kpts,input,l_fillArrays,banddos)
16 17
      IMPLICIT NONE

18
      TYPE(t_input),INTENT(IN) :: input
19 20 21
      TYPE(t_kpts),INTENT(INOUT)  :: kpts

      INTEGER, INTENT (IN)  :: idsyst,idtype
22
      REAL,    INTENT (IN)  :: bmat(3,3)
23
      LOGICAL, INTENT (IN)  :: l_fillArrays
24
      TYPE(t_banddos),INTENT(IN)  :: banddos
25 26 27 28

      REAL, POINTER             :: syp(:,:) 
      CHARACTER(len=1), POINTER :: ssy(:)
      REAL,    ALLOCATABLE      :: rsyp(:,:),del(:),d(:)
29
      REAL,    ALLOCATABLE      :: bkTemp(:,:)
30 31 32
      INTEGER, ALLOCATABLE      :: nk(:)
      INTEGER nosyp,i,j,n,ntot
      REAL dk(3),syp1(3),rsyp1(3)
33

34
      CALL get_points(
35
     >                input%film,idsyst,idtype,bmat,kpts,
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
     <                nosyp,syp,ssy)
!
! --> transform to cartesian units
!
      ALLOCATE ( rsyp(3,nosyp),del(nosyp),d(nosyp),nk(nosyp) ) 
      DO i = 1,nosyp
        syp1(:) = syp(:,i)
        !CALL cotra3(syp1,rsyp1,bmat)
        rsyp1=matmul(syp1,bmat)
        rsyp(:,i) = rsyp1(:)
      ENDDO
!
! --> calculate length between points
!
      d(1) = 0.0
      DO i = 2,nosyp
        del(i) = ( rsyp(1,i) - rsyp(1,i-1) )**2 +
     +           ( rsyp(2,i) - rsyp(2,i-1) )**2 +
     +           ( rsyp(3,i) - rsyp(3,i-1) )**2
        del(i) = sqrt(del(i))
        d(i) = d(i-1) + del(i)
      ENDDO
!
! --> distibute points evenly
!
      ntot = nosyp
      DO i = 2,nosyp
63
        nk(i) = NINT ( (kpts%nkpt-nosyp)*( del(i) / d(nosyp) ) )
64
        ntot = ntot + nk(i)
65 66 67 68
      ENDDO
      kpts%nkpt = ntot

      ALLOCATE (bkTemp(3,kpts%nkpt))
69
      ALLOCATE (kpts%specialPointIndices(kpts%numSpecialPoints))
70 71 72 73 74 75 76 77
!
! --> generate k-points mesh 
!
      n = 1
      DO i = 2,nosyp
         dk(1) = ( syp(1,i) - syp(1,i-1) ) / (nk(i)+1)
         dk(2) = ( syp(2,i) - syp(2,i-1) ) / (nk(i)+1)
         dk(3) = ( syp(3,i) - syp(3,i-1) ) / (nk(i)+1)
78
         bkTemp(:,n) = syp(:,i-1)
79
         kpts%specialPointIndices(i-1) = n
80 81
         n = n + 1
         DO j = 1, nk(i)
82
            bkTemp(:,n) = bkTemp(:,n-1) + dk(:)
83 84 85
            n = n + 1
         ENDDO
      ENDDO
86
      bkTemp(:,n) = syp(:,nosyp)
87
      kpts%specialPointIndices(nosyp) = n
88
      kpts%nkpt = kpts%nkpt
89
      kpts%posScale = 1.0
90

91 92 93 94
      IF(l_fillArrays) THEN
         IF(ALLOCATED(kpts%bk)) THEN
            DEALLOCATE(kpts%bk)
         END IF
95 96
         IF(ALLOCATED(kpts%wtkpt)) THEN
            DEALLOCATE(kpts%wtkpt)
97
         END IF
98
         ALLOCATE (kpts%bk(3,kpts%nkpt), kpts%wtkpt(kpts%nkpt))
99
         kpts%bk(:,:) = bkTemp(:,:)
100
         kpts%wtkpt = 1.0
101
      ELSE
102 103 104 105 106 107 108 109 110 111 112 113 114
         OPEN (41,file='kpts',form='formatted',status='new')
         IF (.NOT.input%film) THEN
            WRITE(41,'(i5,f20.10)') kpts%nkpt,kpts%posScale
            DO n = 1, kpts%nkpt
               WRITE (41,'(4f10.5)') bkTemp(:,n),1.0
            ENDDO
         ELSE
           WRITE(41,'(i5,f20.10,3x,l1)') kpts%nkpt,kpts%posScale,.false.
           DO n = 1, kpts%nkpt
              WRITE (41,'(3f10.5)') bkTemp(1:2,n),1.0
           ENDDO
         END IF
         CLOSE (41)
115 116
      END IF

117 118 119 120 121
      IF (banddos%unfoldband) THEN
          CALL write_gnu_sc(
     >               nosyp,d,ssy,input)  
      ELSE
          CALL write_gnu(
122
     >               nosyp,d,ssy,input)
123
      END IF
124
      DEALLOCATE ( rsyp,syp,del,nk,ssy,d,bkTemp )
125 126 127 128 129 130 131

      END SUBROUTINE bandstr1
!----------------------------------------------------------------------
! once the file "bands.1" and "bands.2" are created, activate with:
! gnuplot < band.gnu > band.ps
!----------------------------------------------------------------------
      SUBROUTINE write_gnu(
132
     >                     nosyp,d,ssy,input)
133 134
!
      IMPLICIT NONE
135 136 137

      TYPE(t_input),INTENT(IN) :: input
      INTEGER, INTENT (IN) :: nosyp
138 139 140 141
      REAL,    INTENT (IN) :: d(nosyp)
      CHARACTER(len=1), INTENT (IN) :: ssy(nosyp)
      
      INTEGER n,aoff,adel
142
      CHARACTER(LEN=200) tempTitle
143 144
      aoff = iachar('a')-1
      adel = iachar('a')-iachar('A')
Daniel Wortmann's avatar
Daniel Wortmann committed
145
      !write(*,*) aoff,adel 
146 147 148 149 150 151

      OPEN (27,file='band.gnu',status='unknown')
      WRITE (27,900)
      WRITE (27,901)
      WRITE (27,902)
      WRITE (27,903)
152 153 154 155 156
      WRITE(tempTitle,'(10a)') input%comment
      IF(TRIM(ADJUSTL(tempTitle)).EQ.'') THEN
         tempTitle = "Fleur Bandstructure"
      END IF
      WRITE (27,904) TRIM(ADJUSTL(tempTitle))
157 158 159 160 161 162 163 164
      DO n = 1, nosyp
        WRITE (27,905) d(n),d(n)
      ENDDO
      WRITE (27,906) d(1),d(nosyp)
!
! nomal labels
!
      IF (iachar(ssy(1)) < aoff ) THEN
165
        WRITE (27,907) ssy(1),d(1),achar(92)
166
      ELSE
167
        WRITE (27,907) " ",d(1),achar(92)
168 169 170
      ENDIF
      DO n = 2, nosyp-1
        IF (iachar(ssy(n)) < aoff ) THEN 
171
          WRITE (27,908) ssy(n),d(n),achar(92)
172
        ELSE
173
          WRITE (27,908) " ",d(n),achar(92)
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
        ENDIF
      ENDDO
      IF (iachar(ssy(nosyp)) < aoff ) THEN
        WRITE (27,909) ssy(nosyp),d(nosyp)
      ELSE
        WRITE (27,909) " ",d(nosyp)
      ENDIF
!
! greek labels
!
      DO n = 1, nosyp
        IF (iachar(ssy(n)) > aoff ) THEN
          WRITE (27,914) achar(iachar(ssy(n))-adel),d(n)
        ENDIF
      ENDDO
!
! now write the rest
!
      WRITE (27,910) 
193 194
      WRITE (27,911) d(nosyp)+0.00001,achar(92)
      IF (input%jspins == 2) WRITE (27,912) achar(92)
195 196 197
      WRITE (27,913)
      CLOSE (27)

198
 900  FORMAT ('set terminal postscript enhanced color "Times-Roman" 20')
199 200 201
 901  FORMAT ('set xlabel ""')
 902  FORMAT ('set ylabel "E - E_F (eV)"')
 903  FORMAT ('set nokey')
202
 904  FORMAT ('set title "',a,'"')
203 204
 905  FORMAT ('set arrow from',f9.5,', -9.0 to',f9.5,',  5.0 nohead')
 906  FORMAT ('set arrow from',f9.5,', 0.0 to',f9.5,', 0.0 nohead lt 3')
205 206
 907  FORMAT ('set xtics ("',a1,'"',f9.5,', ',a)
 908  FORMAT ('           "',a1,'"',f9.5,', ',a)
207 208
 909  FORMAT ('           "',a1,'"',f9.5,'  )')
 910  FORMAT ('set ytics -8,2,4')
209 210
 911  FORMAT ('plot [0:',f9.5,'] [-9:5] ',a)
 912  FORMAT ('"bands.2" using 1:($2+0.00) w p pt 12 ps 0.5,',a)
211 212 213 214 215 216 217 218 219 220
 913  FORMAT ('"bands.1" using 1:($2+0.00)  w p pt  7 ps 0.5')
 914  FORMAT ('set label "',a1,'" at ',f9.5,
     +        ', -9.65 center font "Symbol,20"')

      END SUBROUTINE write_gnu
!----------------------------------------------------------------------
! given a bravais-lattice, determine <nosyp> symmetry points (syp)
! and their names (lowercase = greek)
!----------------------------------------------------------------------
      SUBROUTINE get_points(
221
     >                      l_film,idsyst,idtype,bmat,kpts,
222 223 224
     <                      nosyp,syp,ssy)

      IMPLICIT NONE
225

226 227 228 229 230 231 232
      TYPE(t_kpts),INTENT (INOUT)  :: kpts
      LOGICAL,     INTENT (IN)     :: l_film
      INTEGER,     INTENT (IN)     :: idsyst,idtype
      REAL,        INTENT (IN)     :: bmat(3,3)
      INTEGER,     INTENT (OUT)    :: nosyp
      REAL,             POINTER    :: syp(:,:)  ! actually intent out
      CHARACTER(len=1), POINTER    :: ssy(:)
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255

      LOGICAL         :: band_inp_file
      INTEGER         :: n
      REAL, PARAMETER :: f12 = 1./2., f14 = 1./4., zro = 0.0
      REAL, PARAMETER :: f34 = 3./4., f38 = 3./8., one = 1.0
      REAL, PARAMETER :: f13 = 1./3., f23 = 2./3.

      !Check if band_inp file exists for lines
      INQUIRE(file ="band_inp",exist= band_inp_file)
      IF (band_inp_file) THEN
         OPEN(99,file ="band_inp",status ="old")
         nosyp=0
         !count the lines
         DO
            READ(99,*,END = 100)
            nosyp=nosyp+1
         ENDDO
 100     REWIND 99
         ALLOCATE(syp(3,nosyp),ssy(nosyp) )
         DO n = 1,nosyp
            READ(99,*,err = 110,END=110) ssy(n),syp(:,n)
         ENDDO
         CLOSE(99)
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272

         IF(nosyp.GE.2) THEN
            kpts%numSpecialPoints = nosyp
            IF (ALLOCATED(kpts%specialPoints)) THEN
               DEALLOCATE (kpts%specialPoints)
            END IF
            IF (ALLOCATED(kpts%specialPointNames)) THEN
               DEALLOCATE (kpts%specialPointNames)
            END IF
            ALLOCATE (kpts%specialPoints(3,kpts%numSpecialPoints))
            ALLOCATE (kpts%specialPointNames(kpts%numSpecialPoints))
            DO n = 1, kpts%numSpecialPoints
               kpts%specialPointNames(n) = TRIM(ADJUSTL(ssy(n)))
               kpts%specialPoints(:,n) = syp(:,n)
            END DO
         END IF

273 274 275 276 277
         RETURN
 110     WRITE(*,*) "Error reading band_inp file"
          CALL juDFT_error("Bandstr1",calledby="bandstr1")
      ENDIF

278 279 280 281 282 283 284 285 286 287
      IF(kpts%numSpecialPoints.GE.2) THEN
         nosyp = kpts%numSpecialPoints
         ALLOCATE(syp(3,nosyp),ssy(nosyp) )
         DO n = 1, nosyp
            ssy(n) = TRIM(ADJUSTL(kpts%specialPointNames(n)))
            syp(:,n) = kpts%specialPoints(:,n)
         END DO
         RETURN
      END IF

288
      !No band_inp file -> determine default lines for bandstructure
Daniel Wortmann's avatar
Daniel Wortmann committed
289
      !write(*,*) idsyst,idtype
290
      nosyp = -1
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
      IF (.NOT.l_film) THEN
         IF ( (idsyst == 1).AND.(idtype ==  3) ) THEN       ! fcc
            nosyp = 7
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/f12,f12,one/)  ; ssy(1) = "X"
            syp(:,2) = (/f38,f38,f34/)  ; ssy(2) = "K"
            syp(:,3) = (/zro,zro,zro/)  ; ssy(3) = "g"
            syp(:,4) = (/f12,f12,f12/)  ; ssy(4) = "L"
            syp(:,5) = (/f12,f14,f34/)  ; ssy(5) = "W"
            syp(:,6) = (/f12,zro,f12/)  ; ssy(6) = "X"
            syp(:,7) = (/zro,zro,zro/)  ; ssy(7) = "g"
         ENDIF
         IF ( (idsyst == 5).AND.(idtype ==  1) ) THEN       ! rhombohedric (trigonal)
            nosyp = 8
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/f12,f12, f12/)  ; ssy(1) = "Z"
            syp(:,2) = (/zro,zro, zro/)  ; ssy(2) = "g"
            syp(:,3) = (/f14,f14,-f14/)  ; ssy(3) = "K"
            syp(:,4) = (/f12,f12,-f12/)  ; ssy(4) = "Z"
            syp(:,5) = (/f14,f12,-f14/)  ; ssy(5) = "W"
            syp(:,6) = (/zro,f12, zro/)  ; ssy(6) = "L"
            syp(:,7) = (/zro,zro, zro/)  ; ssy(7) = "g"
            syp(:,8) = (/f12,f12, zro/)  ; ssy(8) = "F"
         ENDIF
         IF ( (idsyst == 4).AND.(idtype ==  1) ) THEN       ! hexagonal
            nosyp = 8
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            IF (bmat(1,1)*bmat(2,1)+bmat(1,2)*bmat(2,2) > 0.0) THEN
               syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"
               syp(:,2) = (/zro,f12, zro/)  ; ssy(2) = "M"
               syp(:,3) = (/f13,f13, zro/)  ; ssy(3) = "K"
               syp(:,4) = (/zro,zro, zro/)  ; ssy(4) = "g"
               syp(:,5) = (/zro,zro, f12/)  ; ssy(5) = "A"
               syp(:,6) = (/zro,f12, f12/)  ; ssy(6) = "L"
               syp(:,7) = (/f13,f13, f12/)  ; ssy(7) = "H"
               syp(:,8) = (/zro,zro, f12/)  ; ssy(8) = "A"
            ELSE                                             ! hexagonal (angle = 60)
               syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"
               syp(:,2) = (/f12,f12, zro/)  ; ssy(2) = "M"
               syp(:,3) = (/f13,f23, zro/)  ; ssy(3) = "K"
               syp(:,4) = (/zro,zro, zro/)  ; ssy(4) = "g"
               syp(:,5) = (/zro,zro, f12/)  ; ssy(5) = "A"
               syp(:,6) = (/f12,f12, f12/)  ; ssy(6) = "L"
               syp(:,7) = (/f13,f23, f12/)  ; ssy(7) = "H"
               syp(:,8) = (/zro,zro, f12/)  ; ssy(8) = "A"
            ENDIF
         ENDIF
         IF ( (idsyst == 1).AND.(idtype ==  1) ) THEN       ! simple cubic
            nosyp = 8
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/f12,f12, zro/)  ; ssy(1) = "M"
            syp(:,2) = (/zro,zro, zro/)  ; ssy(2) = "g"
            syp(:,3) = (/f12,zro, zro/)  ; ssy(3) = "X"
            syp(:,4) = (/f12,f12, zro/)  ; ssy(4) = "M"
            syp(:,5) = (/f12,f12, f12/)  ; ssy(5) = "R"
            syp(:,6) = (/f12,zro, zro/)  ; ssy(6) = "X"
            syp(:,7) = (/zro,zro, zro/)  ; ssy(7) = "g"
            syp(:,8) = (/f12,f12, f12/)  ; ssy(8) = "R"
         ENDIF
         IF ( (idsyst == 1).AND.(idtype ==  2) ) THEN       ! body centered cubic
            nosyp = 6
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"
            syp(:,2) = (/f12,-f12,f12/)  ; ssy(2) = "H"
            syp(:,3) = (/zro,zro, f12/)  ; ssy(3) = "N"
            syp(:,4) = (/f14,f14, f14/)  ; ssy(4) = "P"
            syp(:,5) = (/zro,zro, zro/)  ; ssy(5) = "g"
            syp(:,6) = (/zro,zro, f12/)  ; ssy(6) = "N"
         ENDIF
         IF ( (idsyst == 2).AND.(idtype ==  2) ) THEN       ! body centered tetragonal (a > c)
            nosyp = 8
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/f12,f12,-f12/)  ; ssy(1) = "Z"    ! via Lambda and V
            syp(:,2) = (/zro,zro, zro/)  ; ssy(2) = "g"    ! via Sigma
            syp(:,3) = (/-f12,f12,f12/)  ; ssy(3) = "Z"    ! via Y
            syp(:,4) = (/zro,zro, f12/)  ; ssy(4) = "X"    ! via Delta
            syp(:,5) = (/zro,zro, zro/)  ; ssy(5) = "g"    
            syp(:,6) = (/zro,f12, zro/)  ; ssy(6) = "N"    ! via Q
            syp(:,7) = (/f14,f14, f14/)  ; ssy(7) = "P"    ! via W
            syp(:,8) = (/zro,zro, f12/)  ; ssy(8) = "X"
         ENDIF
         IF ( (idsyst == 2).AND.(idtype ==  2) ) THEN       ! body centered tetragonal (a < c)
            nosyp = 9
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/-f12,f12,f12/)  ; ssy(1) = "Z"    ! via F and Sigma
            syp(:,2) = (/zro,zro, zro/)  ; ssy(2) = "g"    ! via Delta
            syp(:,3) = (/zro,zro, f12/)  ; ssy(3) = "X"    ! via W
            syp(:,4) = (/f14,f14, f14/)  ; ssy(4) = "P"    ! via Q
            syp(:,5) = (/zro,f12, zro/)  ; ssy(5) = "N"     
            syp(:,6) = (/zro,zro, zro/)  ; ssy(6) = "g"    ! via Lambda
            syp(:,7) = (/f12,f12,-f12/)  ; ssy(7) = "Z"    ! via U and Y
            syp(:,8) = (/f12,f12, zro/)  ; ssy(8) = "X"
            syp(:,9) = (/f14,f14, f14/)  ; ssy(9) = "P"
         ENDIF
         IF ( (idsyst == 2).AND.(idtype ==  1) ) THEN       ! primitive tetragonal (a < c)
            nosyp = 8
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"    ! via Delta
            syp(:,2) = (/f12,zro, zro/)  ; ssy(2) = "X"    ! via Y
            syp(:,3) = (/f12,f12, zro/)  ; ssy(3) = "M"    ! via Sigma
            syp(:,4) = (/zro,zro, zro/)  ; ssy(4) = "g"    ! via Lambda
            syp(:,5) = (/zro,zro, f12/)  ; ssy(5) = "Z"    ! via U
            syp(:,6) = (/f12,zro, f12/)  ; ssy(6) = "R"    ! via T
            syp(:,7) = (/f12,f12, f12/)  ; ssy(7) = "A"    ! via S
            syp(:,8) = (/zro,zro, f12/)  ; ssy(8) = "Z"
         ENDIF
         IF ( (idsyst == 3).AND.(idtype ==  1) ) THEN       ! primitive tetragonal (a < c)
            nosyp = 10
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"    ! via Sigma
            syp(:,2) = (/f12,zro, zro/)  ; ssy(2) = "X"    ! via D
            syp(:,3) = (/f12,f12, zro/)  ; ssy(3) = "S"    ! via C
            syp(:,4) = (/zro,f12, zro/)  ; ssy(4) = "Y"    ! via Delta
            syp(:,5) = (/zro,zro, zro/)  ; ssy(5) = "g"    ! via Lambda
            syp(:,6) = (/zro,zro, f12/)  ; ssy(6) = "Z"    ! via A
            syp(:,7) = (/f12,zro, f12/)  ; ssy(7) = "U"    ! via P
            syp(:,8) = (/f12,f12, f12/)  ; ssy(8) = "R"    ! via E
            syp(:,9) = (/zro,f12, f12/)  ; ssy(8) = "T"    ! via B
            syp(:,10)= (/zro,zro, f12/)  ; ssy(8) = "Z"
         ENDIF
      ELSE
         WRITE(*,*) 'Note:'
         WRITE(*,*) 'Default k point paths for film band structures'
         WRITE(*,*) 'are experimental. If the generated k point path'
         WRITE(*,*) 'is not correct please specify it directly.'
         IF ( (idsyst == 5).AND.(idtype ==  1) ) THEN       ! rhombohedric (trigonal)
            nosyp = 3
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,6) = (/zro,f12, zro/)  ; ssy(6) = "L"
            syp(:,7) = (/zro,zro, zro/)  ; ssy(7) = "g"
            syp(:,8) = (/f12,f12, zro/)  ; ssy(8) = "F"
         ENDIF
         IF ( (idsyst == 4).AND.(idtype ==  1) ) THEN       ! hexagonal
            nosyp = 4
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            IF (bmat(1,1)*bmat(2,1)+bmat(1,2)*bmat(2,2) > 0.0) THEN
               syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"
               syp(:,2) = (/zro,f12, zro/)  ; ssy(2) = "M"
               syp(:,3) = (/f13,f13, zro/)  ; ssy(3) = "K"
               syp(:,4) = (/zro,zro, zro/)  ; ssy(4) = "g"

            ELSE                                             ! hexagonal (angle = 60)
               syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"
               syp(:,2) = (/f12,f12, zro/)  ; ssy(2) = "M"
               syp(:,3) = (/f13,f23, zro/)  ; ssy(3) = "K"
               syp(:,4) = (/zro,zro, zro/)  ; ssy(4) = "g"
            ENDIF
         ENDIF
         IF ( (idsyst == 1).AND.(idtype ==  1) ) THEN       ! simple cubic
            nosyp = 4
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/f12,f12, zro/)  ; ssy(1) = "M"
            syp(:,2) = (/zro,zro, zro/)  ; ssy(2) = "g"
            syp(:,3) = (/f12,zro, zro/)  ; ssy(3) = "X"
            syp(:,4) = (/f12,f12, zro/)  ; ssy(4) = "M"
         ENDIF
         IF ( (idsyst == 2).AND.(idtype ==  1) ) THEN       ! primitive tetragonal (a < c)
            nosyp = 4
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"    ! via Delta
            syp(:,2) = (/f12,zro, zro/)  ; ssy(2) = "X"    ! via Y
            syp(:,3) = (/f12,f12, zro/)  ; ssy(3) = "M"    ! via Sigma
            syp(:,4) = (/zro,zro, zro/)  ; ssy(4) = "g"    ! via Lambda
         ENDIF
         IF ( (idsyst == 3).AND.(idtype ==  1) ) THEN       ! primitive tetragonal (a < c)
            nosyp = 5
            ALLOCATE ( syp(3,nosyp),ssy(nosyp) )
            syp(:,1) = (/zro,zro, zro/)  ; ssy(1) = "g"    ! via Sigma
            syp(:,2) = (/f12,zro, zro/)  ; ssy(2) = "X"    ! via D
            syp(:,3) = (/f12,f12, zro/)  ; ssy(3) = "S"    ! via C
            syp(:,4) = (/zro,f12, zro/)  ; ssy(4) = "Y"    ! via Delta
            syp(:,5) = (/zro,zro, zro/)  ; ssy(5) = "g"    ! via Lambda
         ENDIF
      END IF
465

466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
      IF(nosyp.GE.2) THEN
         kpts%numSpecialPoints = nosyp
         IF (ALLOCATED(kpts%specialPoints)) THEN
            DEALLOCATE (kpts%specialPoints)
         END IF
         IF (ALLOCATED(kpts%specialPointNames)) THEN
            DEALLOCATE (kpts%specialPointNames)
         END IF
         ALLOCATE (kpts%specialPoints(3,kpts%numSpecialPoints))
         ALLOCATE (kpts%specialPointNames(kpts%numSpecialPoints))
         DO n = 1, kpts%numSpecialPoints
            kpts%specialPointNames(n) = TRIM(ADJUSTL(ssy(n)))
            kpts%specialPoints(:,n) = syp(:,n)
         END DO
      END IF

482 483 484 485 486 487 488 489
      IF (nosyp == -1) THEN
         WRITE(*,*) 'l_film = ', l_film
         WRITE(*,*) 'idsyst = ', idsyst
         WRITE(*,*) 'idtype = ', idtype
         CALL juDFT_error
     +   ("band structure path for lattice not implemented",
     +   calledby ="bandstr1")
      END IF
490 491 492 493

      END SUBROUTINE get_points
!----------------------------------------------------------------------
      END MODULE m_bandstr1