w90kpunktgen.f 3.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
c************************************************
c     generate equidistant k-point mesh as needed
c     for wannier functions
c     Frank Freimuth, September 2006
c************************************************
      program kpunktgen
      implicit none
      integer num,numkpt,dim
      integer c1,c2,c3,limit
      real ilen,shift
      real i1,i2,i3
      logical l_shift


      print*,"specify dimension"
      read(*,*)dim
      print*,"symmetric to origin?"
      read(*,*)l_shift
      if(dim==3)then
      print*,"create three dimensional k-point set"   
      print*,"Divisions per direction"
      read(*,*)num
      print*,"Divisions per direction: ",num
      numkpt=num**3
      print*,"Number of k-points: ",numkpt
      ilen=1.0/num
      print*,"length of intervals: ",ilen
c      open(100,file='kpts',form='formatted',status='unknown')
      open(200,file='w90kpts',form='formatted',status='unknown')
c      write(100,'(2x,i3,8x,f7.5)')numkpt,1.0
      write(200,*)numkpt
      limit=num-1
      if (l_shift) then
         shift=limit*ilen/2.0        
      endif

      do c1=0,limit
         do c2=0,limit
            do c3=0,limit
               i1=ilen*c1-shift
               i2=ilen*c2-shift
               i3=ilen*c3-shift
c               write(100,'(3x,f7.5,3x,f7.5,3x,f7.5,3x,f7.5)')i1,i2,i3,1.00000
c               write(200,'(3x,f7.5,3x,f7.5,3x,f7.5)')i1,i2,i3
               write(200,*)i1,i2,i3
            enddo
         enddo
      enddo
      close(100)
      close(200)

      elseif(dim==2)then
      print*,"create two dimensional k-point set"
         print*,"Divisions per direction"
      read(*,*)num
      print*,"Divisions per direction: ",num
      numkpt=num**2
      print*,"Number of k-points: ",numkpt
      ilen=1.0/num
      print*,"Length of intervals: ",ilen
c      open(100,file='kpts',form='formatted',status='unknown')
      open(200,file='w90kpts',form='formatted',status='unknown')
c      write(100,'(2x,i3,8x,f7.5,8x,1a)')numkpt,1.0,"F"
      write(200,*)numkpt
      limit=num-1
      if(l_shift)then
         shift=limit*ilen/2.0
      endif   
      do c1=0,limit
         do c2=0,limit
               i1=ilen*c1-shift
               i2=ilen*c2-shift
c               write(100,'(3x,f7.5,3x,f7.5,3x,f7.5)')i1,i2,1.00000
c               write(200,'(3x,f7.5,3x,f7.5,3x,f6.5)')i1,i2,0.00000
               write(200,*)i1,i2,0.00000
         enddo
      enddo
      close(100)
      close(200)


      elseif(dim==1)then
      print*,"create one dimensional k-point set"   
      print*,"Divisions per direction"
      read(*,*)num
      print*,"Divisions per direction: ",num
      numkpt=num
      print*,"Number of k-points: ",numkpt
      ilen=1.0/num
      print*,"length of intervals: ",ilen
c      open(100,file='kpts',form='formatted',status='unknown')
      open(200,file='w90kpts',form='formatted',status='unknown')
c      write(100,'(2x,i3,8x,f7.5)')numkpt,1.0
      write(200,*)numkpt
      limit=num-1
      if (l_shift) then
         shift=limit*ilen/2.0        
      endif

      do c1=0,limit

               i1=ilen*c1-shift
 
c               write(100,'(3x,f7.5,3x,f7.5,3x,f7.5,3x,f7.5)')i1,i2,i3,1.00000
c               write(200,'(3x,f7.5,3x,f7.5,3x,f7.5)')i1,0.0000,0.00000
               write(200,*)i1,0.0000,0.00000

      enddo
      close(100)
      close(200)



      endif
      end program kpunktgen