Commit cedf5f25 authored by Gregor Michalicek's avatar Gregor Michalicek

Added function isDensityFilePresent to density IO wrappers

parent 784f3541
......@@ -21,7 +21,7 @@ MODULE m_cdn_io
IMPLICIT NONE
PRIVATE
PUBLIC readDensity, writeDensity
PUBLIC readDensity, writeDensity, isDensityFilePresent
PUBLIC CDN_INPUT_DEN_const, CDN_OUTPUT_DEN_const
PUBLIC CDN_ARCHIVE_TYPE_CDN1_const, CDN_ARCHIVE_TYPE_NOCO_const
PUBLIC CDN_ARCHIVE_TYPE_CDN_const
......@@ -353,4 +353,46 @@ MODULE m_cdn_io
IF (juDFT_was_argument("-hdf_cdn")) mode=CDN_HDF5_MODE
END SUBROUTINE getMode
LOGICAL FUNCTION isDensityFilePresent(archiveType)
INTEGER, INTENT(IN) :: archiveType
LOGICAL :: l_exist
INTEGER :: mode
CALL getMode(mode)
IF (mode.EQ.CDN_HDF5_MODE) THEN
INQUIRE(FILE='cdn.hdf',EXIST=l_exist)
IF(l_exist) THEN
isDensityFilePresent = l_exist
RETURN
END IF
END IF
IF ((mode.EQ.CDN_STREAM_MODE).OR.(mode.EQ.CDN_HDF5_MODE)) THEN
INQUIRE(FILE='cdn.str',EXIST=l_exist)
IF(l_exist) THEN
isDensityFilePresent = l_exist
RETURN
END IF
END IF
!cdn1 or rhomat_inp should be enough for any mode...
INQUIRE(FILE='cdn1',EXIST=l_exist)
IF (archiveType.EQ.CDN_ARCHIVE_TYPE_CDN1_const) THEN
isDensityFilePresent = l_exist
RETURN
END IF
IF (archiveType.NE.CDN_ARCHIVE_TYPE_NOCO_const) THEN
CALL juDFT_error("Illegal archive type selected.",calledby ="isDensityFilePresent")
END IF
IF (l_exist) THEN
isDensityFilePresent = l_exist
RETURN
END IF
INQUIRE(FILE='rhomat_inp',EXIST=l_exist)
isDensityFilePresent = l_exist
END FUNCTION isDensityFilePresent
END MODULE m_cdn_io
......@@ -60,6 +60,7 @@ CONTAINS
USE m_stden
USE m_cdnsp
USE m_flipcdn
USE m_cdn_io
USE m_f2u
USE m_u2f
USE m_types
......@@ -83,7 +84,7 @@ CONTAINS
TYPE(t_sliceplot),INTENT(IN):: sliceplot
! ..
! .. Local Scalars ..
INTEGER :: it
INTEGER :: it, archiveType
CHARACTER*10 :: cdnfname
LOGICAL :: strho
! ..
......@@ -135,13 +136,11 @@ CONTAINS
!
strho=input%strho
IF (.NOT.(strho.OR.obsolete%l_f2u.OR.obsolete%l_u2f.OR.sliceplot%iplot)) THEN
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
IF (noco%l_noco) THEN
INQUIRE (file='rhomat_inp',exist=strho) ! if no density (rhoma
archiveType = CDN_ARCHIVE_TYPE_NOCO_const
END IF
IF(.NOT.strho) THEN
INQUIRE (file='cdn1',exist=strho) ! if no density (cdn1)
END IF
strho = .NOT.strho ! create a starting density
strho = .NOT.isDensityFilePresent(archiveType)
ENDIF
IF (strho) 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