424
424
! Do options so that a pulay option may refer to
425
425
! the actual names of the constants
426
427
if ( m%m == MIX_PULAY ) then
428
! The linear mixing weight
429
if ( leqi(opt,'weight.linear') &
430
.or. leqi(opt,'w.linear') ) then
432
m%rv(1) = fdf_breals(pline,1)
434
else if ( leqi(opt,'svd.cond') ) then
436
! This is only applicable to the Pulay
439
m%rv(I_SVD_COND) = fdf_bvalues(pline,1)
428
if ( leqi(opt,'weight.linear') &
429
.or. leqi(opt,'w.linear') ) then
431
m%rv(1) = fdf_breals(pline,1)
432
if ( m%rv(1) <= 0._dp .or. 1._dp < m%rv(1) ) then
433
call die("m_mixing: Mixing weight should be 0 < weight <= 1")
436
else if ( leqi(opt,'svd.cond') ) then
437
m%rv(I_SVD_COND) = fdf_bvalues(pline,1)
440
else if ( m%m == MIX_BROYDEN ) then
442
! The linear mixing weight
443
if ( leqi(opt,'weight.linear') &
444
.or. leqi(opt,'w.linear') ) then
446
m%rv(1) = fdf_breals(pline,1)
447
if ( m%rv(1) <= 0._dp .or. 1._dp < m%rv(1) ) then
448
call die("m_mixing: Linear mixing weight should be 0 < weight <= 1")
451
else if ( leqi(opt,'weight.prime') &
452
.or. leqi(opt,'w.prime') ) then
454
m%rv(2) = fdf_breals(pline,1)
455
if ( m%rv(2) < 0._dp .or. 1._dp < m%rv(2) ) then
456
call die("m_mixing: Prime weight should be 0 <= weight <= 1")
459
else if ( leqi(opt,'svd.cond') ) then
461
m%rv(I_SVD_COND) = fdf_bvalues(pline,1)
446
467
! Generic options for all advanced methods...
447
468
if ( leqi(opt,'next.p') ) then
473
494
type(tMixer), intent(inout) :: mix
497
if ( mix%w <= 0._dp .or. 1._dp < mix%w ) then
498
call die("m_mixing: Mixing weight should be: 0 < weight <= 1")
476
501
! Correct amount of history in the mixing.
477
502
if ( 0 < mix%restart .and. &
478
503
mix%restart < mix%n_hist ) then
795
820
write(*,'(2a,t50,''= '',i0)') trim(fmt), &
796
821
' History steps',m%n_hist
797
822
write(*,'(2a,t50,''= '',f12.6)') trim(fmt), &
798
' Jacobian weight',m%w
799
write(*,'(2a,t50,''= '',f12.6)') trim(fmt), &
800
' Weight prime',m%rv(1)
823
' Linear mixing weight',m%rv(1)
824
write(*,'(2a,t50,''= '',f12.6)') trim(fmt), &
825
' Inverse Jacobian weight',m%w
826
write(*,'(2a,t50,''= '',f12.6)') trim(fmt), &
827
' Weight prime',m%rv(2)
828
write(*,'(2a,t50,''= '',e10.4)') trim(fmt), &
829
' SVD condition',m%rv(I_SVD_COND)
801
830
if ( m%rv(I_P_NEXT) > 0._dp ) then
802
831
write(*,'(2a,t50,''= '',f6.4)') trim(fmt), &
803
832
' Step mixer parameter',m%rv(I_P_NEXT)
921
950
! For Broyden this is the inverse Jacobian
922
951
write(*,'(t3,a,f6.4)') 'weight ', m%w
923
952
select case ( m%m )
924
case ( MIX_PULAY, MIX_BROYDEN )
925
write(*,'(t3,a,f6.4)') 'weight.linear ', m%rv(1)
954
write(*,'(t3,a,f6.4)') 'weight.linear ', m%rv(1)
956
write(*,'(t3,a,f6.4)') 'weight.linear ', m%rv(1)
957
write(*,'(t3,a,f6.4)') 'weight.prime ', m%rv(2)
928
960
if ( m%n_hist > 0 ) then
1780
1812
! Add the diagonal term
1781
1813
! This should also prevent it from being
1782
! singular (unless mix%w == 0)
1814
! singular (unless mix%rv(2) == 0)
1784
A(i,i) = mix%rv(1) ** 2 + A(i,i)
1816
A(i,i) = mix%rv(2) ** 2 + A(i,i)
1787
1819
! Calculate the inverse
2079
2111
! Fix the action to finalize it..
2080
if ( mix%restart > 0 .and. &
2081
mod(current_itt(mix),mix%restart) == 0 ) then
2083
mix%action = IOR(mix%action, ACTION_RESTART)
2112
if ( mix%restart > 0 ) then
2113
if ( mod(current_itt(mix),mix%restart) == 0 ) then
2114
mix%action = IOR(mix%action, ACTION_RESTART)