LCOV - code coverage report
Current view: top level - wannier/uhu - wann_uHu_symcheck.F (source / functions) Hit Total Coverage
Test: FLEUR test coverage Lines: 0 35 0.0 %
Date: 2024-04-24 04:44:14 Functions: 0 1 0.0 %

          Line data    Source code
       1             : c*********************************************c
       2             : c    Check whether uHu matrix is Hermitian    c
       3             : c*********************************************c
       4             : c                    J.-P. Hanke, Dec. 2015   c
       5             : c*********************************************c
       6             :       module m_wann_uHu_symcheck
       7             :       contains
       8           0 :       subroutine wann_uHu_symcheck(uHu,nbnd,nntot,nntot2,fullnkpts)
       9             : 
      10             :       implicit none 
      11             :       integer,intent(in) :: nbnd,nntot,nntot2,fullnkpts
      12             :       complex,intent(in) :: uHu(nbnd,nbnd,nntot2,nntot,fullnkpts)
      13             : 
      14             :       logical :: l_check,l_fdiag,l_foffd
      15             :       integer :: i,j,ikpt,ikpt_b,ikpt_b2
      16             :       integer :: maxi,maxj,maxb1,maxb2,maxk
      17             :       real :: eps,diff,maxdiff
      18             : 
      19           0 :       eps = 1.e-10
      20           0 :       l_check = .true.
      21           0 :       l_fdiag = .false.
      22           0 :       l_foffd = .false.
      23           0 :       maxdiff = 0.0
      24             : 
      25           0 :       open(999,file='out_symcheck')
      26             : 
      27           0 :       do ikpt=1,fullnkpts
      28           0 :          do ikpt_b=1,nntot
      29           0 :             do ikpt_b2=1,nntot2
      30           0 :                do i=1,nbnd
      31           0 :                   do j=1,i
      32             :                      diff= abs(uHu(j,i,ikpt_b2,ikpt_b,ikpt)
      33           0 :      >                   -conjg(uHu(i,j,ikpt_b,ikpt_b2,ikpt)))
      34           0 :                      if(diff.gt.eps) then
      35           0 :                       write(999,'(5i7)')j,i,ikpt_b2,ikpt_b,ikpt
      36             :                       write(999,'(4f16.10)')
      37           0 :      >                  uHu(j,i,ikpt_b2,ikpt_b,ikpt),diff,
      38           0 :      >                  diff/abs(uHu(j,i,ikpt_b2,ikpt_b,ikpt))*100.0
      39           0 :                       if(diff.gt.maxdiff) then
      40           0 :                          maxj = j
      41           0 :                          maxi = i
      42           0 :                          maxb2= ikpt_b2
      43           0 :                          maxb1= ikpt_b
      44           0 :                          maxk = ikpt
      45           0 :                          maxdiff=diff
      46             :                       endif
      47           0 :                       l_check = .false.
      48           0 :                       if(i.eq.j .and. ikpt_b.eq.ikpt_b2) then
      49             :                        l_fdiag=.true.
      50             :                       else
      51           0 :                        l_foffd=.true.
      52             :                       endif
      53             :                      endif
      54             :                   enddo
      55             :                enddo
      56             :             enddo
      57             :          enddo
      58             :       enddo
      59           0 :       close(999)
      60             : 
      61           0 :       if(l_check)write(*,*)'*** uHu_symcheck: fine ***'
      62             :       if(.not. l_check) then
      63           0 :          write(*,*)'*** uHu_symcheck: problem ***'
      64           0 :          if(l_fdiag) write(*,*)'              --> fail on diagonal'
      65           0 :          if(l_foffd) write(*,*)'              --> fail on off-diag'
      66           0 :          write(*,*)'              maxdiff:',maxdiff
      67           0 :          write(*,'(a,5(i8,1x))')' index: ',maxj,maxi,maxb2,maxb1,maxk
      68             :       endif
      69             : 
      70           0 :       end subroutine wann_uHu_symcheck
      71             :       end module m_wann_uHu_symcheck

Generated by: LCOV version 1.14