wann_maxbnd.F 2.83 KB
Newer Older
1
      MODULE m_wann_maxbnd
2

3 4 5 6 7
c****************************************************************
c    determine maximum of number of bands
c****************************************************************
      CONTAINS
      SUBROUTINE wann_maxbnd(
8
     >              eig_id,l_real,
9 10
     >              lmaxd,ntypd,nlod,neigd,nvd,jspd,
     >              isize,jspin,nbasfcn,nlotot,
11
     >              l_ss,l_noco,nrec,fullnkpts,
12 13 14 15 16
     >              l_bzsym,l_byindex,l_bynumber,l_byenergy,
     >              irreduc,odi,band_min,band_max,numbands,
     >              e1s,e2s,ef,nkpt,nbnd,l_gwf,iqpt)

      use m_cdnread, only:cdn_read
17
      use m_types
18 19 20
      use m_wann_rw_eig

      IMPLICIT NONE
21
      integer,intent(in) :: lmaxd,ntypd,nlod,neigd,nvd,jspd,eig_id
22
      integer,intent(in) :: isize,jspin,nbasfcn,nlotot,iqpt
23
      logical,intent(in) :: l_ss,l_noco,l_gwf,l_real
24
      integer,intent(in) :: nrec,fullnkpts
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
      logical,intent(in) :: l_byindex,l_bynumber,l_byenergy
      integer,intent(in) :: irreduc(fullnkpts)
      type (od_inp),intent(in) :: odi
      integer,intent(in) :: band_min,band_max,numbands
      logical,intent(in) :: l_bzsym
      real,intent(in)    :: e1s,e2s,ef
      integer,intent(in) :: nkpt

      integer,intent(out):: nbnd

      integer          :: ikpt,kptibz
      integer          :: nmat,nbands,nv(jspd)
      real             :: wk, bkpt(3),eig(neigd),cp_time(9)
      integer          :: k1(nvd,jspd),k2(nvd,jspd),k3(nvd,jspd)
      integer          :: nkbnd,i
      REAL             :: ello(nlod,ntypd,jspd),evdu(2,jspd)
      REAL             :: epar(0:lmaxd,ntypd,jspd)
      integer          :: n_start,n_end,co
      integer          :: num_bands
44

45
      TYPE(t_mat)      :: zMat
46

47
      zMat%l_real = l_real
48 49
      zMat%matsize1 = nbasfcn
      zMat%matsize2 = neigd
50
      IF(l_real) THEN
51
         ALLOCATE (zMat%data_r(zMat%matsize1,zMat%matsize2))
52
      ELSE
53
         ALLOCATE (zMat%data_c(zMat%matsize1,zMat%matsize2))
54 55
      END IF

56 57 58 59 60 61 62 63
      n_start=1
      n_end=neigd

      nbnd=0
      do ikpt = 1,fullnkpts

        kptibz=ikpt 
        if(l_bzsym) kptibz=irreduc(ikpt)
64 65
            call wann_read_eig(
     >              eig_id,
66 67
     >              lmaxd,ntypd,nlod,neigd,nvd,jspd,
     >              0,isize,kptibz,jspin,nbasfcn,nlotot,
68
     >              l_ss,l_noco,nrec,
69
     <              nmat,nv,ello,evdu,epar,
70
     <              k1,k2,k3,bkpt,wk,nbands,eig,zMat,
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
     >              l_gwf,iqpt)

        nkbnd = 0
        do i = 1,nbands
         if((eig(i).ge.e1s .and. nkbnd.lt.numbands.and.l_bynumber).or.
     &      (eig(i).ge.e1s.and.eig(i).le.e2s.and.l_byenergy ).or.
     &      (i.ge.band_min.and.i.le.band_max.and.l_byindex))  then
           nkbnd = nkbnd + 1
         endif 
        enddo
        if (nkbnd.ge.nbnd) nbnd = nkbnd

      enddo !ikpt

      end subroutine wann_maxbnd
      END MODULE m_wann_maxbnd