Commit 934a05e9 authored by Gregor Michalicek's avatar Gregor Michalicek

Broyden IO adaptions to the broyden2 subroutine + activation of broyden2 as default

parent 419c2d58
......@@ -471,6 +471,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 +517,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
......
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