SUBROUTINE findext(r, v0, v1, v2, r1, vl, r2, vr, jval, mu, ichanl) USE Numeric_Kinds_Module !----------------------------------------------------------------------- !this subroutine determines when the bounds have become sufficiently close !to determine and accurate value of the location of the maximum/minimum !----------------------------------------------------------------------- IMPLICIT none INTEGER jval, ichanl REAL(dp), PARAMETER:: tol=1.d-15 REAL(dp) r, r1, vl, r2, vr, delta, v0, v1, v2, mu LOGICAL, PARAMETER:: idbug=.false. vl=vl !delete? vr=vr !delete? r=(r1+r2)/2.d0 !calculate avg. of the bounds delta=ABS(r1-r2)/r !calculate relative difference of the bounds CALL pot(r, v0, v1, v2, jval,mu,ichanl) !determine potential at avg. DO WHILE(delta.gt.tol) !do while bounds are too broad CALL Bisect(r, v1, r1, vl, r2, vr, delta) !Bisect determines if the lower bound should be increased or if the upper bound should be decreased CALL pot(r, v0, v1, v2, jval,mu,ichanl) ENDDO r=(r1+r2)/2.d0 !calculate avg. of new bounds CALL pot(r, v0, v1, v2, jval,mu,ichanl) !determine potential at this r value RETURN END SUBROUTINE FindExt