Commit 553d83d7 authored by Daniel Wortmann's avatar Daniel Wortmann

Merge branch 'develop' of iffgit.fz-juelich.de:fleur/fleur into develop

parents ecd5cf30 11335f9f
......@@ -427,7 +427,7 @@
IF (kpts%specificationType.EQ.4) THEN
DO i = 1, 3
IF (kpts%kPointDensity(i).LE.0.0) THEN
CALL juDFT_error('Error: Nonpositive kpointDensity provided', calledby = 'kpoints')
CALL juDFT_error('Error: Nonpositive kpointDensity provided', calledby = 'set_inp')
END IF
recVecLength = SQRT(cell%bmat(i,1)**2 + cell%bmat(i,2)**2 + cell%bmat(i,3)**2)
kpts%nkpt3(i) = CEILING(kpts%kPointDensity(i) * recVecLength)
......@@ -502,9 +502,6 @@
IF (ANY(kpts%nkpt3(:).NE.0)) THEN
DO i = 1, 3
IF (kpts%kPointDensity(i).LE.0.0) THEN
CALL juDFT_error('Error: Nonpositive kpointDensity provided', calledby = 'kpoints')
END IF
recVecLength = SQRT(cell%bmat(i,1)**2 + cell%bmat(i,2)**2 + cell%bmat(i,3)**2)
kPointDen(i) = kpts%nkpt3(i) / recVecLength
END DO
......
......@@ -223,7 +223,7 @@ SUBROUTINE readDeltaNVec(input,hybrid,vecLen,relIter,currentIter,deltaNVec)
INTEGER, INTENT(IN) :: vecLen, relIter, currentIter
REAL, INTENT(OUT) :: deltaNVec(vecLen)
INTEGER :: mode, npos
INTEGER :: mode, npos, iter
INTEGER*8 :: recLen
CALL getIOMode(mode)
......@@ -240,8 +240,11 @@ SUBROUTINE readDeltaNVec(input,hybrid,vecLen,relIter,currentIter,deltaNVec)
recl=recLen,form='unformatted',status='unknown')
ENDIF
npos=currentIter+relIter-1
IF (currentIter.GT.input%maxiter+1) npos = MOD(currentIter-2,input%maxiter)+1
iter = currentIter+relIter
npos=iter-1
IF (iter.GT.1) npos = MOD(iter-2,input%maxiter)+1
! WRITE(1400,*) 'readDeltaNVec: iter,npos: ', iter, npos
READ(59,rec=npos) deltaNVec(:vecLen)
......@@ -274,7 +277,9 @@ SUBROUTINE writeDeltaNVec(input,hybrid,vecLen,currentIter,deltaNVec)
ENDIF
npos=currentIter-1
IF (currentIter.GT.input%maxiter+1) npos = MOD(currentIter-2,input%maxiter)+1
IF (currentIter.GT.1) npos = MOD(currentIter-2,input%maxiter)+1
! WRITE(1500,*) 'writeDeltaNVec: iter,npos: ', currentIter, npos
WRITE(59,rec=npos) deltaNVec(:vecLen)
......@@ -289,7 +294,7 @@ SUBROUTINE readDeltaFVec(input,hybrid,vecLen,relIter,currentIter,deltaFVec)
INTEGER, INTENT(IN) :: vecLen, relIter, currentIter
REAL, INTENT(OUT) :: deltaFVec(vecLen)
INTEGER :: mode, npos
INTEGER :: mode, npos, iter
INTEGER*8 :: recLen
CALL getIOMode(mode)
......@@ -306,8 +311,11 @@ SUBROUTINE readDeltaFVec(input,hybrid,vecLen,relIter,currentIter,deltaFVec)
recl=recLen,form='unformatted',status='unknown')
ENDIF
npos=currentIter+relIter-1
IF (currentIter.GT.input%maxiter+1) npos = MOD(currentIter-2,input%maxiter)+1
iter = currentIter+relIter
npos=iter-1
IF (iter.GT.1) npos = MOD(iter-2,input%maxiter)+1
! WRITE(1400,*) 'readDeltaFVec: iter,npos: ', iter, npos
READ(59,rec=npos) deltaFVec(:vecLen)
......@@ -340,7 +348,9 @@ SUBROUTINE writeDeltaFVec(input,hybrid,vecLen,currentIter,deltaFVec)
ENDIF
npos=currentIter-1
IF (currentIter.GT.input%maxiter+1) npos = MOD(currentIter-2,input%maxiter)+1
IF (currentIter.GT.1) npos = MOD(currentIter-2,input%maxiter)+1
! WRITE(1500,*) 'writeDeltaFVec: iter,npos: ', currentIter, npos
WRITE(59,rec=npos) deltaFVec(:vecLen)
......@@ -374,7 +384,9 @@ SUBROUTINE writeBroydenOverlapExt(input,hybrid,currentIter,historyLength,&
ENDIF
npos=currentIter-1
IF (currentIter.GT.input%maxiter+1) npos = MOD(currentIter-2,input%maxiter)+1
IF (currentIter.GT.1) npos = MOD(currentIter-2,input%maxiter)+1
! WRITE(1500,*) 'writeBroydenOverlapExt: iter, npos: ', currentIter, npos
WRITE(59,rec=npos) currentIter, historyLength,&
dNdNLast(:input%maxIter), dFdFLast(:input%maxIter), &
......@@ -424,7 +436,9 @@ SUBROUTINE readBroydenOverlaps(input,hybrid,currentIter,historyLength,&
iter = currentIter - historyLength + i
npos=iter-1
IF (iter.GT.input%maxiter+1) npos = MOD(iter-2,input%maxiter)+1
IF (iter.GT.1) npos = MOD(iter-2,input%maxiter)+1
! WRITE(1400,*) 'readBroydenOverlaps: iter,npos: ', iter, npos
READ(59,rec=npos) recIter, recHistLen,&
dNdNLast(:input%maxIter), dFdFLast(:input%maxIter), &
......@@ -471,6 +485,20 @@ SUBROUTINE resetBroydenHistory()
CALL system('rm '//TRIM(ADJUSTL(filename)))
END IF
END DO
INQUIRE(file='broydOvlp',exist=l_exist)
IF (l_exist) CALL system('rm broydOvlp')
INQUIRE(file='hf_broydOvlp',exist=l_exist)
IF (l_exist) CALL system('rm hf_broydOvlp')
INQUIRE(file='broyd_DF',exist=l_exist)
IF (l_exist) CALL system('rm broyd_DF')
INQUIRE(file='hf_broyd_DF',exist=l_exist)
IF (l_exist) CALL system('rm hf_broyd_DF')
INQUIRE(file='broyd_DN',exist=l_exist)
IF (l_exist) CALL system('rm broyd_DN')
INQUIRE(file='hf_broyd_DN',exist=l_exist)
IF (l_exist) CALL system('rm hf_broyd_DN')
END SUBROUTINE resetBroydenHistory
......@@ -503,4 +531,38 @@ LOGICAL FUNCTION initBroydenHistory(input,hybrid, vecLen)
END FUNCTION initBroydenHistory
LOGICAL FUNCTION initBroydenHistory2(input,hybrid, vecLen)
! Initializes a Broyden history
! returns true if there already exists a Broyden history
TYPE(t_input), INTENT(IN) :: input
TYPE(t_hybrid), INTENT(IN) :: hybrid
INTEGER, INTENT(IN) :: vecLen
INTEGER*8 :: recLen
LOGICAL :: l_exist
INQUIRE (file='broyd_DF',exist=l_exist)
recLen=(vecLen+1)*8
IF (hybrid%l_calhf) THEN
OPEN (59,file='hf_broyd_DF',access='direct',&
recl=recLen,form='unformatted',status='unknown')
OPEN (60,file='hf_broyd_DN',access='direct',&
recl=recLen,form='unformatted',status='unknown')
ELSE
OPEN (59,file='broyd_DF',access='direct',&
recl=recLen,form='unformatted',status='unknown')
OPEN (60,file='broyd_DN',access='direct',&
recl=recLen,form='unformatted',status='unknown')
ENDIF
CLOSE(59)
CLOSE(60)
initBroydenHistory2 = l_exist
END FUNCTION initBroydenHistory2
END MODULE m_broyd_io
......@@ -160,17 +160,17 @@ SUBROUTINE mix(stars,atoms,sphhar,vacuum,input,sym,cell,noco,oneD,&
IF (input%imix.EQ.0) THEN
CALL stmix(atoms,input,noco, nmap,nmaph,fsm, sm)
ELSE
CALL broyden(cell,stars,atoms,vacuum,sphhar,input,noco,oneD,sym,&
hybrid,mmap,nmaph,mapmt,mapvac2,nmap,fsm,sm)
! CALL broyden(cell,stars,atoms,vacuum,sphhar,input,noco,oneD,sym,&
! hybrid,mmap,nmaph,mapmt,mapvac2,nmap,fsm,sm)
! Replace the broyden call above by the commented metric and broyden2 calls
! below to switch on the continuous restart of the Broyden method.
! ! Apply metric w to sm and store in smMet: w |sm>
! CALL metric(cell,atoms,vacuum,sphhar,input,noco,stars,sym,oneD,&
! mmap,nmaph,mapmt,mapvac2,sm,smMet,l_pot)
!
! CALL broyden2(cell,stars,atoms,vacuum,sphhar,input,noco,oneD,sym,&
! hybrid,mmap,nmaph,mapmt,mapvac2,nmap,fsm,sm,fmMet,smMet)
! Apply metric w to sm and store in smMet: w |sm>
CALL metric(cell,atoms,vacuum,sphhar,input,noco,stars,sym,oneD,&
mmap,nmaph,mapmt,mapvac2,sm,smMet,l_pot)
CALL broyden2(cell,stars,atoms,vacuum,sphhar,input,noco,oneD,sym,&
hybrid,mmap,nmaph,mapmt,mapvac2,nmap,fsm,sm,fmMet,smMet)
END IF
!initiatlize mixed density and extract it with brysh2 call
......
......@@ -103,7 +103,7 @@ CONTAINS
dFMet = 0.0
mit = 0
l_exist = initBroydenHistory(input,hybrid,nmap) ! returns true if there already exists a Broyden history
l_exist = initBroydenHistory2(input,hybrid,nmap) ! returns true if there already exists a Broyden history
IF(.NOT.l_exist) mit = 1
IF (mit.NE.1) THEN
......@@ -128,7 +128,6 @@ CONTAINS
! save F_m and rho_m for next iteration
nit = mit +1
IF (nit > input%maxiter+1) nit = 1
CALL writeLastIterInAndDiffDen(hybrid,nmap,nit,input%alpha,sm,fm,smMet,fmMet)
IF (mit.EQ.1) THEN
......@@ -151,7 +150,7 @@ CONTAINS
! Extend overlap matrices <delta n(i) | delta n(j)>, <delta F(i) | delta F(j)>,
! <delta n(i) | delta F(j)>, <delta F(i) | delta n(j)> -start-
iread = MIN(mit-1,input%maxiter+1)
iread = MIN(mit-1,input%maxiter)
historyLength = iread
dNdNLast = 0.0
......@@ -159,9 +158,18 @@ CONTAINS
dNdFLast = 0.0
dFdNLast = 0.0
! WRITE(1400,*) '========================================'
! WRITE(1400,*) '========================================'
! WRITE(1400,*) '========================================'
! WRITE(1400,*) 'mit: ', mit
! WRITE(1400,*) 'iread, historyLength: ', iread, historyLength
DO it = 2, iread
CALL readDeltaNVec(input,hybrid,nmap,it-mit,mit,deltaN_i)
CALL readDeltaFVec(input,hybrid,nmap,it-mit,mit,deltaF_i)
CALL readDeltaNVec(input,hybrid,nmap,it-iread-1,mit,deltaN_i)
CALL readDeltaFVec(input,hybrid,nmap,it-iread-1,mit,deltaF_i)
! WRITE(1400,'(4i7)') it,mit,it-iread-1,mit+(it-iread-1)
! WRITE(1400,'(a,5f15.8)') 'deltaN_i: ', deltaN_i(1), deltaN_i(2), deltaN_i(3), deltaN_i(4), deltaN_i(5)
! WRITE(1400,'(a,5f15.8)') 'deltaF_i: ', deltaF_i(1), deltaF_i(2), deltaF_i(3), deltaF_i(4), deltaF_i(5)
dNdNLast(it-1) = CPP_BLAS_sdot(nmap,deltaN_i,1,dNMet,1)
dFdFLast(it-1) = CPP_BLAS_sdot(nmap,deltaF_i,1,dFMet,1)
......@@ -174,6 +182,11 @@ CONTAINS
dNdFLast(historyLength) = CPP_BLAS_sdot(nmap,dNVec,1,dFMet,1)
dFdNLast(historyLength) = CPP_BLAS_sdot(nmap,dFVec,1,dNMet,1)
! WRITE(1400,*) 'last overlaps:'
! DO i = 1, historyLength
! WRITE(1400,'(i7,4f20.13)') i,dNdNLast(i),dFdFLast(i),dNdFLast(i),dFdNLast(i)
! END DO
CALL writeBroydenOverlapExt(input,hybrid,mit,historyLength,&
dNdNLast,dFdFLast,dNdFLast,dFdNLast)
......@@ -185,6 +198,14 @@ CONTAINS
CALL readBroydenOverlaps(input,hybrid,mit,historyLength,&
dNdNMat,dFdFMat,dNdFMat,dFdNMat)
! WRITE(1400,*) 'all overlaps'
! DO i = 1, historyLength
! DO j = 1, historyLength
! WRITE(1400,'(2i7,4f20.13)') i,j,dNdNMat(j,i),dFdFMat(j,i),dNdFMat(j,i),dFdNMat(j,i)
! END DO
! END DO
! WRITE(1400,*) '-----------------------------'
! Extend overlap matrices <delta n(i) | delta n(j)>, <delta F(i) | delta F(j)>,
! <delta n(i) | delta F(j)>, <delta F(i) | delta n(j)> -end-
......@@ -326,8 +347,8 @@ CONTAINS
vVec = 0.0
DO it = 2, iread
CALL readDeltaNVec(input,hybrid,nmap,it-mit,mit,deltaN_i)
CALL readDeltaFVec(input,hybrid,nmap,it-mit,mit,deltaF_i)
CALL readDeltaNVec(input,hybrid,nmap,it-iread-1,mit,deltaN_i)
CALL readDeltaFVec(input,hybrid,nmap,it-iread-1,mit,deltaF_i)
DO k = 1, nmap
uVec(k) = uVec(k) + uDNTableau(it-1,historyLength)*deltaN_i(k)
......
......@@ -169,4 +169,23 @@ sub testresult($){
}
}
sub test_grep_error($){
my $file=shift;
my $error="juDFT-Error";
my $warning="juDFT-Warning";
print LOG "Checking for judft messages in $file:";
if (system("grep -q \"$error\" $file")==0){
my $message = `grep "Error message:" $file`;
print LOG "Found a juDFT-ERROR: $message\n";
return 1;
}elsif (system("grep -q \"$warning\" $file")==0){
print LOG "Found a juDFT-WARNING\n";
return 0;
}else{
print LOG "No error and no warning found\n";
return 0;
}
}
......@@ -2,10 +2,12 @@
jt::copyfile("files/inp_Si_para",$workdir);
jt::testrun("$executable < inp_Si_para",$workdir);
#jt::testrun("$executable < inp_Si_para",$workdir);
jt::testrun("$executable -explicit < inp_Si_para &>outshell ; cat outshell",$workdir);
$result=jt::test_grep_error("$workdir/outshell");
#now test output
$result=jt::test_fileexists("$workdir/inp.xml");
$result+=jt::test_fileexists("$workdir/inp.xml");
jt::stageresult($workdir,$result,"1");
......@@ -2,20 +2,22 @@
jt::copyfile("files/inp_Si_plain",$workdir);
jt::testrun("$executable < inp_Si_plain",$workdir);
#jt::testrun("$executable < inp_Si_plain &> outshell | cat outshell",$workdir);
jt::testrun("$executable < inp_Si_plain &>outshell ; cat outshell",$workdir);
$result=jt::test_grep_error("$workdir/outshell");
#now test if inp.xml file was produced and if it contains certain features.
$result=jt::test_fileexists("$workdir/inp.xml");
$result+=jt::test_grepexists("$workdir/inp.xml",'filename="sym.out"');
$result+=jt::test_grepexists("$workdir/inp.xml","relpos label=");
$result+=jt::test_fileexists("$workdir/inp.xml");
$result+=jt::test_grepexists("$workdir/inp.xml","sym.out");
$result+=jt::test_grepexists("$workdir/inp.xml","relPos label=");
#test interface, that all files are there. This lst should be complete
# notice there is per default no inp file also no kpts file and no enpara file
# also developers should be made aware if the interface is changed.
$result=jt::test_fileexists("$workdir/out");
$result=jt::test_fileexists("$workdir/FleurInputSchema.xsd");
$result=jt::test_fileexists("$workdir/struct.xcf");
$result=jt::test_fileexists("$workdir/sym.out");
$result+=jt::test_fileexists("$workdir/out");
$result+=jt::test_fileexists("$workdir/FleurInputSchema.xsd");
$result+=jt::test_fileexists("$workdir/sym.out");
jt::stageresult($workdir,$result,"1");
......@@ -2,10 +2,13 @@
jt::copyfile("files/inp_Si_plain",$workdir);
jt::testrun("$executable -explicit < inp_Si_plain",$workdir);
jt::testrun("$executable -explicit < inp_Si_plain &>outshell ; cat outshell",$workdir);
# test for errors and warnings
$result=jt::test_grep_error("$workdir/outshell");
#now test output
$result=jt::test_fileexists("$workdir/inp.xml");
$result+=jt::test_fileexists("$workdir/inp.xml");
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