LCOV - code coverage report
Current view: top level - diagonalization - symmetrize_matrix.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 18 18 100.0 %
Date: 2019-09-08 04:53:50 Functions: 1 1 100.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             : MODULE m_symmetrize_matrix
       8             :   USE m_juDFT
       9             : 
      10             : CONTAINS
      11        1188 :   SUBROUTINE symmetrize_matrix(mpi,noco,kpts,nk,hmat,smat)
      12             :     USE m_types
      13             :     IMPLICIT NONE
      14             :     TYPE(t_mpi),INTENT(IN)     :: mpi
      15             :     TYPE(t_noco),INTENT(in)    :: noco
      16             :     TYPE(t_kpts),INTENT(in)    :: kpts
      17             :     INTEGER,INTENT(in)         :: nk
      18             :     CLASS(t_mat),INTENT(inout) :: hmat,smat
      19             : 
      20             :     REAL :: max_imag
      21             :     !Check if we could exploit a real matrix even without inversion symmetry
      22             :     SELECT TYPE(hmat)
      23             :     TYPE IS(t_mat)
      24         304 :        realcomplex:IF (.NOT.noco%l_noco.AND..NOT.hmat%l_real) THEN
      25         152 :           IF (ALL(ABS(kpts%bk(:,nk))<1E-10)) THEN
      26          21 :              max_imag=MAXVAL(ABS(AIMAG(hmat%data_c)))
      27          21 :              IF (max_imag>1e-10) THEN
      28          19 :                 PRINT *,"Real matrix expected but imaginary part is:",max_imag
      29             :                 RETURN
      30             :              ENDIF
      31             :              
      32           2 :              IF (mpi%irank==0) THEN
      33           2 :                 PRINT *,"Complex matrix made real"
      34           2 :                 WRITE(6,*) "Complex matrix made real"
      35             :              END IF
      36             :              
      37             :              !We are using Gamma point, so matrix should be real
      38           2 :              IF (ALLOCATED(smat%data_r)) DEALLOCATE(smat%data_r)
      39           2 :              ALLOCATE(smat%data_r(SIZE(smat%data_c,1),SIZE(smat%data_c,2)))
      40           2 :              smat%data_r=smat%data_c;smat%l_real=.TRUE.
      41           2 :              DEALLOCATE(smat%data_c)
      42             :              
      43           2 :              IF (ALLOCATED(hmat%data_r)) DEALLOCATE(hmat%data_r)
      44           2 :              ALLOCATE(hmat%data_r(SIZE(hmat%data_c,1),SIZE(hmat%data_c,2)))
      45           2 :              hmat%data_r=hmat%data_c;hmat%l_real=.TRUE.
      46           2 :              DEALLOCATE(hmat%data_c)
      47             :              
      48             :           ENDIF
      49             :        ENDIF realcomplex
      50             :     END SELECT
      51             :   END SUBROUTINE symmetrize_matrix
      52        1188 : END MODULE m_symmetrize_matrix

Generated by: LCOV version 1.13