LCOV - code coverage report
Current view: top level - eigen - eigen_redist_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_eigen_redist_matrix
       8             : CONTAINS
       9             :   !> Collect Hamiltonian or overlap matrix to final form
      10             :   !!
      11             :   !! In the collinear case, this routine just copies mat(1,1) into the final matrix.
      12             :   !! If the matrices are distributed, the copy includes a redistribution into the block-cylic form needed by
      13             :   !! the diagonalization.
      14             :   !! In the non-collinear case, the 2x2 array of matrices is combined into the final matrix. Again a redistribution will happen in the parallel case
      15             :  
      16             :   
      17        2376 :   SUBROUTINE eigen_redist_matrix(mpi,lapw,atoms,mat,mat_final,mat_final_templ)
      18             :     USE m_types
      19             :     USE m_types_mpimat
      20             :     IMPLICIT NONE
      21             :     TYPE(t_mpi),INTENT(IN)    :: mpi
      22             :     TYPE(t_lapw),INTENT(IN)   :: lapw
      23             :     TYPE(t_atoms),INTENT(IN)  :: atoms
      24             :     CLASS(t_mat),INTENT(INOUT):: mat(:,:)
      25             :     CLASS(t_mat),INTENT(INOUT):: mat_final
      26             :     CLASS(t_mat),INTENT(IN),OPTIONAL :: mat_final_templ
      27             : 
      28             :     INTEGER:: m
      29             : 
      30             :     !determine final matrix size and allocate the final matrix
      31        2376 :     m=lapw%nv(1)+atoms%nlotot
      32        2376 :     IF (SIZE(mat)>1) m=m+lapw%nv(2)+atoms%nlotot
      33        2376 :     IF (.NOT.PRESENT(mat_final_templ)) THEN
      34        1188 :        CALL mat_final%init(mat(1,1)%l_real,m,m,mpi%sub_comm,.TRUE.) !here the .true. creates a block-cyclic scalapack distribution
      35             :     ELSE
      36        1188 :        CALL mat_final%init(mat_final_templ)
      37             :     ENDIF
      38             :     !up-up component (or only component in collinear case)
      39        2376 :     IF (SIZE(mat)==1) THEN
      40        1048 :        CALL mat_final%move(mat(1,1))
      41        1048 :        CALL mat(1,1)%free()
      42        1048 :        RETURN
      43             :     ENDIF
      44             : 
      45        1328 :     CALL mat_final%copy(mat(1,1),1,1)
      46        1328 :     CALL mat(1,1)%free()
      47             :   
      48             :     !down-down component
      49        1328 :     CALL mat_final%copy(mat(2,2),lapw%nv(1)+atoms%nlotot+1,lapw%nv(1)+atoms%nlotot+1)
      50        1328 :     CALL mat(2,2)%free()
      51             : 
      52             :     !Now collect off-diagonal parts
      53        1328 :     CALL mat(1,2)%add_transpose(mat(2,1))
      54        1328 :     CALL mat_final%copy(mat(1,2),1,lapw%nv(1)+atoms%nlotot+1)
      55        1328 :     CALL mat(1,2)%free()
      56        1328 :     CALL mat(2,1)%free()
      57             :     
      58             :   END SUBROUTINE eigen_redist_matrix
      59             : END MODULE m_eigen_redist_matrix
      60             : 
      61             : 

Generated by: LCOV version 1.13