Commit f12cb850 authored by Daniel Wortmann's avatar Daniel Wortmann

Merge branch 'develop' of fleur-git:fleur into develop

parents 0e656b09 8821099a
This diff is collapsed.
......@@ -28,6 +28,7 @@ MODULE m_cdn_io
PUBLIC readDensity, writeDensity
PUBLIC isDensityFilePresent, isCoreDensityPresent
PUBLIC readCoreDensity, writeCoreDensity
PUBLIC setStartingDensity
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
......@@ -76,8 +77,9 @@ MODULE m_cdn_io
INTEGER(HID_T) :: fileID
#endif
INTEGER :: currentStarsIndex,currentLatharmsIndex
INTEGER :: currentStructureIndex,currentDensityIndex
INTEGER :: lastDensityIndex, densityType
INTEGER :: currentStructureIndex
INTEGER :: readDensityIndex, lastDensityIndex
INTEGER :: previousDensityIndex, densityType
CHARACTER(LEN=30) :: archiveName
TYPE(t_cell) :: cellTemp
......@@ -91,14 +93,13 @@ MODULE m_cdn_io
INQUIRE(FILE='cdn.hdf',EXIST=l_exist)
IF (l_exist) THEN
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,currentDensityIndex)
currentDensityIndex = currentDensityIndex + relCdnIndex ! This is actually wrong. I should go back step by step.
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
readDensityIndex,lastDensityIndex)
IF (archiveType.EQ.CDN_ARCHIVE_TYPE_CDN_const) THEN
archiveName = 'cdn'
ELSE
WRITE(archiveName,'(a,i0)') '/cdn-', currentDensityIndex
WRITE(archiveName,'(a,i0)') '/cdn-', readDensityIndex
END IF
SELECT CASE (inOrOutCDN)
......@@ -123,7 +124,8 @@ MODULE m_cdn_io
END IF
IF (l_exist) THEN
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,currentDensityIndex)
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
readDensityIndex,lastDensityIndex)
CALL readDensityHDF(fileID, archiveName, densityType,&
iter,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
......@@ -260,15 +262,19 @@ MODULE m_cdn_io
INTEGER(HID_T) :: fileID
#endif
INTEGER :: currentStarsIndex,currentLatharmsIndex
INTEGER :: currentStructureIndex,currentDensityIndex
INTEGER :: lastDensityIndex, densityType
INTEGER :: currentStructureIndex
INTEGER :: readDensityIndex, writeDensityIndex, lastDensityIndex
INTEGER :: previousDensityIndex, densityType
INTEGER :: starsIndexTemp, latharmsIndexTemp, structureIndexTemp
INTEGER :: jspinsTemp
CHARACTER(LEN=30) :: archiveName
CALL getMode(mode)
IF(mode.EQ.CDN_HDF5_MODE) THEN
#ifdef CPP_HDF
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,currentDensityIndex)
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
readDensityIndex,lastDensityIndex)
l_storeIndices = .FALSE.
IF (currentStarsIndex.EQ.0) THEN
......@@ -286,9 +292,12 @@ MODULE m_cdn_io
l_storeIndices = .TRUE.
CALL writeStructureHDF(fileID, input, atoms, cell, vacuum, oneD, currentStructureIndex)
END IF
lastDensityIndex = currentDensityIndex
previousDensityIndex = readDensityIndex
writeDensityIndex = readDensityIndex
IF(relCdnIndex.NE.0) THEN
currentDensityIndex = currentDensityIndex+relCdnIndex
writeDensityIndex = lastDensityIndex+relCdnIndex
lastDensityIndex = writeDensityIndex
readDensityIndex = writeDensityIndex
l_storeIndices = .TRUE.
END IF
......@@ -296,7 +305,7 @@ MODULE m_cdn_io
IF (archiveType.EQ.CDN_ARCHIVE_TYPE_CDN_const) THEN
archiveName = 'cdn'
ELSE
WRITE(archiveName,'(a,i0)') '/cdn-', currentDensityIndex
WRITE(archiveName,'(a,i0)') '/cdn-', writeDensityIndex
END IF
densityType = 0
......@@ -318,13 +327,22 @@ MODULE m_cdn_io
CALL juDFT_error("Invalid inOrOutCDN selected.",calledby ="writeDensity")
END SELECT
CALL writeDensityHDF(input, fileID, archiveName, densityType, lastDensityIndex,&
IF(relCdnIndex.EQ.0) THEN
l_exist = isDensityEntryPresentHDF(fileID,archiveName,DENSITY_TYPE_UNDEFINED_const)
IF(l_exist) THEN
CALL peekDensityEntryHDF(fileID, archiveName, DENSITY_TYPE_UNDEFINED_const,&
iterTemp, starsIndexTemp, latharmsIndexTemp, structureIndexTemp,&
previousDensityIndex, jspinsTemp)
END IF
END IF
CALL writeDensityHDF(input, fileID, archiveName, densityType, previousDensityIndex,&
currentStarsIndex, currentLatharmsIndex, currentStructureIndex,&
iter+relCdnIndex,fr,fpw,fz,fzxy,cdom,cdomvz,cdomvxy)
IF(l_storeIndices) THEN
CALL writeHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,&
currentStructureIndex,currentDensityIndex)
currentStructureIndex,readDensityIndex,lastDensityIndex)
END IF
CALL closeCDN_HDF(fileID)
......@@ -485,7 +503,8 @@ MODULE m_cdn_io
INTEGER(HID_T) :: fileID
#endif
INTEGER :: currentStarsIndex,currentLatharmsIndex
INTEGER :: currentStructureIndex,currentDensityIndex
INTEGER :: currentStructureIndex
INTEGER :: readDensityIndex, lastDensityIndex
CALL getMode(mode)
......@@ -493,7 +512,8 @@ MODULE m_cdn_io
#ifdef CPP_HDF
l_exist = isCoreDensityPresentHDF()
IF (l_exist) THEN
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,currentDensityIndex)
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
readDensityIndex,lastDensityIndex)
CALL readCoreDensityHDF(fileID,input,atoms,dimension,rhcs,tecs,qints)
CALL closeCDN_HDF(fileID)
RETURN
......@@ -554,13 +574,15 @@ MODULE m_cdn_io
INTEGER(HID_T) :: fileID
#endif
INTEGER :: currentStarsIndex,currentLatharmsIndex
INTEGER :: currentStructureIndex,currentDensityIndex
INTEGER :: currentStructureIndex
INTEGER :: readDensityIndex, lastDensityIndex
CALL getMode(mode)
IF(mode.EQ.CDN_HDF5_MODE) THEN
#ifdef CPP_HDF
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,currentDensityIndex)
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
readDensityIndex,lastDensityIndex)
CALL writeCoreDensityHDF(fileID,input,atoms,dimension,rhcs,tecs,qints)
CALL closeCDN_HDF(fileID)
#endif
......@@ -582,6 +604,68 @@ MODULE m_cdn_io
END SUBROUTINE writeCoreDensity
SUBROUTINE setStartingDensity(l_noco)
LOGICAL,INTENT(IN) :: l_noco
#ifdef CPP_HDF
INTEGER(HID_T) :: fileID
#endif
INTEGER :: currentStarsIndex,currentLatharmsIndex
INTEGER :: currentStructureIndex
INTEGER :: readDensityIndex, lastDensityIndex
INTEGER :: sdIndex, ioStatus, mode
INTEGER :: densityType
CHARACTER(LEN=20) :: numberString
CHARACTER(LEN=30) :: archiveName
LOGICAL :: l_exist
IF (.NOT.juDFT_was_argument("-sd")) THEN
RETURN
END IF
numberString = juDFT_string_for_argument("-sd")
IF (TRIM(ADJUSTL(numberString)).EQ.'') THEN
CALL juDFT_error("No number for starting density set in command line.",calledby ="setStartingDensity")
END IF
ioStatus = 0
READ(numberString,'(i8)',iostat=ioStatus) sdIndex
IF(ioStatus.NE.0) THEN
CALL juDFT_error("Could not convert starting density index string to number.",calledby ="setStartingDensity")
END IF
WRITE(*,'(a,i0,a)') 'Using density ', sdIndex, ' as starting density.'
CALL getMode(mode)
IF(mode.EQ.CDN_HDF5_MODE) THEN
#ifdef CPP_HDF
CALL openCDN_HDF(fileID,currentStarsIndex,currentLatharmsIndex,currentStructureIndex,&
readDensityIndex,lastDensityIndex)
densityType = DENSITY_TYPE_IN_const
IF(l_noco) THEN
densityType = DENSITY_TYPE_NOCO_IN_const
END IF
archiveName = ''
WRITE(archiveName,'(a,i0)') '/cdn-', sdIndex
l_exist = isDensityEntryPresentHDF(fileID,archiveName,densityType)
IF(.NOT.l_exist) THEN
WRITE(*,*) 'archiveName: ', TRIM(ADJUSTL(archiveName))
CALL juDFT_error("For selected starting density index no in-density is present.",calledby ="setStartingDensity")
END IF
CALL writeHeaderData(fileID,currentStarsIndex,currentLatharmsIndex,&
currentStructureIndex,sdIndex,lastDensityIndex)
CALL closeCDN_HDF(fileID)
#endif
ELSE IF(mode.EQ.CDN_STREAM_MODE) THEN
STOP 'CDN_STREAM_MODE not yet implemented!'
ELSE
WRITE(*,*) 'Explicit setting of starting density in direct access mode'
WRITE(*,*) 'not implemented.'
WRITE(*,*) ''
WRITE(*,*) 'Ignoring -sd command line argument.'
END IF
END SUBROUTINE setStartingDensity
SUBROUTINE getMode(mode)
INTEGER, INTENT(OUT) :: mode
......
This diff is collapsed.
......@@ -31,7 +31,7 @@ CONTAINS
IF (ok) RETURN
!Test for environment variable as well
CALL GET_ENVIRONMENT_VARIABLE("juDFT",str,status=i)
IF (i==0) ok=INDEX(str,ADJUSTL(arg))>0
IF (i==0) ok=INDEX(str//' ',TRIM(ADJUSTL(arg))//' ')>0
END FUNCTION juDFT_was_argument
......
......@@ -1642,32 +1642,30 @@
COMPLEX(rkind),INTENT(OUT) ::DATA(:,:,:,:,:)
INTEGER(HID_T),INTENT(IN),OPTIONAL::trans
!locals
INTEGER::foffset(SIZE(start))
REAL,ALLOCATABLE::a(:,:,:,:,:),b(:,:,:,:,:)
ALLOCATE(A(SIZE(DATA,1),SIZE(DATA,2),SIZE(DATA,3),SIZE(DATA,4) &
& ,SIZE(DATA,5)),B(SIZE(DATA,1),SIZE(DATA,2),SIZE(DATA,3) &
& ,SIZE(DATA,4),SIZE(DATA,5)))
INTEGER::foffset(SIZE(start)),fncount(SIZE(start))
REAL,ALLOCATABLE::a(:,:,:,:,:,:)
!
foffset=start
fncount=ncount
!DO 2 calls to read real values
WHERE(start<0)
foffset=1
fncount=2
ENDWHERE
IF (PRESENT(trans)) THEN
CALL io_read_real5(did,foffset,ncount,a,trans)
ELSE
CALL io_read_real5(did,foffset,ncount,a)
ENDIF
WHERE(start<0)
foffset=2
ENDWHERE
IF (PRESENT(trans)) THEN
CALL io_read_real5(did,foffset,ncount,b,trans)
ELSE
CALL io_read_real5(did,foffset,ncount,b)
ENDIF
DATA=CMPLX(a,b)
DEALLOCATE(a,b)
if (count(start<0)/=1) CPP_error("Wrong no of negatives")
if (start(1)<0) then
ALLOCATE(A(2,SIZE(DATA,1),size(data,2),size(data,3),size(data,4),size(data,5)))
CALL io_read_real6(did,foffset,fncount,a,trans)
DATA=CMPLX(a(1,:,:,:,:,:),a(2,:,:,:,:,:))
else if (start(6)<0) then
ALLOCATE(A(SIZE(DATA,1),size(data,2),size(data,3),size(data,4),size(data,5),2))
CALL io_read_real6(did,foffset,fncount,a,trans)
DATA=CMPLX(a(:,:,:,:,:,1),a(:,:,:,:,:,2))
else
CPP_error("Wrong position of negative")
endif
DEALLOCATE(a)
END SUBROUTINE
SUBROUTINE io_write_complex0(did,start,ncount,DATA,trans)
!*****************************************************************
......@@ -1784,26 +1782,20 @@
INTEGER(HID_T),INTENT(IN),OPTIONAL::trans
!locals
INTEGER::foffset(SIZE(start)),fncount(SIZE(start))
real::a(2,size(data,1),size(data,2),size(data,3),size(data,4))
a(1,:,:,:,:)=real(data)
a(2,:,:,:,:)=aimag(data)
fncount=ncount
!
foffset=start
!DO 2 calls to read real values
WHERE(start<0)
foffset=1
fncount=2
ENDWHERE
IF (PRESENT(trans)) THEN
CALL io_write_real4(did,foffset,ncount,REAL(DATA),trans)
ELSE
CALL io_write_real4(did,foffset,ncount,REAL(DATA))
ENDIF
WHERE(start<0)
foffset=2
ENDWHERE
IF (PRESENT(trans)) THEN
CALL io_write_real4(did,foffset,ncount,AIMAG(DATA),trans)
ELSE
CALL io_write_real4(did,foffset,ncount,AIMAG(DATA))
ENDIF
CALL io_write_real5(did,foffset,fncount,a,trans)
END SUBROUTINE
SUBROUTINE io_write_complex5(did,start,ncount,DATA,trans)
!*****************************************************************
......@@ -1817,26 +1809,20 @@
INTEGER(HID_T),INTENT(IN),OPTIONAL::trans
!locals
INTEGER::foffset(SIZE(start)),fncount(SIZE(start))
real::a(2,size(data,1),size(data,2),size(data,3),size(data,4),size(data,5))
a(1,:,:,:,:,:)=real(data)
a(2,:,:,:,:,:)=aimag(data)
fncount=ncount
!
foffset=start
!DO 2 calls to read real values
WHERE(start<0)
foffset=1
fncount=2
ENDWHERE
IF (PRESENT(trans)) THEN
CALL io_write_real5(did,foffset,ncount,REAL(DATA),trans)
ELSE
CALL io_write_real5(did,foffset,ncount,REAL(DATA))
ENDIF
WHERE(start<0)
foffset=2
ENDWHERE
IF (PRESENT(trans)) THEN
CALL io_write_real5(did,foffset,ncount,AIMAG(DATA),trans)
ELSE
CALL io_write_real5(did,foffset,ncount,AIMAG(DATA))
ENDIF
CALL io_write_real6(did,foffset,fncount,a,trans)
END SUBROUTINE
!>
......
......@@ -26,6 +26,7 @@
USE m_xmlOutput
USE m_winpXML
USE m_setupMPI
USE m_cdn_io
#ifdef CPP_MPI
USE m_mpi_bc_all, ONLY : mpi_bc_all
#endif
......@@ -488,6 +489,10 @@
!Finalize the MPI setup
CALL setupMPI(kpts%nkpt,mpi)
IF (mpi%irank.EQ.0) THEN
CALL setStartingDensity(noco%l_noco)
END IF
!new check mode will only run the init-part of FLEUR
IF (judft_was_argument("-check")) CALL judft_end("Check-mode done",mpi%irank)
......
......@@ -7,10 +7,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -7,10 +7,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -7,10 +7,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -7,10 +7,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -9,10 +9,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -9,10 +9,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -9,7 +9,7 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
......@@ -21,4 +21,3 @@ $result+=jt::test_grepnumber("$workdir/out","mm 2",".*mm 2 *([^ ]*)"
jt::stageresult($workdir,$result,"1");
......@@ -10,7 +10,7 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
......@@ -22,4 +22,3 @@ $result+=jt::test_grepnumber("$workdir/out","mm 2",".*mm 2 *([^ ]*)"
jt::stageresult($workdir,$result,"1");
......@@ -8,10 +8,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
......@@ -7,10 +7,9 @@ jt::testrun($executable,$workdir);
#now test output
$result=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/cdn1");
$result+=min(jt::test_fileexists("$workdir/cdn1"),jt::test_fileexists("$workdir/cdn.hdf"));
$result+=jt::test_grepexists("$workdir/out","total charge");
$result+=jt::test_grepnumber("$workdir/out","qfix","qfix= *([^ ]*)",1.0,0.00001);
jt::stageresult($workdir,$result,"1");
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