#
# this small script uses m_xyzcountframes and m_xyzframes
#


. /cluster/apps/courses/mmm/m_functions.bash

FILE=$1
nframes=`m_xyzcountframes ${FILE} `
#
# the loop runs over all frames of the trajectory
# 
for a in `seq -w 1 $nframes`
do
	b=`printf "%g" $a`
#
# take the particular frame
#
	m_xyzframes $b $b $FILE > ${FILE%.xyz}.$a.xyz
#
# computes the Q4 order parameter
# 
	python ./stein.py ${FILE%.xyz}.$a.xyz << END  > value
4.736355
4
END
	q4=`tail -1 value`
	rm value
#
#  gets the energy
# 
	energy=`m_getcolumn "i" 6 <  ${FILE%.xyz}.$a.xyz`
	echo $b $energy $q4 
	rm ${FILE%.xyz}.$a.xyz
done
