#!/bin/bash
#
# Code by  venkentom@gmail.com
#
# Licenced by the GPL General Public License
# Have a look at:
# http://www.gnu.org/copyleft/gpl.html
# For more information about the GPL License
#
# I am not responsible for what this code does to your hw/sw/mind
# Use at your own risk
# 

#Put gromacs commands after this line

DIR=`pwd`

#Config
NPROCS=2

mkdir chol_angles
cd chol_angles

for i in {85..130}
do
#k=`echo $i|sed 's/^0*//'`
j=$(($i - 67))
echo $j

make_ndx -f ../system.pdb -o index_chol_angle.ndx <<EOL
splitres 14
a C3 & $j
a C17 & $j
q
EOL

#and then calculate the tilt using g_bundle
g_bundle -s ../system.pdb -f ../prod_time.xtc -z -na 1 -n index_chol_angle.ndx -ot bundle_CHL${i}.xvg -tu us -xvg none <<EOL
64
65
EOL

g_analyze -f bundle_CHL${i}.xvg -bw 0.1 -dist dist_CHL${i}.xvg


rm \#*

done

cd ..
