% This function writes the positions of the particles out in a xyz file format.
function position_xyz(t, N, partiden, xn, posFile);

% t        = Current time
% N        = Number of particles
% partiden = Array of particle type (C or S)
% xn       = Position of the particle
% posFile  = Position out file pointer

% Writes the particle position to a .xyz file for visualization with Chime.
fprintf(posFile, '%d\n%d\n', N, t);
for i = 1:N
  fprintf(posFile, '%c\t %g\t %g\t %g\n', partiden(1,i), 2*xn(i,1), 2*xn(i,2), 2*xn(i,3));
end;
fprintf(posFile, '\n');