#!/bin/bash


PRMTOP="../../123_1SVT_chainA_apo/1SVT_chainA_sol.prmtop"


DIR_PREFIX="123_1SVT_chainA_apo_seed"

ptraj_file=tmp.ptraj

I=1
while [ $I -lt 5 ]; do
	J=0	
	while [ $J -lt 6 ]; do
		DIR=$DIR_PREFIX${I}${J}
		cd $DIR
		pwd
		if [ -f $ptraj_file ]; then
		        rm $ptraj_file
		fi

		echo 'trajin '${DIR}'_prod1.mdcrd 1 5000 10' >> $ptraj_file
		echo 'rms first @CA' >> $ptraj_file
		echo 'matrix covar name mwcvmat @CA' >> $ptraj_file
		echo 'analyze matrix mwcvmat out evecs_seed'${I}${J}'.pev vecs 50' >> $ptraj_file
		ptraj $PRMTOP $ptraj_file
		
		let J=$J+1
		cd /net/nrgroup/slars/groel_md/1SVT/123_5ns_seeds
	done
	let I=$I+1
done
