Commit 2aa07066 authored by Matthias Redies's avatar Matthias Redies

Merge branch 'develop' into MetaGGA

parents 59280e06 d8afa3fa
This diff is collapsed.
......@@ -97,7 +97,7 @@ CONTAINS
ALLOCATE(hmat_final,mold=smat(1,1))
CALL eigen_redist_matrix(mpi,lapw,atoms,smat,smat_final)
CALL eigen_redist_matrix(mpi,lapw,atoms,hmat,hmat_final,smat_final)
END SUBROUTINE eigen_hssetup
END MODULE m_eigen_hssetup
......@@ -27,16 +27,17 @@ MODULE m_banddos_io
CONTAINS
SUBROUTINE openBandDOSFile(fileID, input, atoms, cell, kpts)
SUBROUTINE openBandDOSFile(fileID, input, atoms, cell, kpts, banddos)
USE m_types
USE hdf5
USE m_cdn_io
TYPE(t_input), INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_input), INTENT(IN) :: input
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_banddos), INTENT(IN) :: banddos
INTEGER(HID_T), INTENT(OUT) :: fileID
......@@ -67,6 +68,7 @@ MODULE m_banddos_io
INTEGER :: hdfError, dimsInt(7)
INTEGER :: version
INTEGER :: fakeLogical
REAL :: eFermiPrev
LOGICAL :: l_error
......@@ -98,6 +100,9 @@ MODULE m_banddos_io
CALL h5gcreate_f(fileID, '/general', generalGroupID, hdfError)
CALL io_write_attint0(generalGroupID,'spins',input%jspins)
CALL io_write_attreal0(generalGroupID,'lastFermiEnergy',eFermiPrev)
fakeLogical = 0
IF (banddos%unfoldband) fakeLogical = 1
CALL io_write_attint0(generalGroupID,'bandUnfolding',fakeLogical)
CALL h5gclose_f(generalGroupID, hdfError)
CALL h5gcreate_f(fileID, '/cell', cellGroupID, hdfError)
......@@ -236,12 +241,14 @@ MODULE m_banddos_io
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER(HID_T) :: eigenvaluesGroupID
INTEGER(HID_T) :: bandUnfoldingGroupID
INTEGER(HID_T) :: eigenvaluesSpaceID, eigenvaluesSetID
INTEGER(HID_T) :: numFoundEigsSpaceID, numFoundEigsSetID
INTEGER(HID_T) :: lLikeChargeSpaceID, lLikeChargeSetID
INTEGER(HID_T) :: jsymSpaceID, jsymSetID
INTEGER(HID_T) :: ksymSpaceID, ksymSetID
INTEGER(HID_T) :: bUWeightsSpaceID, bUWeightsSetID
INTEGER :: hdfError, dimsInt(7)
......@@ -296,6 +303,20 @@ MODULE m_banddos_io
CALL h5gclose_f(eigenvaluesGroupID, hdfError)
IF (banddos%unfoldband) THEN
CALL h5gcreate_f(fileID, '/bandUnfolding', bandUnfoldingGroupID, hdfError)
dims(:3)=(/neigd,kpts%nkpt,input%jspins/)
dimsInt = dims
CALL h5screate_simple_f(3,dims(:3),bUWeightsSpaceID,hdfError)
CALL h5dcreate_f(bandUnfoldingGroupID, "weights", H5T_NATIVE_DOUBLE, bUWeightsSpaceID, buWeightsSetID, hdfError)
CALL h5sclose_f(bUWeightsSpaceID,hdfError)
CALL io_write_real3(bUWeightsSetID,(/1,1,1/),dimsInt(:3), REAL(results%unfolding_weights(:neigd,:,:)))
CALL h5dclose_f(bUWeightsSetID, hdfError)
CALL h5gclose_f(bandUnfoldingGroupID, hdfError)
END IF
END SUBROUTINE
SUBROUTINE io_write_string1(datasetID,dims,stringLength,dataArray)
......
......@@ -209,17 +209,20 @@ CONTAINS
LOGICAL :: write_to_file=.false.
CLASS(t_mat), ALLOCATABLE :: zMat_s
CALL build_primitive_cell(banddos,p_cell,cell)
! method_rubel=.true. !this switch is to switch between overlap matrix and rubel method (without overlap matrix)
DO j = 1, lapw%nv(jsp)
DO i = 1, j-1
IF(smat_unfold%l_real) THEN
smat_unfold%data_r(j,i) = smat_unfold%data_r(i,j)
ELSE
smat_unfold%data_c(j,i) = CONJG(smat_unfold%data_c(i,j))
END IF
END DO
END DO
CALL build_primitive_cell(banddos,p_cell,cell)
IF (.not. method_rubel) THEN
DO j = 1, lapw%nv(jsp)
DO i = 1, j-1
IF(smat_unfold%l_real) THEN
smat_unfold%data_r(j,i) = smat_unfold%data_r(i,j)
ELSE
smat_unfold%data_c(j,i) = CONJG(smat_unfold%data_c(i,j))
END IF
END DO
END DO
END IF
! write_to_file=.true.
IF (write_to_file) THEN
IF (i_kpt==1) THEN
......@@ -233,7 +236,6 @@ CONTAINS
! write(222,'(234f15.8)') zMat%data_r
! write(223,'(234f15.8)') smat_unfold%data_r
! method_rubel=.true. !this switch is to switch between overlap matrix and rubel method (without overlap matrix)
IF (zmat%l_real) THEN
ALLOCATE(w_n(zMat%matsize2))
......
......@@ -127,7 +127,7 @@ SUBROUTINE cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
CALL write_band_sc(kpts,results,eFermiPrev)
END IF
#ifdef CPP_HDF
CALL openBandDOSFile(banddosFile_id,input,atoms,cell,kpts)
CALL openBandDOSFile(banddosFile_id,input,atoms,cell,kpts,banddos)
CALL writeBandDOSData(banddosFile_id,input,atoms,cell,kpts,results,banddos,dos,vacuum)
CALL closeBandDOSFile(banddosFile_id)
#endif
......
......@@ -46,7 +46,7 @@ MODULE m_types_mpimat
PROCEDURE,PASS :: generate_full_matrix ! construct full matrix if only upper triangle of hermitian matrix is given
PROCEDURE,PASS :: print_matrix
PROCEDURE,PASS :: from_non_dist
FINAL :: finalize
FINAL :: finalize, finalize_1d, finalize_2d, finalize_3d
END TYPE t_mpimat
PUBLIC t_mpimat
......@@ -295,6 +295,44 @@ CONTAINS
CALL mpimat_free(mat)
END SUBROUTINE finalize
SUBROUTINE finalize_1d(mat)
IMPLICIT NONE
TYPE(t_mpimat),INTENT(INOUT) :: mat(:)
INTEGER :: i
DO i = 1,size(mat)
CALL mpimat_free(mat(i))
ENDDO
END SUBROUTINE finalize_1d
SUBROUTINE finalize_2d(mat)
IMPLICIT NONE
TYPE(t_mpimat),INTENT(INOUT) :: mat(:,:)
INTEGER :: i,j
DO i = 1,size(mat, dim=1)
DO j = 1,size(mat, dim=2)
CALL mpimat_free(mat(i,j))
ENDDO
ENDDO
END SUBROUTINE finalize_2d
SUBROUTINE finalize_3d(mat)
IMPLICIT NONE
TYPE(t_mpimat),INTENT(INOUT) :: mat(:,:,:)
INTEGER :: i,j,k
DO i = 1,size(mat, dim=1)
DO j = 1,size(mat, dim=2)
DO k = 1,size(mat, dim=3)
CALL mpimat_free(mat(i,j,k))
ENDDO
ENDDO
ENDDO
END SUBROUTINE finalize_3d
SUBROUTINE mpimat_free(mat)
IMPLICIT NONE
CLASS(t_mpimat),INTENT(INOUT) :: mat
......@@ -370,8 +408,10 @@ CONTAINS
mat%blacsdata%blacs_desc(4)=global_size2
mat%global_size1=global_size1
mat%global_size2=global_size2
#ifdef CPP_SCALAPACK
mat%matsize1=NUMROC( global_size1,mat%blacsdata%blacs_desc(5), mat%blacsdata%myrow, mat%blacsdata%blacs_desc(7), mat%blacsdata%nprow )
mat%matsize1=NUMROC( global_size2,mat%blacsdata%blacs_desc(6), mat%blacsdata%mycol, mat%blacsdata%blacs_desc(8), mat%blacsdata%npcol )
#endif
ELSE
mat%matsize1=templ%matsize1
mat%matsize2=templ%matsize2
......@@ -467,12 +507,12 @@ CONTAINS
k = k + 1
ENDDO
ENDDO
#ifdef CPP_BLACSDEFAULT
!#ifdef CPP_BLACSDEFAULT
!Get the Blacs default context
CALL BLACS_GET(0,0,ictextblacs)
#else
ictextblacs=mpi_subcom
#endif
!#else
! ictextblacs=mpi_subcom
!#endif
! Create the Grid
CALL BLACS_GRIDMAP(ictextblacs,iusermap,size(iusermap,1),blacsdata%nprow,blacsdata%npcol)
! Now control, whether the BLACS grid is the one we wanted
......
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