#!/bin/bash

ptraj_file="tmp.ptraj"
OUT="20-50ns_noWAT_1500frames_noH"

REF="../../1XCK_hept_MGATP_noWAT.inpcrd"

PRMTOP="../../1XCK_hept_MGATP_noWAT.prmtop"

TRAJIN[1]="../traj/1-50ns_imposedOnStart.nc"


MASK[1]=":1-524"
MASK[2]=":525-1048"
MASK[3]=":1049-1572"
MASK[4]=":1573-2096"
MASK[5]=":2097-2620"
MASK[6]=":2621-3144"
MASK[7]=":3145-3668"




rm ${ptraj_file}

for index in 1 2 3 4 5 6 7;
do
        echo 'trajin '${DIR[index]}${TRAJIN[1]} 2001 5000 2 >> ${ptraj_file}

        echo "strip '* & !"${MASK[index]}"'" >> ${ptraj_file}
	echo "strip @H*" >> ${ptraj_file}

	echo 'rms first mass :8-27,52-58-133,416-456,496-514@N,CA,C' >> $ptraj_file
	#echo 'rms first mass @N,CA,C' >> $ptraj_file
        echo 'trajout '${OUT}"_chain_"${index}".nc nobox netcdf" >> ${ptraj_file}

        ptraj ${PRMTOP} ${ptraj_file}

        rm ${ptraj_file}
done
