function Ydot = ode(t,y,Y,particle)

global N m

vx = y(4);
vy = y(5);
vz = y(6);

r1 = [y(1); y(2); y(3)];

F = [0; 0; 0];

%Find net force on particle
for i = 1:N
    if i ~= particle 
        r2 = [Y(1,i); Y(2,i); Y(3,i)];
        d = distancePBC(r1,r2);
        Fcomp = force(d);
        F = F + Fcomp;
    end
end

a = F./m;


Ydot = [vx; vy; vz; a(1); a(2); a(3)];