Commit 2347d607 authored by Daniel Wortmann's avatar Daniel Wortmann

Bugfixes and simplifications of MPI matrix cleanup

parent 0d2e970c
...@@ -38,22 +38,22 @@ CONTAINS ...@@ -38,22 +38,22 @@ CONTAINS
!up-up component (or only component in collinear case) !up-up component (or only component in collinear case)
IF (SIZE(mat)==1) THEN IF (SIZE(mat)==1) THEN
CALL mat_final%move(mat(1,1)) CALL mat_final%move(mat(1,1))
IF (PRESENT(mat_final_templ)) CALL mat(1,1)%free() CALL mat(1,1)%free()
RETURN RETURN
ENDIF ENDIF
CALL mat_final%copy(mat(1,1),1,1) CALL mat_final%copy(mat(1,1),1,1)
IF (PRESENT(mat_final_templ)) CALL mat(1,1)%free() CALL mat(1,1)%free()
!down-down component !down-down component
CALL mat_final%copy(mat(2,2),lapw%nv(1)+atoms%nlotot+1,lapw%nv(1)+atoms%nlotot+1) CALL mat_final%copy(mat(2,2),lapw%nv(1)+atoms%nlotot+1,lapw%nv(1)+atoms%nlotot+1)
IF (PRESENT(mat_final_templ)) CALL mat(2,2)%free() CALL mat(2,2)%free()
!Now collect off-diagonal parts !Now collect off-diagonal parts
CALL mat(1,2)%add_transpose(mat(2,1)) CALL mat(1,2)%add_transpose(mat(2,1))
CALL mat_final%copy(mat(1,2),1,lapw%nv(1)+atoms%nlotot+1) CALL mat_final%copy(mat(1,2),1,lapw%nv(1)+atoms%nlotot+1)
IF (PRESENT(mat_final_templ)) CALL mat(1,2)%free() CALL mat(1,2)%free()
IF (PRESENT(mat_final_templ)) CALL mat(2,1)%free() CALL mat(2,1)%free()
END SUBROUTINE eigen_redist_matrix END SUBROUTINE eigen_redist_matrix
END MODULE m_eigen_redist_matrix END MODULE m_eigen_redist_matrix
......
...@@ -260,15 +260,17 @@ CONTAINS ...@@ -260,15 +260,17 @@ CONTAINS
INTEGER :: ierr INTEGER :: ierr
IF (ALLOCATED(mat%data_r)) DEALLOCATE(mat%data_r) IF (ALLOCATED(mat%data_r)) DEALLOCATE(mat%data_r)
IF (ALLOCATED(mat%data_c)) DEALLOCATE(mat%data_c) IF (ALLOCATED(mat%data_c)) DEALLOCATE(mat%data_c)
IF (mat%blacsdata%no_use>1) THEN IF (ASSOCIATED(mat%blacsdata)) THEN
mat%blacsdata%no_use=mat%blacsdata%no_use-1 IF (mat%blacsdata%no_use>1) THEN
mat%blacsdata=>null() mat%blacsdata%no_use=mat%blacsdata%no_use-1
ELSE mat%blacsdata=>null()
ELSE
#ifdef CPP_SCALAPACK #ifdef CPP_SCALAPACK
CALL BLACS_GRIDEXIT(mat%blacsdata%blacs_desc(2),ierr) CALL BLACS_GRIDEXIT(mat%blacsdata%blacs_desc(2),ierr)
DEALLOCATE(mat%blacsdata) DEALLOCATE(mat%blacsdata)
#endif #endif
END IF END IF
ENDIF
END SUBROUTINE mpimat_free END SUBROUTINE mpimat_free
!>Initialization of the distributed matrix. !>Initialization of the distributed matrix.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment