Minor modificaions. C.S.

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@1980 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
sbraccia 2005-06-27 20:24:24 +00:00
parent 504a2945a1
commit 051e0659ce
1 changed files with 8 additions and 18 deletions

View File

@ -148,9 +148,7 @@ MODULE bfgs_module
dim = SIZE( pos )
!
! ... conditional work-space allocation
!
!
IF ( .NOT. ALLOCATED( grad_old ) ) ALLOCATE( grad_old( dim, bfgs_ndim ) )
IF ( .NOT. ALLOCATED( pos_old ) ) ALLOCATE( pos_old( dim, bfgs_ndim ) )
!
@ -176,15 +174,9 @@ MODULE bfgs_module
!
! ... convergence is checked here
!
conv_bfgs = ( energy_error < energy_thr )
!
DO i = 1, dim
!
conv_bfgs = ( conv_bfgs .AND. ( ABS( grad(i) ) < grad_thr ) )
!
grad_error = MAX( grad_error, ABS( grad(i) ) )
!
END DO
grad_error = MAXVAL( ABS( grad(:) ) )
conv_bfgs = energy_error < energy_thr
conv_bfgs = conv_bfgs .AND. ( grad_error < grad_thr )
!
IF ( conv_bfgs ) RETURN
!
@ -458,8 +450,6 @@ MODULE bfgs_module
!
END SUBROUTINE bfgs
!
! ... private methods :
!
!------------------------------------------------------------------------
SUBROUTINE read_bfgs_file( pos, grad, energy, scratch, dim, stdout )
!------------------------------------------------------------------------
@ -496,14 +486,16 @@ MODULE bfgs_module
READ( iunbfgs, * ) scf_iter
READ( iunbfgs, * ) bfgs_iter
READ( iunbfgs, * ) energy_p
READ( iunbfgs, * ) step_old
READ( iunbfgs, * ) trust_radius_old
READ( iunbfgs, * ) pos_old
READ( iunbfgs, * ) grad_old
READ( iunbfgs, * ) inv_hess
!
CLOSE( UNIT = iunbfgs )
!
trust_radius_old = norm( pos(:) - pos_p(:) )
!
step_old = ( pos(:) - pos_p(:) ) / trust_radius_old
!
ELSE
!
! ... bfgs initialization
@ -573,8 +565,6 @@ MODULE bfgs_module
WRITE( iunbfgs, * ) scf_iter
WRITE( iunbfgs, * ) bfgs_iter
WRITE( iunbfgs, * ) energy
WRITE( iunbfgs, * ) step
WRITE( iunbfgs, * ) trust_radius
WRITE( iunbfgs, * ) pos_old
WRITE( iunbfgs, * ) grad_old
WRITE( iunbfgs, * ) inv_hess