#!/bin/csh -f                                                                   
# script to run analyze
#
# file/unit assignments, and program output        
# Set the following to your ECEPP database directory
setenv DBASDIR ${ECEPP_ROOT}/Data/Residue
if ($#argv < 2 ) then
    echo "FILENAME of the Input files are missing"
    echo " (FILENAME1.inp and outo.FILENAME2)"
    echo "You must enter: analyze FILANAME1  FILANAME2 [FILENAME3]"
    exit (1)
endif
# Main input file
setenv FOR008 $1.inp
# Input angle file from EDMC run(s)
setenv FOR011 outo.$2
# List file & output angle file from clustering
if ($#argv < 3) then
  setenv FOR004 $2_clust.ang
  setenv FOR020 $2.out
  setenv FOR009 $2.tex
else
  setenv FOR004 $3.ang
  setenv FOR020 $3.out
  setenv FOR009 $2.tex
endif
# Residue data base
setenv FOR035 ${DBASDIR}/rsdata.new
ln -s ${DBASDIR}/angid.data fort.12
if ( -e ${FOR020} ) then
  mv ${FOR020} ${FOR020}_old
  echo "Existing results file has been moved to ${FOR020}_old"
endif
if ( -e ${FOR004} ) then
  mv ${FOR004} ${FOR004}_old
  echo "Existing angle output file has been moved to ${FOR004}_old"
endif
setenv COORPREF $2
env | grep FOR
#    dbx -I /apl/protein/analyze/source /apl/protein/analyze/bin/analyze-AIX-clust.x
set os = `uname`
if ($os == "AIX") then
    analyze-clust-AIX.x
else if ($os == "IRIX") then
    analyze-clust-IRIX.x
else if ($os == "IRIX64") then
    analyze-clust-IRIX64.x
else if ($os == "SunOS") then
    analyze-clust-SunOS.x
else if ($os == "Linux") then
    analyze-clust-Linux.x
else
    echo "Unsupported architecture $os"
    exit
endif
# Remove empty "junk" files.
rm FOR*
foreach fil (*)
   if (-z $fil) /bin/rm $fil
end
/bin/rm fort.12
