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

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       8             : ! gen_bz generates the (whole) Brillouin zone from the          !
       9             : ! (irreducible) k-points given in the kpts file.                !
      10             : !                                                               !
      11             : !                                     M.Betzinger (09/07)       !
      12             : !                                                               !
      13             : !                        Refactored in 2017 by G.M.             !
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : 
      16             :  
      17             : MODULE m_gen_bz
      18             : 
      19             : CONTAINS
      20             : 
      21           0 : SUBROUTINE gen_bz( kpts,sym)
      22             : 
      23             :    !     bk     ::    irreducible k-points
      24             :    !     nkpt   ::    number of irr. k-points
      25             :    !     bkf    ::    all k-points
      26             :    !     nkptf  ::    number of all k-points
      27             :    !     bkp    ::    k-point parent
      28             :    !     bksym  ::    symmetry operation, that connects the parent
      29             :    !                  k-point with the current one
      30             : 
      31             :    USE m_juDFT
      32             :    USE m_util, ONLY: modulo1
      33             :    USE m_types
      34             :    USE m_closure
      35             : 
      36             :    IMPLICIT NONE
      37             : 
      38             :    TYPE(t_kpts),INTENT(INOUT) :: kpts
      39             :    TYPE(t_sym),INTENT(IN)     :: sym
      40             : 
      41             : !  - local scalars -
      42             :    INTEGER                 ::  ic,iop,ikpt,ikpt1
      43             :    LOGICAL                 ::  l_found
      44             :       
      45             : !  - local arrays - 
      46           0 :    INTEGER,ALLOCATABLE     ::  iarr(:)
      47           0 :    REAL                    ::  rrot(3,3,2*sym%nop),rotkpt(3)
      48           0 :    REAL,ALLOCATABLE        ::  rarr1(:,:)
      49             : 
      50             :    INTEGER:: nsym,ID_mat(3,3)
      51             : 
      52             :    !As we might be early in init process, the inverse operation might not be available in sym. Hence
      53             :    !we calculate it here
      54           0 :    INTEGER                 :: inv_op(sym%nop),optype(sym%nop)
      55           0 :    INTEGER                 :: multtab(sym%nop,sym%nop)
      56             : 
      57           0 :    CALL check_close(sym%nop,sym%mrot,sym%tau,multtab,inv_op,optype)
      58             :    
      59           0 :    nsym=sym%nop
      60           0 :    if (.not.sym%invs) nsym=2*sym%nop
      61             : 
      62           0 :    IF (ANY(kpts%nkpt3==0)) THEN
      63           0 :       CALL judft_warn("Generating kpoints in full BZ failed. You have to specify nx,ny,nz in the kpoint-grid section of inp.xml")
      64             :       RETURN ! you skipped the error, so you get what you deserve...
      65             :    END IF
      66           0 :    ALLOCATE (kpts%bkf(3,nsym*kpts%nkpt))
      67           0 :    ALLOCATE (kpts%bkp(nsym*kpts%nkpt))
      68           0 :    ALLOCATE (kpts%bksym(nsym*kpts%nkpt))
      69             :       
      70             :    ! Generate symmetry operations in reciprocal space
      71           0 :    DO iop=1,nsym
      72           0 :       IF( iop .le. sym%nop ) THEN
      73           0 :          rrot(:,:,iop) = TRANSPOSE( sym%mrot(:,:,inv_op(iop)) )
      74             :       ELSE
      75           0 :          rrot(:,:,iop) = -rrot(:,:,iop-sym%nop)
      76             :       END IF
      77             :    END DO
      78             : 
      79             :     
      80             :    !Add existing vectors to list of full vectors
      81           0 :    id_mat=0
      82           0 :    ID_mat(1,1)=1;ID_mat(2,2)=1;ID_mat(3,3)=1
      83           0 :    IF (ANY(sym%mrot(:,:,1).NE.ID_mat)) CALL judft_error("Identity must be first symmetry operation",calledby="gen_bz")
      84             :    
      85             :    ic=0
      86           0 :    DO iop=1,nsym
      87           0 :       DO ikpt=1,kpts%nkpt
      88           0 :          l_found = .FALSE.
      89           0 :          rotkpt = MATMUL(rrot(:,:,iop), kpts%bk(:,ikpt))
      90             :          !transform back into IBZ
      91           0 :          rotkpt = modulo1(rotkpt,kpts%nkpt3)
      92           0 :          DO ikpt1=1,ic
      93           0 :             IF (MAXVAL(ABS(kpts%bkf(:,ikpt1) - rotkpt)).LE.1e-08) THEN
      94             :                l_found = .TRUE.
      95             :                EXIT
      96             :             END IF
      97             :          END DO
      98             :           
      99           0 :          IF(.NOT.l_found) THEN
     100           0 :             ic = ic + 1
     101           0 :             kpts%bkf(:,ic) = rotkpt
     102           0 :             kpts%bkp(ic) = ikpt
     103           0 :             kpts%bksym(ic) = iop
     104             :          END IF
     105             :       END DO
     106             :    END DO
     107             : 
     108           0 :    kpts%nkptf = ic
     109             : 
     110             :    ! Reallocate bkf, bkp, bksym
     111           0 :    ALLOCATE (iarr(kpts%nkptf))
     112           0 :    iarr = kpts%bkp(:kpts%nkptf)
     113           0 :    DEALLOCATE(kpts%bkp)
     114           0 :    ALLOCATE (kpts%bkp(kpts%nkptf))
     115           0 :    kpts%bkp = iarr
     116           0 :    iarr= kpts%bksym(:kpts%nkptf)
     117           0 :    DEALLOCATE (kpts%bksym )
     118           0 :    ALLOCATE (kpts%bksym(kpts%nkptf))
     119           0 :    kpts%bksym = iarr
     120           0 :    DEALLOCATE(iarr)
     121           0 :    ALLOCATE (rarr1(3,kpts%nkptf))
     122           0 :    rarr1 = kpts%bkf(:,:kpts%nkptf)
     123           0 :    DEALLOCATE (kpts%bkf )
     124           0 :    ALLOCATE (kpts%bkf(3,kpts%nkptf))
     125           0 :    kpts%bkf = rarr1
     126           0 :    DEALLOCATE(rarr1)
     127             :       
     128             : END SUBROUTINE gen_bz
     129             : 
     130             : END MODULE m_gen_bz

Generated by: LCOV version 1.13