LCOV - code coverage report
Current view: top level - kpoints - gkptwgt.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 45 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.0 %

          Line data    Source code
       1             :       MODULE m_gkptwgt
       2             :       CONTAINS
       3           0 :         SUBROUTINE gkptwgt(&
       4             :              &                   kpts,cell)
       5             :           !                                                             
       6             :           !     this subroutine generates the weight factor of a k-point 
       7             :           !     in the irreducible wedge of a 2d-brillouin zone         
       8             :           !     ver are vertex coordinates in counter clockwise order and 
       9             :           !     in units of pi/a(1) and pi/a(2)                              
      10             :           !     it is assumed that each k-point has the same 'area'. D.S.Wang     
      11             :           !     
      12             :           !     changed by                        Stefan Bl"ugel, IFF, Jan.96
      13             :           !                                                           
      14             :           USE m_constants
      15             :           USE m_types
      16             :           USE m_juDFT
      17             :           IMPLICIT NONE
      18             :           TYPE(t_cell),INTENT(IN)   :: cell
      19             :           TYPE(t_kpts),INTENT(INOUT):: kpts
      20             : 
      21             :           !                                                        
      22             :           !     .. was an Argument
      23             :           REAL    :: wt
      24             :           !     ..
      25             :           !     .. Array Arguments ..
      26             :           !     ..
      27             :           !     .. Local Scalars ..
      28             :           REAL cross,dot,eps,x1,x2,y1,y2
      29             :           REAL s1,s2
      30             :           INTEGER i,j,ikpt,nver
      31             :           !     ..
      32             :           !     .. Local Arrays ..
      33           0 :           REAL ver(2,4),dummy(2,kpts%nkpt)
      34             :           !     ..
      35             :           !     .. Intrinsic Functions ..
      36             :           INTRINSIC abs,atan2
      37             :           !     ..
      38             :           !     .. Data Statements ..
      39             :           DATA ver/0.e0,0.e0,1.e0,0.e0,1.e0,1.e0,0.e0,1.e0/
      40             :           DATA eps/1.e-6/
      41             :           !     ..
      42             : 
      43             :           !      nver = 3
      44           0 :           IF ( cell%latnam.EQ.'squ' ) THEN
      45             :              nver = 3
      46           0 :           ELSEIF ( cell%latnam.EQ.'p-r' .OR. cell%latnam.EQ.'c-r' ) THEN
      47             :              nver = 4
      48           0 :           ELSEIF ( cell%latnam.EQ.'hex' ) THEN
      49           0 :              nver = 3
      50           0 :              ver(2,3) = 1./3.
      51           0 :           ELSEIF ( cell%latnam.EQ.'hx3' .OR. cell%latnam.EQ. 'obl' ) THEN
      52             :              CALL juDFT_error("weights for hx3 or obl not defined" ,calledby&
      53           0 :                   &        ="gkptwgt")
      54             :           ENDIF
      55             :           !                                                          
      56             :           !     transform from internal coordinates to xy-coordinates
      57             :           !
      58             :           !                            changed by shz Feb.96
      59           0 :           DO 10 ikpt = 1 , kpts%nkpt
      60           0 :              kpts%wtkpt(ikpt) = 0
      61           0 :              dummy(1,ikpt)=kpts%bk(1,ikpt)
      62           0 :              dummy(2,ikpt)=kpts%bk(2,ikpt)
      63           0 :              s1 = 0.0
      64           0 :              s2 = 0.0
      65           0 :              DO i = 1,2 
      66           0 :                 s1 = s1+cell%bmat(i,1)*kpts%bk(i,ikpt)
      67           0 :                 s2 = s2+cell%bmat(i,2)*kpts%bk(i,ikpt)
      68             :              ENDDO
      69           0 :              IF (cell%latnam.EQ.'hex') THEN
      70           0 :                 kpts%bk(1,ikpt) = s1*cell%amat(2,2)/tpi_const
      71           0 :                 kpts%bk(2,ikpt) = s2*cell%amat(1,1)/pi_const
      72             :              ELSE
      73           0 :                 kpts%bk(1,ikpt) = s1*cell%amat(1,1)/pi_const
      74           0 :                 kpts%bk(2,ikpt) = s2*cell%amat(2,2)/pi_const
      75             :              ENDIF
      76           0 : 10        ENDDO
      77             : 
      78           0 :           DO 20 ikpt = 1 , kpts%nkpt
      79           0 :              DO 30 i = 1,nver
      80           0 :                 x1 = ( ver(1,i)-kpts%bk(1,ikpt) ) / cell%amat(1,1)
      81           0 :                 y1 = ( ver(2,i)-kpts%bk(2,ikpt) ) / cell%amat(2,2)
      82           0 :                 j  = i + 1
      83           0 :                 IF ( j.GT.nver ) j = 1
      84           0 :                 x2 = ( ver(1,j)-kpts%bk(1,ikpt) ) / cell%amat(1,1)
      85           0 :                 y2 = ( ver(2,j)-kpts%bk(2,ikpt) ) / cell%amat(2,2)
      86           0 :                 dot = x1*x2 + y1*y2
      87           0 :                 cross = x1*y2 - y1*x2
      88           0 :                 IF ( ABS(cross).GE.eps ) THEN
      89           0 :                    kpts%wtkpt(ikpt) = kpts%wtkpt(ikpt) + ATAN2(cross,dot)
      90             :                 ENDIF
      91           0 : 30           ENDDO
      92           0 : 20        ENDDO
      93             :           !
      94           0 :           DO ikpt = 1 , kpts%nkpt
      95           0 :              kpts%wtkpt(ikpt) = kpts%wtkpt(ikpt) /tpi_const
      96             :           ENDDO
      97             :           !   
      98             :           wt = 0.0
      99           0 :           DO ikpt = 1,kpts%nkpt
     100           0 :              wt = wt + kpts%wtkpt(ikpt)
     101           0 :              kpts%bk(1,ikpt)=dummy(1,ikpt)
     102           0 :              kpts%bk(2,ikpt)=dummy(2,ikpt)
     103             :           ENDDO
     104             : 
     105           0 :           RETURN
     106             :         END SUBROUTINE gkptwgt
     107             :       END

Generated by: LCOV version 1.13