LCOV - code coverage report
Current view: top level - init - inpeig.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 32 49 65.3 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.0 %

          Line data    Source code
       1             :       MODULE m_inpeig
       2             :       CONTAINS
       3          14 :       SUBROUTINE inpeig(&
       4             :      &                  atoms,cell,input,l_is_oneD,kpts,enpara,kptsFilename)
       5             : !*********************************************************************
       6             : !     inputs the necessary quantities for the eigenvalue part (energy
       7             : !     parameters, k-points, wavefunction cutoffs, etc.).
       8             : !                  m. weinert   jan. 1987
       9             : !     modification dec. 1990:
      10             : !     dummyline before reading l-dependent energies to make reading of
      11             : !     input easier (e.g. insert name of atom etc.)
      12             : !     modification dec. 93:
      13             : !     for step-forward diagonalization a la wu in case of more
      14             : !     than 1 window we read now
      15             : !     number of occupied states for EACH window
      16             : !*********************************************************************
      17             :       USE m_gkptwgt
      18             :       USE m_constants
      19             :       USE m_types
      20             :       USE m_juDFT
      21             :      
      22             :       IMPLICIT NONE
      23             : !     ..
      24             :       TYPE(t_atoms),INTENT(IN)     :: atoms
      25             :       TYPE(t_cell),INTENT(IN)      :: cell
      26             :       TYPE(t_input),INTENT(IN)     :: input
      27             :       LOGICAL,INTENT(IN)           :: l_is_oneD
      28             :       TYPE(t_kpts),INTENT(INOUT)   :: kpts
      29             :       TYPE(t_enpara),OPTIONAL,INTENT(INOUT) :: enpara
      30             :       CHARACTER(LEN=*),OPTIONAL,INTENT(IN) :: kptsFilename
      31             : 
      32             : !     ..
      33             : !     .. Local Scalars ..
      34             :       REAL      :: wt,scale
      35             :       INTEGER   :: i,j,nk,jsp,n
      36             :       LOGICAL   :: xyu,l_enpara,l_clf
      37             :       CHARACTER(LEN=255) :: fname
      38             : !     ..
      39             : !
      40             :      
      41             : !---> input energy parameters for each atom.
      42             : !---> the energy parameters for l.ge.3 have the same value
      43             : !---> read from file 40='enpara'  shz Jan.96
      44             : !
      45             : 
      46          14 :       IF(PRESENT(enpara)) THEN
      47          14 :          IF (.NOT.input%l_inpXML) THEN
      48             :             !read enpara file if present!
      49          14 :             CALL enpara%init(atoms,input%jspins)
      50          14 :             CALL enpara%READ(atoms,input%jspins,input%film,.false.)        
      51             :          END IF
      52             :       END IF
      53             : !
      54             : !---> read k-points from file 41='kpts'
      55             : !
      56             : 
      57          14 :       IF(PRESENT(kptsFilename)) THEN
      58           0 :          fname = TRIM(ADJUSTL(kptsFilename))
      59             :       ELSE
      60          14 :          fname = 'kpts'
      61             :       END IF
      62             : 
      63          14 :       OPEN (41,file=TRIM(ADJUSTL(fname)),form='formatted',status='old')
      64             : !
      65             : !---> k-mesh: given in units of the reciprocal lattice basis vectors
      66             : !---> scale is a factor to make input easier (default=1.0). k-pt
      67             : !---> weights can be relative weights since they are renormalized.
      68             : !---> input: for bulk - k1,k2,k3,wtkpt
      69             : !--->        for film - k1,k2,wtkpt
      70             : !--->           weights are calculated for films, if wtkpt=0
      71             : !     for film calculation k1,k2 may also be read in xy - units : xyu=T
      72             : !     1 = boundery of BZ on kx/ky axis
      73             : !                                                  shz Feb.96
      74          27 :          READ (41,FMT=8110,ERR=911,END=911) kpts%nkpt,scale,xyu
      75           1 :          GOTO 912
      76             :   911    CONTINUE
      77          13 :          xyu = .false.
      78             :   912    CONTINUE
      79             :          
      80             :          IF (kpts%nkpt.GT.kpts%nkpt)  THEN
      81             :            CALL juDFT_error('nkptd too small',calledby='inpeig')
      82             :          ENDIF
      83             :  8100    FORMAT (i5,f20.10)
      84             :  8110    FORMAT (i5,f20.10,3x,l1)
      85          14 :          IF (scale.EQ.0.0) scale = 1.0
      86         118 :          DO nk = 1,kpts%nkpt
      87         104 :             READ (41,FMT=8040) (kpts%bk(i,nk),i=1,3),kpts%wtkpt(nk)
      88             :  8040       FORMAT (4f10.5)
      89         104 :             IF (input%film .AND. .NOT.l_is_oneD) THEN
      90           4 :                kpts%wtkpt(nk) = kpts%bk(3,nk)
      91           4 :                kpts%bk(3,nk) = 0.0
      92           4 :                IF (xyu) THEN
      93             : !           transform to cartesian coordinates
      94           0 :                   IF (cell%latnam.EQ.'hex') THEN
      95           0 :                      kpts%bk(1,nk) = kpts%bk(1,nk)*tpi_const/cell%amat(2,2)
      96           0 :                      kpts%bk(2,nk) = kpts%bk(2,nk)*pi_const/cell%amat(1,1)
      97             :                   ELSE
      98           0 :                      kpts%bk(1,nk) = kpts%bk(1,nk)*pi_const/cell%amat(1,1)
      99           0 :                      kpts%bk(2,nk) = kpts%bk(2,nk)*pi_const/cell%amat(2,2)
     100             :                   END IF
     101             : !           transform to internal coordinates
     102           0 :                   kpts%bk(1:2,nk)=matmul(kpts%bk(1:2,nk),cell%amat(1:2,1:2))/tpi_const
     103             :                END IF
     104         100 :             ELSEIF (.NOT.input%film) THEN
     105         100 :               IF (xyu) THEN
     106           0 :                 call juDFT_warn("The xyu feature is not tested",calledby="inpeig")
     107           0 :                 kpts%bk(:,nk) = kpts%bk(:,nk)!*2.0/sc !TODO what is this scaling?
     108           0 :                 kpts%bk(:,nk) = matmul( cell%amat, kpts%bk(:,nk) )
     109             :               ENDIF
     110             :             END IF
     111         728 :             DO  i = 1,3
     112         416 :                kpts%bk(i,nk) = kpts%bk(i,nk)/scale
     113             :             ENDDO
     114             : !-odim
     115         118 :             IF (l_is_oneD) THEN
     116             : !--> trapezoidal
     117           0 :                IF (kpts%bk(3,nk).EQ.0. .OR. kpts%bk(3,nk).EQ.0.5) THEN
     118           0 :                   kpts%wtkpt(nk) = 1.
     119             :                ELSE
     120           0 :                   kpts%wtkpt(nk) = 2.
     121             :                END IF
     122             :             END IF
     123             : !-odim
     124             :          ENDDO
     125          14 :          wt = sum(kpts%wtkpt(:kpts%nkpt))
     126             : 
     127          14 :          IF (wt.EQ.0.0) THEN
     128           0 :             IF (input%film) THEN
     129             : !
     130             : !---> generate k-point weights for 2d BZ: squ, rec, cen, hex
     131             : !     determine new wt
     132             : !
     133             :                CALL gkptwgt(&
     134           0 :      &                      kpts,cell)
     135           0 :                wt=sum(kpts%wtkpt)
     136             :              ELSE
     137             :                CALL juDFT_error("wtkpts",calledby ="inpeig",hint&
     138           0 :      &              ="The sum of weights in the kpts file is zero")
     139             :             END IF
     140             :          END IF
     141          14 :          IF (l_is_oneD)  kpts%bk(1:2,:) = 0.0    
     142          14 :          kpts%wtkpt(:) = kpts%wtkpt(:)/wt
     143             :      
     144          14 :          WRITE (6,FMT=8120)  kpts%nkpt
     145         118 :          DO  nk = 1,kpts%nkpt
     146         118 :             WRITE (6,FMT=8040)  kpts%bk(:,nk),kpts%wtkpt(nk)
     147             :          ENDDO
     148             :  8120    FORMAT (1x,/,' number of k-points for this window =',i5,/,t12,&
     149             :      &          'coordinates',t34,'weights')
     150          14 :       CLOSE (41)
     151             : 
     152          28 :       END SUBROUTINE inpeig
     153             :       END MODULE m_inpeig

Generated by: LCOV version 1.13