#!/bin/bash

#PRMTOP="../1SVT_chainA.prmtop"
PRMTOP="../1XCK_hept_sol.prmtop"
PREFIX="../../117_1XCK_hepta_prod"
SUFFIX_ORIG=".mdcrd"
SUFFIX_REIMG="_reimg.nc"
#WHOLE="340ns_imposedOnStart.nc"

C=1
END=60
#OFFSET=' 1 33800 50 '
#type=project
#type="snapshots"
type="rmsd"
#type="short"
#type="cluster"
#type="mmtsb_clustering"
#type=qha
#type=correl
#type=proj
ptraj_file=${type}.ptraj

if [ -f $ptraj_file ]; then
	rm $ptraj_file
fi

if [ ! $WHOLE == "" ]; then
	echo 'trajin '${WHOLE} $OFFSET >> $ptraj_file
else 
	let END=${END}+1
	while [ $C -lt $END ]; do
		traj_orig=${PREFIX}${C}${SUFFIX_ORIG}
		traj_reimg=${PREFIX}${C}${SUFFIX_REIMG}

		if [ -f $traj ]; then
			echo 'trajin '${traj_orig} $OFFSET >> $ptraj_file 
		fi	
	
		let C=${C}+1
	done
fi

echo `cat $type >> $ptraj_file`

ptraj $PRMTOP $ptraj_file 
