function [x0,Gnew,Vnew,Unew,params] = RAPTOR_restart(simres,params,it)
%  [x0,Gnew,Vnew,Unew,params] = RAPTOR_restart(simres,params,it)
% get initial condition and G,V, to restart simulation from given time
% step;

itmax = find(~isnan(simres.U(1,:)),1,'last');

x0 = simres.X(:,it-1);
Gnew = simres.G(:,it:itmax);
Vnew = simres.V(:,it:itmax);
Unew = simres.U(:,it:itmax);
params.tgrid = params.tgrid(it:itmax);
end


