"Import and visualise a data file in xyz format"
SetDirectory[NotebookDirectory[]];

"Import the file using the format Data, name it as rawdata, and FilePrint it"
rawdata=Import["NP3D.dat","Data"]
FilePrint["NP3D.dat"]

(******)
NP=10;(*number of particles in box, assumed a known quantity *)
"Number of time step is "
numberoftimestep=5000;(*number of 'block' in rawdata, assumed a known by counting the number of block in the NP3D.dat file*)
(******)


L=1;
block[n_]:=Table[rawdata[[dummy]],{dummy,n*(NP+2)-(NP+1),n*(NP+2)}];
listofcoordinatesC[n_]:=Table[rawdata[[dummy]],{dummy,n*(NP+2)-(NP+1)+2,n*(NP+2)}];
listofcoordinates[n_]:=Table[Take[rawdata[[dummy]],{2,4}],{dummy,n*(NP+2)-(NP+1)+2,n*(NP+2)}];
plotrange={{0,L},{0,L},{0,L}};
Graphics3D[{PointSize[0.02],Point[listofcoordinates[3]]},PlotRange->plotrange]

"Use Manipulate to visualise the input data, rawdata"
Manipulate[Graphics3D[{PointSize[0.02],Point[listofcoordinates[it]]},PlotRange->plotrange],{it,1,numberoftimestep,1}]

"Exercise"
"How do you determine the number of particles,NP, in the rawdata automatically? Can you write a code to determine NP automatically instead of input it by hand"
"Additionally, how many time step (or the number of 'block' in the rawdata?). Can you determine it automatically, i.e., determine numberoftimestep automatically? "
"Modify the code to do these "