for i in `ls mdp | sed "s/\.mdp//"`; do 
mkdir ${i}

grompp -f mdp/${i}.mdp -c et.gro -p et.top -o ${i}/et_${i}.tpr
mdrun -deffnm ${i}/et_${i} -v -nt 1
trjconv -f ${i}/et_${i}.trr -s ${i}/et_${i}.tpr -o et_${i}.pdb

echo -e "Bond\nKinetic-En.\n0" | g_energy -f ${i}/et_${i}.edr -o ${i}/et_${i}_en.xvg > ${i}/et_${i}_en.txt
echo -e "set datafile commentschars '#@&'
set term 'png' 
set output '${i}/en_${i}.png' 
plot '${i}/et_${i}_en.xvg' using 1:2,  '${i}/et_${i}_en.xvg' using 1:3" > ${i}/en_${i}.gnu
gnuplot <  ${i}/en_${i}.gnu

g_bond -f ${i}/et_${i}.trr -s ${i}/et_${i}.tpr -o ${i}/bond_${i}.xvg -n b.ndx 
echo "set datafile commentschars '#@&' 
set term 'png'
set output '${i}/bond_${i}.png'
plot '${i}/bond_${i}.xvg' with boxes" > ${i}/bond_${i}.gnu
gnuplot <  ${i}/bond_${i}.gnu

ls -r ${i}/*.png >> image_list

done

montage +frame +shadow +label -tile 2x5 -geometry 700x500 `cat image_list` temp_images.png
