Commit 519ddd52 authored by Gregor Michalicek's avatar Gregor Michalicek

Add time stamp to each density entry in cdn.hdf file

- The time stamp is written when the wirst density entry for a given
  density index is written.

- Also in this commit: write this time stamp out in if the info mode
                       is used.
parent 2a9b32b9
......@@ -62,11 +62,16 @@ MODULE m_cdn_io
INTEGER :: readDensityIndex, lastDensityIndex
CHARACTER(LEN=30) :: archiveName
INTEGER :: dateTemp, timeTemp
INTEGER :: iterTemp, starsIndexTemp, latharmsIndexTemp
INTEGER :: structureIndexTemp,stepfunctionIndexTemp
INTEGER :: previousDensityIndex, jspinsTemp
REAL :: fermiEnergyTemp, distanceTemp
LOGICAL :: l_qfixTemp
CHARACTER(LEN=10) :: dateString
CHARACTER(LEN=10) :: timeString
CHARACTER(LEN=19) :: timeStampString
CHARACTER(LEN=15) :: distanceString
CALL getMode(mode)
......@@ -80,7 +85,7 @@ MODULE m_cdn_io
IF (l_exist) THEN
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
currentStepfunctionIndex,readDensityIndex,lastDensityIndex)
WRITE(*,*) 'densityIndex iteration prevDensity prevDistance'
WRITE(*,*) 'densityIndex iteration prevDensity prevDistance timeStamp'
DO i = 1, lastDensityIndex
archiveName = ''
WRITE(archiveName,'(a,i0)') '/cdn-', i
......@@ -93,10 +98,22 @@ MODULE m_cdn_io
CALL peekDensityEntryHDF(fileID, archiveName, DENSITY_TYPE_UNDEFINED_const,&
iterTemp, starsIndexTemp, latharmsIndexTemp, structureIndexTemp,&
stepfunctionIndexTemp,previousDensityIndex, jspinsTemp,&
distanceTemp, fermiEnergyTemp, l_qfixTemp)
dateTemp, timeTemp, distanceTemp, fermiEnergyTemp, l_qfixTemp)
WRITE(*,'(1x,i7,6x,i7,7x,i7,4x,f15.8)') i, iterTemp, previousDensityIndex, distanceTemp
WRITE(dateString,'(i8)'), dateTemp
WRITE(timeString,'(i6)'), timeTemp
distanceString = ''
IF (distanceTemp.GE.-1e-10) THEN
WRITE(distanceString,'(f15.8)') distanceTemp
END IF
WRITE(timeStampString,'(a4,a1,a2,a1,a2,1x,a2,a1,a2,a1,a2)') &
dateString(1:4),'/',dateString(5:6),'/',dateString(7:8),&
timeString(1:2),':',timeString(3:4),':',timeString(5:6)
WRITE(*,'(1x,i7,6x,i7,7x,i7,4x,a15,3x,a)') i, iterTemp, previousDensityIndex, distanceString,&
TRIM(ADJUSTL(timeStampString))
END DO
CALL closeCDNPOT_HDF(fileID)
ELSE
......@@ -341,11 +358,18 @@ MODULE m_cdn_io
INTEGER :: starsIndexTemp, latharmsIndexTemp, structureIndexTemp
INTEGER :: stepfunctionIndexTemp
INTEGER :: jspinsTemp
INTEGER :: date, time, dateTemp, timeTemp
REAL :: fermiEnergyTemp, distanceTemp
LOGICAL :: l_qfixTemp
CHARACTER(LEN=30) :: archiveName
CHARACTER(LEN=8) :: dateString
CHARACTER(LEN=10) :: timeString
CHARACTER(LEN=10) :: zone
CALL getMode(mode)
CALL DATE_AND_TIME(dateString,timeString,zone)
READ(dateString,'(i8)') date
READ(timeString,'(i6)') time
IF(mode.EQ.CDN_HDF5_MODE) THEN
#ifdef CPP_HDF
......@@ -414,7 +438,7 @@ MODULE m_cdn_io
CALL peekDensityEntryHDF(fileID, archiveName, DENSITY_TYPE_UNDEFINED_const,&
iterTemp, starsIndexTemp, latharmsIndexTemp, structureIndexTemp,&
stepfunctionIndexTemp,previousDensityIndex, jspinsTemp,&
distanceTemp, fermiEnergyTemp, l_qfixTemp)
dateTemp, timeTemp, distanceTemp, fermiEnergyTemp, l_qfixTemp)
END IF
END IF
......@@ -433,7 +457,7 @@ MODULE m_cdn_io
CALL writeDensityHDF(input, fileID, archiveName, densityType, previousDensityIndex,&
currentStarsIndex, currentLatharmsIndex, currentStructureIndex,&
currentStepfunctionIndex,distance,fermiEnergy,l_qfix,iter+relCdnIndex,&
currentStepfunctionIndex,date,time,distance,fermiEnergy,l_qfix,iter+relCdnIndex,&
fr,fpw,fzTemp,fzxyTemp,cdom,cdomvz,cdomvxy)
DEALLOCATE(fzTemp,fzxyTemp)
......@@ -598,7 +622,7 @@ MODULE m_cdn_io
INTEGER :: starsIndex, latharmsIndex, structureIndex
INTEGER :: stepfunctionIndex
INTEGER :: iter, jspins, previousDensityIndex
INTEGER :: date, time, iter, jspins, previousDensityIndex
REAL :: fermiEnergy, distance
LOGICAL :: l_qfix, l_exist
CHARACTER(LEN=30) :: archiveName
......@@ -614,14 +638,14 @@ MODULE m_cdn_io
WRITE(archiveName,'(a,i0)') '/cdn-', readDensityIndex
CALL peekDensityEntryHDF(fileID, archiveName, DENSITY_TYPE_UNDEFINED_const,&
iter, starsIndex, latharmsIndex, structureIndex, stepfunctionIndex,&
previousDensityIndex, jspins, distance, fermiEnergy, l_qfix)
previousDensityIndex, jspins, date, time, distance, fermiEnergy, l_qfix)
archiveName = ''
WRITE(archiveName,'(a,i0)') '/cdn-', previousDensityIndex
l_exist = isDensityEntryPresentHDF(fileID,archiveName,DENSITY_TYPE_NOCO_OUT_const)
IF(l_exist) THEN
CALL peekDensityEntryHDF(fileID, archiveName, DENSITY_TYPE_NOCO_OUT_const,&
iter, starsIndex, latharmsIndex, structureIndex, stepfunctionIndex,&
previousDensityIndex, jspins, distance, fermiEnergy, l_qfix)
previousDensityIndex, jspins, date, time, distance, fermiEnergy, l_qfix)
eFermiPrev = fermiEnergy
ELSE
l_error = .TRUE.
......
......@@ -1266,7 +1266,8 @@ MODULE m_cdnpot_io_hdf
SUBROUTINE writeDensityHDF(input, fileID, archiveName, densityType, previousDensityIndex,&
starsIndex, latharmsIndex, structureIndex, stepfunctionIndex,&
distance,fermiEnergy,l_qfix,iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
date,time,distance,fermiEnergy,l_qfix,iter,&
fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
TYPE(t_input), INTENT(IN) :: input
INTEGER(HID_T), INTENT(IN) :: fileID
......@@ -1275,7 +1276,7 @@ MODULE m_cdnpot_io_hdf
INTEGER, INTENT(IN) :: stepfunctionIndex
CHARACTER(LEN=*), INTENT(IN) :: archiveName
INTEGER, INTENT (IN) :: iter
INTEGER, INTENT (IN) :: date, time, iter
REAL, INTENT (IN) :: fermiEnergy, distance
LOGICAL, INTENT (IN) :: l_qfix
......@@ -1507,6 +1508,8 @@ MODULE m_cdnpot_io_hdf
CALL io_write_attint0(archiveID,'stepfunctionIndex',stepfunctionIndex)
CALL io_write_attint0(archiveID,'spins',input%jspins)
CALL io_write_attint0(archiveID,'iter',iter)
CALL io_write_attint0(archiveID,'date',date)
CALL io_write_attint0(archiveID,'time',time)
CALL io_write_attreal0(archiveID,'distance',distance)
CALL h5gcreate_f(fileID, TRIM(ADJUSTL(groupName)), groupID, hdfError)
......@@ -2102,13 +2105,13 @@ MODULE m_cdnpot_io_hdf
SUBROUTINE peekDensityEntryHDF(fileID, archiveName, densityType,&
iter, starsIndex, latharmsIndex, structureIndex,&
stepfunctionIndex, previousDensityIndex, jspins,&
distance, fermiEnergy, l_qfix)
date, time, distance, fermiEnergy, l_qfix)
INTEGER(HID_T), INTENT(IN) :: fileID
INTEGER, INTENT(IN) :: densityType
CHARACTER(LEN=*), INTENT(IN) :: archiveName
INTEGER, INTENT(OUT) :: iter
INTEGER, INTENT(OUT) :: date, time, iter
INTEGER, INTENT(OUT) :: starsIndex, latharmsIndex, structureIndex, stepfunctionIndex
INTEGER, INTENT(OUT) :: previousDensityIndex, jspins
REAL, INTENT(OUT) :: fermiEnergy, distance
......@@ -2122,7 +2125,7 @@ MODULE m_cdnpot_io_hdf
l_exist = io_groupexists(fileID,TRIM(ADJUSTL(archiveName)))
IF(.NOT.l_exist) THEN
CALL juDFT_error('density archive '//TRIM(ADJUSTL(archiveName))//' does not exist.' ,calledby ="peekDensityHDF")
CALL juDFT_error('density archive '//TRIM(ADJUSTL(archiveName))//' does not exist.' ,calledby ="peekDensityEntryHDF")
END IF
localDensityType = densityType
......@@ -2152,13 +2155,13 @@ MODULE m_cdnpot_io_hdf
CASE(DENSITY_TYPE_PRECOND_const)
densityTypeName = '/precond'
CASE DEFAULT
CALL juDFT_error("Unknown density type selected",calledby ="peekDensityHDF")
CALL juDFT_error("Unknown density type selected",calledby ="peekDensityEntryHDF")
END SELECT
groupName = TRIM(ADJUSTL(archiveName))//TRIM(ADJUSTL(densityTypeName))
l_exist = io_groupexists(fileID,TRIM(ADJUSTL(groupName)))
IF(.NOT.l_exist) THEN
CALL juDFT_error('density entry '//TRIM(ADJUSTL(groupName))//' does not exist.' ,calledby ="peekDensityHDF")
CALL juDFT_error('density entry '//TRIM(ADJUSTL(groupName))//' does not exist.' ,calledby ="peekDensityEntryHDF")
END IF
CALL h5gopen_f(fileID, TRIM(ADJUSTL(archiveName)), archiveID, hdfError)
......@@ -2171,6 +2174,8 @@ MODULE m_cdnpot_io_hdf
CALL io_read_attint0(archiveID,'stepfunctionIndex',stepfunctionIndex)
CALL io_read_attint0(archiveID,'spins',jspins)
CALL io_read_attint0(archiveID,'iter',iter)
CALL io_read_attint0(archiveID,'date',date)
CALL io_read_attint0(archiveID,'time',time)
CALL io_read_attreal0(archiveID,'distance',distance)
IF (densityType.NE.DENSITY_TYPE_UNDEFINED_const) THEN
......
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