diff --git a/io/cdn_io.F90 b/io/cdn_io.F90 index 14ca277052cd7f7706cb8f44a931905b97d28968..ee9c7abf5d78568e9a2bda4dac22431b01086d5b 100644 --- a/io/cdn_io.F90 +++ b/io/cdn_io.F90 @@ -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) diff --git a/io/cdnpot_io_common.F90 b/io/cdnpot_io_common.F90 index b4cbfbf0457bf6b076fb53ef7de2872af10d6438..69d40bc75225c55bdc49b160e1b68a99f24689d5 100644 --- a/io/cdnpot_io_common.F90 +++ b/io/cdnpot_io_common.F90 @@ -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 diff --git a/io/cdnpot_io_hdf.F90 b/io/cdnpot_io_hdf.F90 index 6f862e0c81850791c1d31623ac1d447340e93fa3..761740b273e3bf774c916e98be301bf9e89c812b 100644 --- a/io/cdnpot_io_hdf.F90 +++ b/io/cdnpot_io_hdf.F90 @@ -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) diff --git a/io/pot_io.F90 b/io/pot_io.F90 index 84e75a9b9fcb8681998e9c10a25473443ff0f7ef..8c1f1ab8ac66a2e945e9a1bcc56217b8e8fff874 100644 --- a/io/pot_io.F90 +++ b/io/pot_io.F90 @@ -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 diff --git a/main/fleur_help.f90 b/main/fleur_help.f90 index 8a7495a4d9ddcc8f4c842de1c14807a496ffe2df..85af21de0d4063f6bb351d4441bc5c068dfa6850 100644 --- a/main/fleur_help.f90 +++ b/main/fleur_help.f90 @@ -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" diff --git a/main/mix.F90 b/main/mix.F90 index f54854ee15deb3e7603032dfd3e46eb3fb75d81f..4ec2ac2609d21fa5aed80eb32049aa3825d3e703 100644 --- a/main/mix.F90 +++ b/main/mix.F90 @@ -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')