#!/bin/csh

# -----------------------------------------------------------------------------
# Set some parameters
# -----------------------------------------------------------------------------

# Write usage information
if ( ${#argv} == 0) then
  echo 
  echo "--------------------------------------------------------------"
  echo "Usage: mergetra.sh inpfile1 inpfile1 outfile         "
  echo 
  echo "         inpfile1          : 1st Input trajectory file"
  echo "         inpfile2          : 2nd Input trajectory file"
  echo "         outfile           : Output trajectory file"
  echo "--------------------------------------------------------------"
  exit 0
endif

# Set input file
set inpfile1 = $1
set inpfile2 = $2
set outfile  = $3

# Set Fortran program
set prog=${LAGRANTO}/goodies/mergetra

# -----------------------------------------------------------------------------
# Run program 
# -----------------------------------------------------------------------------

set dims1=`${LAGRANTO}/goodies/trainfo.sh ${inpfile1} dim` 
set dims2=`${LAGRANTO}/goodies/trainfo.sh ${inpfile2} dim` 

\rm -f mergetra.param
echo \"${inpfile1}\" >! mergetra.param 
echo \"${inpfile2}\" >> mergetra.param
echo \"${outfile}\"  >> mergetra.param
echo ${dims1}        >> mergetra.param
echo ${dims2}        >> mergetra.param

${prog}

exit 0

