Skip to content

Commit

Permalink
improves the findnodes.f90
Browse files Browse the repository at this point in the history
  • Loading branch information
quanshengwu committed Jul 22, 2018
1 parent 3815e9a commit 02191e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions soc/proteus.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ subroutine Proteus(ndim, k,gap,ptol,func_gap,iter)
! parameters space
! Ref: Nelder, J.A., and Mead, R. 1965, Computer Journal, vol. 7, pp. 308–313. [1]

use para, only : dp, cpuid, stdout
use para, only : dp, cpuid, stdout, eps9
implicit none

integer, intent(in) :: ndim ! number of parameters
Expand All @@ -25,7 +25,7 @@ function func_gap(n, x)
end function func_gap
end interface

integer, parameter :: itmax=1000 ! maximum iterations
integer, parameter :: itmax=500 ! maximum iterations
real(dp), parameter :: tiny=1.0e-10
integer :: iworst
real(dp), dimension(size(k,2)) :: ksum
Expand Down Expand Up @@ -59,7 +59,7 @@ subroutine Proteus_0
! satisfactory.
! If returning, put best point and value in slot 1.
rtol=2.0_dp*abs(gap(iworst)-gap(ibest))/(abs(gap(iworst))+abs(gap(ibest))+tiny)
if (rtol < ptol) then
if (rtol < ptol.or.gap(ibest)<eps9) then
call swap1(gap(1),gap(ibest))
call swap2(k(1,:),k(ibest,:))
call printkgap(k, gap)
Expand Down

0 comments on commit 02191e7

Please sign in to comment.