X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=source%2Funres%2Fsrc-HCD-5D%2Fsearch.f;h=b3adbbd49c30d1a88d855da6d25ebc1814c8440a;hb=c711143ad3fffb04d27b55aa823f399b8343c4c5;hp=547051840cf6de26d09649711b7eef8165dda917;hpb=76ef494efde78d2d85d0e72d936c13166961256c;p=unres.git diff --git a/source/unres/src-HCD-5D/search.f b/source/unres/src-HCD-5D/search.f index 5470518..b3adbbd 100644 --- a/source/unres/src-HCD-5D/search.f +++ b/source/unres/src-HCD-5D/search.f @@ -158,7 +158,19 @@ c c get new function and projected gradient following a step c ncalls = ncalls + 1 +c 3/14/2020 Adam Liwo: added the condition to prevent from infinite +c iteration loop + if (ncalls.gt.200) then + do i = 1, nvar + x(i) = x_0(i) + end do + f_b=f_a + deallocate (x_0) + deallocate (s) + return + endif f_b = fgvalue (x,g) +c write (2,*) "ncalls",ncalls," f_a",f_a," f_b",f_b," sg_a",sg_a sg_b = 0.0d0 do i = 1, nvar sg_b = sg_b + s(i)*g(i)