%
%	ode_rk.m:  runge-kutta timestep
%
%
function [rkZn,rktn] = ode_rk(rkZ,rkt,rkDt,par)

k1 = rkDt*deriv(rkZ       ,rkt         ,par);
k2 = rkDt*deriv(rkZ+0.5*k1,rkt+0.5*rkDt,par);
k3 = rkDt*deriv(rkZ+0.5*k2,rkt+0.5*rkDt,par);
k4 = rkDt*deriv(rkZ+    k3,rkt+    rkDt,par);

rkZn = rkZ + (k1 + 2*k2 + 2*k3 + k4)/6;
rktn = rkt + rkDt;

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
%
%  regularized nonlinear wave
%
function rkP = deriv(rkZ,rkt,par)

global ik

N = size(rkZ,1);
c = par(1);  d = par(2);  r = par(3);

%  reconstruct ug

fact = exp(-d*rkt*(ik.^r));
vg = rkZ./fact;
ug = real(ifft(fftshift(vg))*N);

rkP = (-0.5*c) * fact .* ik .* fftshift(fft(ug.^2))/N;