wann_get_qpts.f 2.51 KB
Newer Older
Daniel Wortmann's avatar
Daniel Wortmann committed
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
      module m_wann_get_qpts
      USE m_juDFT
      contains
      subroutine wann_get_qpts(
     >               l_bzsym,film,l_onedimens,l_readqpts,
     <               nqpts,qpoints,param_file)
c********************************************************
c     Read in the q-points from qpts file.
c 
c   
c********************************************************
      implicit none
      logical,intent(in)  :: l_bzsym,film
      logical,intent(in)  :: l_onedimens,l_readqpts
      integer,intent(out) :: nqpts
      real,intent(inout)  :: qpoints(:,:)
      character(len=20),intent(in) :: param_file

      real             :: scale
      !integer          :: at,j
      integer          :: iter!,len,num_wann,num_bands,nn,i
      logical          :: l_file

      if(l_bzsym)then
         inquire(file='w90qpts',exist=l_file)
         IF(.NOT.l_file) CALL juDFT_error("where is w90qpts?",calledby
     +        ="wann_get_qpts")
         open(987,file='w90qpts',status='old',form='formatted')
         read(987,*)nqpts, scale
         write(6,*)"wann_get_qpts: nqpts=",nqpts
         if(l_readqpts)then
            IF(SIZE(qpoints,1)/=3) CALL juDFT_error("wann_get_qpts: 1"
     +           ,calledby ="wann_get_qpts")
            IF(SIZE(qpoints,2)/=nqpts) 
     +         CALL juDFT_error("wann_get_qpts: 2",
     +                          calledby ="wann_get_qpts")
            do iter=1,nqpts
               read(987,*)qpoints(:,iter)
            enddo
         endif   
      else
         inquire(file=param_file,exist=l_file)
         IF(.NOT.l_file) CALL juDFT_error(
     >         "where is "//trim(param_file)//"?",calledby
     +        ="wann_get_qpts")
         open(987,file=param_file,status='old',form='formatted')
         read(987,*)nqpts,scale
         write(6,*)"wann_get_qpts: nqpts=",nqpts
         if(l_readqpts)then
            IF(SIZE(qpoints,1)/=3) CALL juDFT_error("wann_get_qpts: 1"
     +           ,calledby ="wann_get_qpts")
            IF(SIZE(qpoints,2)/=nqpts) 
     +         CALL juDFT_error("wann_get_qpts: 2",
     +                          calledby ="wann_get_qpts")
            do iter=1,nqpts
               read(987,*)qpoints(:,iter)
            enddo
         endif   
      endif

      close(987)

      if(l_readqpts)then
         qpoints=qpoints/scale !* 2.0 !2xBZ
         if(film.and..not.l_onedimens)then 
            qpoints(3,:)=0.0
         endif   
         do iter=1,nqpts
            write(6,*)qpoints(:,iter)
         enddo
      endif

      end subroutine wann_get_qpts
      end module m_wann_get_qpts