#!/bin/bash

ptraj_file="tmp.ptraj"
OUT="100ns_1000frames_RMSD"

REF[1]="1XCK_chainA_noWAT.inpcrd"
REF[2]="1SVT_chainA.inpcrd"

PRMTOP[1]="1XCK_chainA_noWAT.prmtop"
PRMTOP[2]="1SVT_chainA.prmtop"

#TRAJIN_PREFIX="500ns_noWAT_5000frames_chain"
TRAJIN_PREFIX="100ns_noWAT_noATP_1000frames_chain"

DIR="../traj_monomer/"



rm ${ptraj_file}

for index in 1 2 3 4 5 6 7 8 9 10 11 12 13 14;
do
	
        echo 'trajin '${DIR}${TRAJIN_PREFIX}_${index}.nc 1 1000 1 >> ${ptraj_file}

	if [ "$index" -lt 8]; then
		REF=${REF[2]}
		PRMTOP=${PRMTOP[2]}
	else
		REF=${REF[1]}
		PRMTOP=${PRMTOP[1]}
	fi

	echo 'reference' ${REF} >> $ptraj_file
        #echo "strip @H*" >> ${ptraj_file}
        #echo 'rms reference mass @N,CA,C out '${OUT}_${index}.dat >> $ptraj_file
        echo 'rms first mass @N,CA,C out '${OUT}_${index}.dat >> $ptraj_file


        ptraj ${PRMTOP} ${ptraj_file}

        rm ${ptraj_file}
done

