mirror of https://gitlab.com/QEF/q-e.git
bfgs algorithm modified so that if the history is reset twice, it stops
after issuing an explanatory message rather than crashing. git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@7770 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
5f700de0c6
commit
51d1741bd8
|
@ -92,11 +92,10 @@ MODULE bfgs_module
|
||||||
INTEGER :: &
|
INTEGER :: &
|
||||||
scf_iter, &! number of scf iterations
|
scf_iter, &! number of scf iterations
|
||||||
bfgs_iter, &! number of bfgs iterations
|
bfgs_iter, &! number of bfgs iterations
|
||||||
gdiis_iter ! number of gdiis iterations
|
gdiis_iter, &! number of gdiis iterations
|
||||||
!
|
tr_min_hit = 0 ! set to 1 if the trust_radius has already been
|
||||||
LOGICAL :: &
|
! set to the minimum value at the previous step
|
||||||
tr_min_hit ! .TRUE. if the trust_radius has already been
|
! set to 2 if trust_radius is reset again: exit
|
||||||
! set to the minimum value at the previous step
|
|
||||||
LOGICAL :: &
|
LOGICAL :: &
|
||||||
conv_bfgs ! .TRUE. when bfgs convergence has been achieved
|
conv_bfgs ! .TRUE. when bfgs convergence has been achieved
|
||||||
!
|
!
|
||||||
|
@ -247,7 +246,7 @@ CONTAINS
|
||||||
#endif
|
#endif
|
||||||
END IF
|
END IF
|
||||||
!
|
!
|
||||||
stop_bfgs = conv_bfgs .OR. ( scf_iter >= nstep )
|
stop_bfgs = conv_bfgs .OR. ( scf_iter >= nstep ) .OR. ( tr_min_hit > 1 )
|
||||||
!
|
!
|
||||||
! ... quick return if possible
|
! ... quick return if possible
|
||||||
!
|
!
|
||||||
|
@ -314,10 +313,16 @@ CONTAINS
|
||||||
FMT = '(/,5X,"trust_radius < trust_radius_min")' )
|
FMT = '(/,5X,"trust_radius < trust_radius_min")' )
|
||||||
WRITE( UNIT = stdout, FMT = '(/,5X,"resetting bfgs history",/)' )
|
WRITE( UNIT = stdout, FMT = '(/,5X,"resetting bfgs history",/)' )
|
||||||
!
|
!
|
||||||
! ... if tr_min_hit the history has already been reset at the
|
! ... if tr_min_hit=1 the history has already been reset at the
|
||||||
! ... previous step : something is going wrong
|
! ... previous step : something is going wrong
|
||||||
IF ( tr_min_hit ) CALL errore( 'bfgs', &
|
!
|
||||||
'bfgs history already reset at previous step', 1 )
|
IF ( tr_min_hit == 1 ) THEN
|
||||||
|
CALL infomsg( 'bfgs', &
|
||||||
|
'history already reset at previous step: stopping' )
|
||||||
|
tr_min_hit = 2
|
||||||
|
ELSE
|
||||||
|
tr_min_hit = 1
|
||||||
|
END IF
|
||||||
!
|
!
|
||||||
CALL reset_bfgs( n )
|
CALL reset_bfgs( n )
|
||||||
!
|
!
|
||||||
|
@ -328,11 +333,9 @@ CONTAINS
|
||||||
!
|
!
|
||||||
trust_radius = min(trust_radius_ini, nr_step_length)
|
trust_radius = min(trust_radius_ini, nr_step_length)
|
||||||
!
|
!
|
||||||
tr_min_hit = .TRUE.
|
|
||||||
!
|
|
||||||
ELSE
|
ELSE
|
||||||
!
|
!
|
||||||
tr_min_hit = .FALSE.
|
tr_min_hit = 0
|
||||||
!
|
!
|
||||||
END IF
|
END IF
|
||||||
!
|
!
|
||||||
|
@ -395,8 +398,7 @@ CONTAINS
|
||||||
IF ( bfgs_iter == 1 ) THEN
|
IF ( bfgs_iter == 1 ) THEN
|
||||||
!
|
!
|
||||||
trust_radius = min(trust_radius_ini, nr_step_length)
|
trust_radius = min(trust_radius_ini, nr_step_length)
|
||||||
!
|
tr_min_hit = 0
|
||||||
tr_min_hit = .FALSE.
|
|
||||||
!
|
!
|
||||||
ELSE
|
ELSE
|
||||||
!
|
!
|
||||||
|
@ -631,7 +633,7 @@ CONTAINS
|
||||||
pos_old(:,:) = 0.0_DP
|
pos_old(:,:) = 0.0_DP
|
||||||
grad_old(:,:) = 0.0_DP
|
grad_old(:,:) = 0.0_DP
|
||||||
!
|
!
|
||||||
tr_min_hit = .FALSE.
|
tr_min_hit = 0
|
||||||
!
|
!
|
||||||
END IF
|
END IF
|
||||||
!
|
!
|
||||||
|
@ -828,8 +830,14 @@ CONTAINS
|
||||||
!
|
!
|
||||||
! ... if tr_min_hit the history has already been reset at the
|
! ... if tr_min_hit the history has already been reset at the
|
||||||
! ... previous step : something is going wrong
|
! ... previous step : something is going wrong
|
||||||
IF ( tr_min_hit ) CALL errore( 'bfgs', &
|
!
|
||||||
'bfgs history already reset at previous step', 1 )
|
IF ( tr_min_hit == 1 ) THEN
|
||||||
|
CALL infomsg( 'bfgs', &
|
||||||
|
'history already reset at previous step: stopping' )
|
||||||
|
tr_min_hit = 2
|
||||||
|
ELSE
|
||||||
|
tr_min_hit = 1
|
||||||
|
END IF
|
||||||
!
|
!
|
||||||
WRITE( UNIT = stdout, &
|
WRITE( UNIT = stdout, &
|
||||||
FMT = '(5X,"small trust_radius: resetting bfgs history",/)' )
|
FMT = '(5X,"small trust_radius: resetting bfgs history",/)' )
|
||||||
|
@ -842,11 +850,9 @@ CONTAINS
|
||||||
!
|
!
|
||||||
trust_radius = min(trust_radius_min, nr_step_length )
|
trust_radius = min(trust_radius_min, nr_step_length )
|
||||||
!
|
!
|
||||||
tr_min_hit = .TRUE.
|
|
||||||
!
|
|
||||||
ELSE
|
ELSE
|
||||||
!
|
!
|
||||||
tr_min_hit = .FALSE.
|
tr_min_hit = 0
|
||||||
!
|
!
|
||||||
END IF
|
END IF
|
||||||
!
|
!
|
||||||
|
|
Loading…
Reference in New Issue