Commit cc07bc9d authored by Gregor Michalicek's avatar Gregor Michalicek

Add option to provide only last density in extra file for HDF mode

...it is used with the command line option -last_extra.
parent bede872b
......@@ -406,7 +406,7 @@ MODULE m_cdn_io
INTEGER :: jspinsTemp
INTEGER :: date, time, dateTemp, timeTemp
REAL :: fermiEnergyTemp, distanceTemp
LOGICAL :: l_qfixTemp
LOGICAL :: l_qfixTemp, l_CheckBroyd
CHARACTER(LEN=30) :: archiveName
CHARACTER(LEN=8) :: dateString
CHARACTER(LEN=10) :: timeString
......@@ -419,6 +419,9 @@ MODULE m_cdn_io
READ(dateString,'(i8)') date
READ(timeString,'(i6)') time
l_CheckBroyd = .TRUE.
IF(PRESENT(inFilename)) l_CheckBroyd = .FALSE.
IF(mode.EQ.CDN_HDF5_MODE) THEN
#ifdef CPP_HDF
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
......@@ -426,7 +429,7 @@ MODULE m_cdn_io
CALL checkAndWriteMetadataHDF(fileID, input, atoms, cell, vacuum, oneD, stars, sphhar, sym,&
currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,l_storeIndices)
currentStepfunctionIndex,l_storeIndices,l_CheckBroyd)
previousDensityIndex = readDensityIndex
writeDensityIndex = readDensityIndex
......@@ -884,7 +887,7 @@ MODULE m_cdn_io
END IF
IF (l_writeStructure) THEN
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex)
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex,.TRUE.)
CALL writeCDNHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
END IF
......@@ -928,7 +931,7 @@ MODULE m_cdn_io
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
currentStarsIndex = currentStarsIndex + 1
CALL writeStarsHDF(fileID, currentStarsIndex, currentStructureIndex, stars)
CALL writeStarsHDF(fileID, currentStarsIndex, currentStructureIndex, stars,.TRUE.)
CALL writeCDNHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
......@@ -1105,7 +1108,7 @@ MODULE m_cdn_io
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
currentStepfunctionIndex = currentStepfunctionIndex + 1
CALL writeStepfunctionHDF(fileID, currentStepfunctionIndex, currentStarsIndex, currentStructureIndex, stars)
CALL writeStepfunctionHDF(fileID, currentStepfunctionIndex, currentStarsIndex, currentStructureIndex, stars,.TRUE.)
CALL writeCDNHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
......
......@@ -125,7 +125,7 @@ MODULE m_cdnpot_io_common
#ifdef CPP_HDF
SUBROUTINE checkAndWriteMetadataHDF(fileID, input, atoms, cell, vacuum, oneD, stars, latharms, sym,&
currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,l_storeIndices)
currentStepfunctionIndex,l_storeIndices,l_CheckBroyd)
TYPE(t_input),INTENT(IN) :: input
TYPE(t_atoms),INTENT(IN) :: atoms
......@@ -139,6 +139,7 @@ MODULE m_cdnpot_io_common
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(INOUT) :: currentStarsIndex,currentLatharmsIndex
INTEGER, INTENT(INOUT) :: currentStructureIndex,currentStepfunctionIndex
LOGICAL, INTENT(IN) :: l_CheckBroyd
LOGICAL, INTENT(OUT) :: l_storeIndices
TYPE(t_stars) :: starsTemp
......@@ -159,7 +160,7 @@ MODULE m_cdnpot_io_common
IF(currentStructureIndex.EQ.0) THEN
currentStructureIndex = 1
l_storeIndices = .TRUE.
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex)
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex,l_CheckBroyd)
ELSE
CALL readStructureHDF(fileID, inputTemp, atomsTemp, cellTemp, vacuumTemp, oneDTemp, symTemp, currentStructureIndex)
CALL compareStructure(input, atoms, vacuum, cell, sym, inputTemp, atomsTemp, vacuumTemp, cellTemp, symTemp, l_same)
......@@ -168,13 +169,13 @@ MODULE m_cdnpot_io_common
currentStructureIndex = currentStructureIndex + 1
l_storeIndices = .TRUE.
l_writeAll = .TRUE.
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex)
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, currentStructureIndex,l_CheckBroyd)
END IF
END IF
IF (currentStarsIndex.EQ.0) THEN
currentStarsIndex = 1
l_storeIndices = .TRUE.
CALL writeStarsHDF(fileID, currentStarsIndex, currentStructureIndex, stars)
CALL writeStarsHDF(fileID, currentStarsIndex, currentStructureIndex, stars,l_CheckBroyd)
ELSE
CALL peekStarsHDF(fileID, currentStarsIndex, structureIndexTemp)
l_same = structureIndexTemp.EQ.currentStructureIndex
......@@ -185,13 +186,13 @@ MODULE m_cdnpot_io_common
IF((.NOT.l_same).OR.l_writeAll) THEN
currentStarsIndex = currentStarsIndex + 1
l_storeIndices = .TRUE.
CALL writeStarsHDF(fileID, currentStarsIndex, currentStructureIndex, stars)
CALL writeStarsHDF(fileID, currentStarsIndex, currentStructureIndex, stars,l_CheckBroyd)
END IF
END IF
IF (currentLatharmsIndex.EQ.0) THEN
currentLatharmsIndex = 1
l_storeIndices = .TRUE.
CALL writeLatharmsHDF(fileID, currentLatharmsIndex, currentStructureIndex, latharms)
CALL writeLatharmsHDF(fileID, currentLatharmsIndex, currentStructureIndex, latharms,l_checkBroyd)
ELSE
CALL peekLatharmsHDF(fileID, currentLatharmsIndex, structureIndexTemp)
l_same = structureIndexTemp.EQ.currentStructureIndex
......@@ -202,14 +203,14 @@ MODULE m_cdnpot_io_common
IF((.NOT.l_same).OR.l_writeAll) THEN
currentLatharmsIndex = currentLatharmsIndex + 1
l_storeIndices = .TRUE.
CALL writeLatharmsHDF(fileID, currentLatharmsIndex, currentStructureIndex, latharms)
CALL writeLatharmsHDF(fileID, currentLatharmsIndex, currentStructureIndex, latharms,l_CheckBroyd)
END IF
END IF
IF(currentStepfunctionIndex.EQ.0) THEN
currentStepfunctionIndex = 1
l_storeIndices = .TRUE.
CALL writeStepfunctionHDF(fileID, currentStepfunctionIndex, currentStarsIndex,&
currentStructureIndex, stars)
currentStructureIndex, stars,l_CheckBroyd)
ELSE
CALL peekStepfunctionHDF(fileID, currentStepfunctionIndex, starsIndexTemp, structureIndexTemp)
l_same = (starsIndexTemp.EQ.currentStarsIndex).AND.(structureIndexTemp.EQ.currentStructureIndex)
......@@ -221,7 +222,7 @@ MODULE m_cdnpot_io_common
currentStepfunctionIndex = currentStepfunctionIndex + 1
l_storeIndices = .TRUE.
CALL writeStepfunctionHDF(fileID, currentStepfunctionIndex, currentStarsIndex,&
currentStructureIndex, stars)
currentStructureIndex, stars,l_CheckBroyd)
END IF
END IF
......
......@@ -228,11 +228,12 @@ MODULE m_cdnpot_io_hdf
END SUBROUTINE writePOTHeaderData
SUBROUTINE writeStarsHDF(fileID, starsIndex, structureIndex, stars)
SUBROUTINE writeStarsHDF(fileID, starsIndex, structureIndex, stars, l_checkBroyd)
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: starsIndex, structureIndex
TYPE(t_stars), INTENT(IN) :: stars
LOGICAL, INTENT(IN) :: l_CheckBroyd
INTEGER(HID_T) :: groupID
INTEGER :: hdfError, ft2_gf_dim, dimsInt(7)
......@@ -267,7 +268,7 @@ MODULE m_cdnpot_io_hdf
INQUIRE(FILE='broyd',EXIST=l_exist)
IF (.NOT.l_exist) INQUIRE(FILE='broyd.7',EXIST=l_exist)
IF (l_exist) CALL juDFT_warn('Stars change but broyden files detected!')
IF (l_exist.AND.l_CheckBroyd) CALL juDFT_warn('Stars change but broyden files detected!')
CALL h5gcreate_f(fileID, TRIM(ADJUSTL(groupName)), groupID, hdfError)
......@@ -631,11 +632,12 @@ MODULE m_cdnpot_io_hdf
END SUBROUTINE peekStarsHDF
SUBROUTINE writeStepfunctionHDF(fileID, stepfunctionIndex, starsIndex, structureIndex, stars)
SUBROUTINE writeStepfunctionHDF(fileID, stepfunctionIndex, starsIndex, structureIndex, stars, l_CheckBroyd)
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: stepfunctionIndex, starsIndex, structureIndex
TYPE(t_stars), INTENT(IN) :: stars
LOGICAL, INTENT(IN) :: l_CheckBroyd
INTEGER :: ifftd
......@@ -658,7 +660,7 @@ MODULE m_cdnpot_io_hdf
INQUIRE(FILE='broyd',EXIST=l_exist)
IF (.NOT.l_exist) INQUIRE(FILE='broyd.7',EXIST=l_exist)
IF (l_exist) CALL juDFT_warn('Stepfunction change but broyden files detected!')
IF (l_exist.AND.l_CheckBroyd) CALL juDFT_warn('Stepfunction change but broyden files detected!')
ifftd = size(stars%ufft)
......@@ -776,11 +778,12 @@ MODULE m_cdnpot_io_hdf
END SUBROUTINE peekStepfunctionHDF
SUBROUTINE writeLatharmsHDF(fileID, latharmsIndex, structureIndex, latharms)
SUBROUTINE writeLatharmsHDF(fileID, latharmsIndex, structureIndex, latharms, l_CheckBroyd)
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: latharmsIndex, structureIndex
TYPE(t_sphhar), INTENT(IN) :: latharms
LOGICAL, INTENT(IN) :: l_CheckBroyd
INTEGER :: hdfError
INTEGER(HID_T) :: groupID
......@@ -804,7 +807,7 @@ MODULE m_cdnpot_io_hdf
INQUIRE(FILE='broyd',EXIST=l_exist)
IF (.NOT.l_exist) INQUIRE(FILE='broyd.7',EXIST=l_exist)
IF (l_exist) CALL juDFT_warn('Lattice harmonics change but broyden files detected!')
IF (l_exist.AND.l_CheckBroyd) CALL juDFT_warn('Lattice harmonics change but broyden files detected!')
CALL h5gcreate_f(fileID, TRIM(ADJUSTL(groupName)), groupID, hdfError)
......@@ -949,7 +952,7 @@ MODULE m_cdnpot_io_hdf
END SUBROUTINE peekLatharmsHDF
SUBROUTINE writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, structureIndex)
SUBROUTINE writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, sym, structureIndex, l_CheckBroyd)
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: structureIndex
......@@ -959,6 +962,7 @@ MODULE m_cdnpot_io_hdf
TYPE(t_vacuum), INTENT(IN) :: vacuum
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_sym),INTENT(IN) :: sym
LOGICAL, INTENT(IN) :: l_CheckBroyd
INTEGER(HID_T) :: groupID
INTEGER :: hdfError, i
......@@ -1012,7 +1016,7 @@ MODULE m_cdnpot_io_hdf
INQUIRE(FILE='broyd',EXIST=l_exist)
IF (.NOT.l_exist) INQUIRE(FILE='broyd.7',EXIST=l_exist)
IF (l_exist) CALL juDFT_warn('Structure / parameter change but broyden files detected!')
IF (l_exist.AND.l_CheckBroyd) CALL juDFT_warn('Structure / parameter change but broyden files detected!')
CALL h5gcreate_f(fileID, TRIM(ADJUSTL(groupName)), groupID, hdfError)
......
......@@ -203,7 +203,7 @@ MODULE m_pot_io
CALL checkAndWriteMetadataHDF(fileID, input, atoms, cell, vacuum, oneD, stars, sphhar, sym,&
currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,l_storeIndices)
currentStepfunctionIndex,l_storeIndices,.TRUE.)
archiveName = 'illegalPotentialArchive'
IF (archiveType.EQ.POT_ARCHIVE_TYPE_TOT_const) THEN
......
......@@ -60,6 +60,7 @@ CONTAINS
WRITE(*,'(a)')""
WRITE(*,'(a)')"HDF density file relevant options:"
WRITE(*,'(a)')"-no_cdn_hdf : disable HDF charge density mode (activated by default if HDF5 is available)"
WRITE(*,'(a)')"-last_extra : generate an additional file cdn_last.hdf that contains only the last density"
WRITE(*,'(a)')"-sd N : use starting density N, where N is the index of the density according to -info"
WRITE(*,'(a)')"-delden N-M : delete densities N to M"
WRITE(*,'(a)')"-delden N : delete density N"
......
......@@ -315,6 +315,15 @@ contains
CALL writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
1,results%last_distance,results%ef,.TRUE.,inDen)
#ifdef CPP_HDF
IF (judft_was_argument("-last_extra")) THEN
CALL system("rm cdn_last.hdf")
CALL writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
1,results%last_distance,results%ef,.TRUE.,inDen,'cdn_last')
END IF
#endif
inDen%iter = inDen%iter + 1
7900 FORMAT (/,'----> distance of charge densities for spin ',i2,' it=',i5,':',f13.6,' me/bohr**3')
......
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