eigen_redist_matrix.f90 2.25 KB
 Daniel Wortmann committed Feb 26, 2018 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ``````!-------------------------------------------------------------------------------- ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany ! This file is part of FLEUR and available as free software under the conditions ! of the MIT license as expressed in the LICENSE file in more detail. !-------------------------------------------------------------------------------- MODULE m_eigen_redist_matrix CONTAINS !> Collect Hamiltonian or overlap matrix to final form !! !! In the collinear case, this routine just copies mat(1,1) into the final matrix. !! If the matrices are distributed, the copy includes a redistribution into the block-cylic form needed by !! the diagonalization. !! 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 `````` 17 `````` SUBROUTINE eigen_redist_matrix(mpi,lapw,atoms,mat,mat_final,mat_final_templ) `````` Daniel Wortmann committed Feb 26, 2018 18 19 20 21 22 23 24 25 `````` USE m_types USE m_types_mpimat IMPLICIT NONE TYPE(t_mpi),INTENT(IN) :: mpi TYPE(t_lapw),INTENT(IN) :: lapw TYPE(t_atoms),INTENT(IN) :: atoms CLASS(t_mat),INTENT(INOUT):: mat(:,:) CLASS(t_mat),INTENT(INOUT):: mat_final `````` 26 `````` CLASS(t_mat),INTENT(IN),OPTIONAL :: mat_final_templ `````` Daniel Wortmann committed Feb 26, 2018 27 28 29 30 31 32 `````` INTEGER:: m !determine final matrix size and allocate the final matrix m=lapw%nv(1)+atoms%nlotot IF (SIZE(mat)>1) m=m+lapw%nv(2)+atoms%nlotot `````` 33 34 35 36 37 `````` IF (.NOT.PRESENT(mat_final_templ)) THEN CALL mat_final%init(mat(1,1)%l_real,m,m,mpi%sub_comm,.TRUE.) !here the .true. creates a block-cyclic scalapack distribution ELSE CALL mat_final%init(mat_final_templ) ENDIF `````` Daniel Wortmann committed Feb 26, 2018 38 `````` !up-up component (or only component in collinear case) `````` Daniel Wortmann committed Jul 04, 2018 39 40 `````` IF (SIZE(mat)==1) THEN CALL mat_final%move(mat(1,1)) `````` Daniel Wortmann committed Oct 29, 2018 41 `````` CALL mat(1,1)%free() `````` Daniel Wortmann committed Jul 04, 2018 42 43 44 `````` RETURN ENDIF `````` Daniel Wortmann committed Feb 26, 2018 45 `````` CALL mat_final%copy(mat(1,1),1,1) `````` Daniel Wortmann committed Oct 29, 2018 46 `````` CALL mat(1,1)%free() `````` Daniel Wortmann committed Jul 04, 2018 47 `````` `````` Daniel Wortmann committed Feb 26, 2018 48 49 `````` !down-down component CALL mat_final%copy(mat(2,2),lapw%nv(1)+atoms%nlotot+1,lapw%nv(1)+atoms%nlotot+1) `````` Daniel Wortmann committed Oct 29, 2018 50 `````` CALL mat(2,2)%free() `````` Daniel Wortmann committed Feb 26, 2018 51 52 `````` !Now collect off-diagonal parts `````` Daniel Wortmann committed Aug 24, 2018 53 54 `````` CALL mat(1,2)%add_transpose(mat(2,1)) CALL mat_final%copy(mat(1,2),1,lapw%nv(1)+atoms%nlotot+1) `````` Daniel Wortmann committed Oct 29, 2018 55 56 `````` CALL mat(1,2)%free() CALL mat(2,1)%free() `````` Daniel Wortmann committed Feb 26, 2018 57 58 59 60 61 `````` END SUBROUTINE eigen_redist_matrix END MODULE m_eigen_redist_matrix ``````