      subroutine rk4ord(y,n,x,h,derivs,nd)
!
!     rk4
!
      implicit real *8 (a-h,o-z)
      parameter (nd3=100)
      dimension y(nd),dydx(nd3),yt(nd3),dyt(nd3),dym(nd3)
      external derivs
      hh=h*.5
      h6=h/6
      xh=x+hh
	  call derivs(n,x,y,dydx,nd)
      do 11 i=1,n
         yt(i)=y(i)+hh*dydx(i)
 11   continue
      call derivs(n,xh,yt,dyt,nd)
      do 12 i=1,n
         yt(i)=y(i)+hh*dyt(i)
 12   continue
      call derivs(n,xh,yt,dym,nd)
      do 13 i=1,n
         yt(i)=y(i)+h*dym(i)
         dym(i)=dyt(i)+dym(i)
 13   continue
      call derivs(n,x+h,yt,dyt,nd)
      do 14 i=1,n
         y(i)=y(i)+h6*(dydx(i)+dyt(i)+2*dym(i))
 14   continue
      return
      end
