update new files
[unres.git] / source / maxlik / src_FPy / rmysort.f
1       subroutine rmysort(n, x, ipermut)
2       implicit none
3       integer n
4       double precision x(n),xtemp
5       integer ipermut(n)
6       integer i,j,imax,ipm
7       do i=1,n
8         xtemp=x(i)
9         imax=i
10         do j=i+1,n
11           if (x(ipermut(j)).lt.xtemp) then
12             imax=j
13             xtemp=x(ipermut(j))
14           endif
15         enddo
16         ipm=ipermut(imax)
17         ipermut(imax)=ipermut(i)
18         ipermut(i)=ipm
19       enddo
20       return
21       end