Commit 719f8189 authored by Henning Janssen's avatar Henning Janssen

Modified hdf-io for offdiagonal contributions

parent 19046904
......@@ -1736,14 +1736,24 @@ MODULE m_cdnpot_io_hdf
CALL io_write_complex3(cdomvxySetID,(/-1,1,1,1/),dimsInt(:4),den%vacxy(:,:,:nvac,3))
CALL h5dclose_f(cdomvxySetID, hdfError)
END IF
END IF
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dimsInt(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,input%jspins/)
CALL h5dopen_f(groupID, 'mmpMat', mmpMatSetID, hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dimsInt(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,3/)
CALL h5dopen_f(groupID, 'mmpMat', mmpMatSetID, hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
ELSE
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dimsInt(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,input%jspins/)
CALL h5dopen_f(groupID, 'mmpMat', mmpMatSetID, hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
ENDIF
CALL h5gclose_f(groupID, hdfError)
ELSE
......@@ -1821,17 +1831,29 @@ MODULE m_cdnpot_io_hdf
CALL io_write_complex3(cdomvxySetID,(/-1,1,1,1/),dimsInt(:4),den%vacxy(:,:,:nvac,3))
CALL h5dclose_f(cdomvxySetID, hdfError)
END IF
END IF
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dims(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,input%jspins/)
dimsInt = dims
CALL h5screate_simple_f(5,dims(:5),mmpMatSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mmpMat", H5T_NATIVE_DOUBLE, mmpMatSpaceID, mmpMatSetID, hdfError)
CALL h5sclose_f(mmpMatSpaceID,hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dims(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,3/)
dimsInt = dims
CALL h5screate_simple_f(5,dims(:5),mmpMatSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mmpMat", H5T_NATIVE_DOUBLE, mmpMatSpaceID, mmpMatSetID, hdfError)
CALL h5sclose_f(mmpMatSpaceID,hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
ELSE
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dims(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,input%jspins/)
dimsInt = dims
CALL h5screate_simple_f(5,dims(:5),mmpMatSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mmpMat", H5T_NATIVE_DOUBLE, mmpMatSpaceID, mmpMatSetID, hdfError)
CALL h5sclose_f(mmpMatSpaceID,hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
ENDIF
CALL h5gclose_f(groupID, hdfError)
END IF
......@@ -1925,17 +1947,27 @@ MODULE m_cdnpot_io_hdf
CALL io_write_complex3(cdomvxySetID,(/-1,1,1,1/),dimsInt(:4),den%vacxy(:,:,:nvac,3))
CALL h5dclose_f(cdomvxySetID, hdfError)
END IF
END IF
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dims(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,input%jspins/)
dimsInt = dims
CALL h5screate_simple_f(5,dims(:5),mmpMatSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mmpMat", H5T_NATIVE_DOUBLE, mmpMatSpaceID, mmpMatSetID, hdfError)
CALL h5sclose_f(mmpMatSpaceID,hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dims(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,3/)
dimsInt = dims
CALL h5screate_simple_f(5,dims(:5),mmpMatSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mmpMat", H5T_NATIVE_DOUBLE, mmpMatSpaceID, mmpMatSetID, hdfError)
CALL h5sclose_f(mmpMatSpaceID,hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
ELSE
IF ((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
dims(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,input%jspins/)
dimsInt = dims
CALL h5screate_simple_f(5,dims(:5),mmpMatSpaceID,hdfError)
CALL h5dcreate_f(groupID, "mmpMat", H5T_NATIVE_DOUBLE, mmpMatSpaceID, mmpMatSetID, hdfError)
CALL h5sclose_f(mmpMatSpaceID,hdfError)
CALL io_write_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),den%mmpMat)
CALL h5dclose_f(mmpMatSetID, hdfError)
END IF
ENDIF
CALL h5gclose_f(groupID, hdfError)
......@@ -2206,7 +2238,7 @@ MODULE m_cdnpot_io_hdf
INTEGER :: ntype,jmtd,nmzd,nmzxyd,nlhd,ng3,ng2
INTEGER :: nmz, nvac, od_nq2, nmzxy, n_u, i, j
INTEGER :: localDensityType
LOGICAL :: l_film, l_exist, l_mmpMatDimEquals, l_amf_Temp
LOGICAL :: l_film, l_exist, l_mmpMatDimEquals, l_amf_Temp, l_noco
INTEGER(HID_T) :: archiveID, groupID, groupBID, generalGroupID
INTEGER :: hdfError, fileFormatVersion
CHARACTER(LEN=30) :: groupName, groupBName, densityTypeName
......@@ -2489,21 +2521,23 @@ MODULE m_cdnpot_io_hdf
END IF
IF((fileFormatVersion.GE.29).AND.(n_u.GT.0)) THEN
ALLOCATE (mmpMatTemp(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,n_u,jspins))
dimsInt(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,jspins/)
l_noco = (localDensityType.EQ.DENSITY_TYPE_NOCO_IN_const).OR.&
(localDensityType.EQ.DENSITY_TYPE_NOCO_OUT_const)
ALLOCATE (mmpMatTemp(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,n_u,MERGE(3,jspins,l_noco)))
dimsInt(:5)=(/2,2*lmaxU_const+1,2*lmaxU_const+1,n_u,MERGE(3,jspins,l_noco)/)
CALL h5dopen_f(groupID, 'mmpMat', mmpMatSetID, hdfError)
CALL io_read_complex4(mmpMatSetID,(/-1,1,1,1,1/),dimsInt(:5),mmpMatTemp)
CALL h5dclose_f(mmpMatSetID, hdfError)
den%mmpMat = CMPLX(0.0,0.0)
IF(l_mmpMatDimEquals) THEN
den%mmpMat(:,:,:,1:jspinsOut) = mmpMatTemp(:,:,:,1:jspinsOut)
den%mmpMat(:,:,:,1:MERGE(3,jspins,l_noco)) = mmpMatTemp(:,:,:,1:MERGE(3,jspins,l_noco))
ELSE
DO i = 1, n_u
DO j = 1, atoms%n_u+atoms%n_hia
IF (atoms%lda_u(j)%atomType.NE.ldau_AtomType(i)) CYCLE
IF (atoms%lda_u(j)%l.NE.ldau_l(i)) CYCLE
den%mmpMat(:,:,j,1:jspinsOut) = mmpMatTemp(:,:,i,1:jspinsOut)
den%mmpMat(:,:,j,1:MERGE(3,jspins,l_noco)) = mmpMatTemp(:,:,i,1:MERGE(3,jspins,l_noco))
END DO
END DO
END IF
......
......@@ -274,17 +274,17 @@ CONTAINS
INTEGER,INTENT(IN) :: jspins, potden_type
CALL init_potden_simple(pd,stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,&
atoms%n_u+atoms%n_hia,jspins,noco%l_noco,noco%l_mtnocopot,noco%l_mperp,potden_type,&
atoms%n_u+atoms%n_hia,jspins,noco%l_noco,noco%l_mtnocopot,potden_type,&
vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
END SUBROUTINE init_potden_types
SUBROUTINE init_potden_simple(pd,ng3,jmtd,nlhd,ntype,n_u,jspins,nocoExtraDim,nocoExtraMTDim,nocoExtraUDim,potden_type,nmzd,nmzxyd,n2d)
SUBROUTINE init_potden_simple(pd,ng3,jmtd,nlhd,ntype,n_u,jspins,nocoExtraDim,nocoExtraMTDim,potden_type,nmzd,nmzxyd,n2d)
USE m_constants
USE m_judft
IMPLICIT NONE
CLASS(t_potden),INTENT(OUT) :: pd
INTEGER,INTENT(IN) :: ng3,jmtd,nlhd,ntype,n_u,jspins,potden_type
LOGICAL,INTENT(IN) :: nocoExtraDim,nocoExtraMTDim,nocoExtraUDim
LOGICAL,INTENT(IN) :: nocoExtraDim,nocoExtraMTDim
INTEGER,INTENT(IN) :: nmzd,nmzxyd,n2d
INTEGER:: err(4)
......@@ -302,7 +302,7 @@ CONTAINS
ALLOCATE (pd%vacz(nmzd,2,MERGE(4,jspins,nocoExtraDim)),stat=err(3))
ALLOCATE (pd%vacxy(nmzxyd,n2d-1,2,MERGE(3,jspins,nocoExtraDim)),stat=err(4))
ALLOCATE (pd%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,n_u),MERGE(3,jspins,nocoExtraUDim)))
ALLOCATE (pd%mmpMat(-lmaxU_const:lmaxU_const,-lmaxU_const:lmaxU_const,MAX(1,n_u),MERGE(3,jspins,nocoExtraDim)))
IF (ANY(err>0)) CALL judft_error("Not enough memory allocating potential or density")
pd%pw=CMPLX(0.0,0.0)
......
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