Added a check to avoid the possibility of an infinite loop.

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@5499 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
dalcorso 2009-04-03 09:28:54 +00:00
parent 1114664827
commit a9ca72c570
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,7 @@ subroutine find_qi(logderae,xc,ik,lam,ncn,flag,iok)
integer :: &
nc, & ! counter on the q found
icount, & ! too many iterations
imax,& ! maximum number of iteration to braket
iq ! counter on iteration
@ -70,6 +71,7 @@ subroutine find_qi(logderae,xc,ik,lam,ncn,flag,iok)
logdermax=compute_log(j1,grid%r(ik),grid%dx)-logderae
jlmax = j1(4)
icount=0
do nc=1,ncn
!
! bracket the zero
@ -133,6 +135,8 @@ subroutine find_qi(logderae,xc,ik,lam,ncn,flag,iok)
!
! check for convergence
!
icount=icount+1
if (icount>1000) call errore('find_q','too many iterations',1)
if (abs(logdermax-logdermin).gt.1.e-8_dp) goto 100
enddo