% Function [RX,RY,RZ] = Move(RX, RY, RZ, VX, VY, VZ, DT, N)
% Advance positions from T TO T + DT. It accepts as arguments the position of the atomic
% particles for all 3 coordinates as well as the time step and calculates the new position
% and returns the values.
% LEAPFROG VERLET ALGORITHM FOR ADVANCING POSITIONS.
function [RX,RY,RZ] = Move(RX, RY, RZ, VX, VY, VZ, DT, N);
for i = 1:N
  RX(i,1) = RX(i,1) + VX(i,1) * DT;
  if (RX(i,1) > 1) RX(i,1) = RX(i,1) - 1;
  elseif (RX(i,1) < 0) RX(i,1) = RX(i,1) + 1;
  end;
           
  RY(i,1) = RY(i,1) + VY(i,1) * DT;
  if (RY(i,1) > 1) RY(i,1) = RY(i,1) - 1;
  elseif (RY(i,1) < 0) RY(i,1) = RY(i,1) + 1;
  end;
  
  RZ(i,1) = RZ(i,1) + VZ(i,1) * DT;
  if (RZ(i,1) > 1) RZ(i,1) = RZ(i,1) - 1;
  elseif (RZ(i,1) < 0) RZ(i,1) = RZ(i,1) + 1;
  end;
end;