Greetings all! I'm a new python programmer working for a physics lab. I've got 11 numbered .txt files, all laid out in the exact same format shown below:
ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
55
ITEM: BOX BOUNDS
0 20.4
0 20.4
-0.0001 20.4001
ITEM: ATOMS
0.883194 0.969209 -1.02474
0.0378892 -0.209928 -2.53493
-1.91866 -0.00183195 -0.148284
-2.55231 1.87999 -0.0287856
1.10493 1.81091 -1.28696
2.55788 -1.23035 0.582496
This repeats for however many timesteps I have. Everything above and including ITEM:ATOMS is just a header, used to organize the lists of data. Each coordinate triple represents velocity components of a particular atom. I need to a) take all these velocities for one particular timestep and find the average, b) repeat that for all 11 files for a given timestep, c) iterate over every timestep. The end result I'm trying to achieve is a 2 column list of data where the first column is the filenumber and the 2nd is the average velocity for that file for that timestep. Each timestep in the final output would need to be separated by a blank space. I', not sure how to start attacking this problem, so if any of you could point me in a direction to go, I would be very appreciative!
Many thanks!
Connor