#!/bin/csh
#
#  C-shell script to execute GAMESS test jobs, one job after the next.
#  Invoke this by typing './runall', while in the top level of GAMESS.
#
#  Each output is put in its own separate log file in the gamess root.
#  A script to check the results is ~/gamess/tests/standard/checktst.
#  Edit this file to set the base path to GAMESS, then execute it to be
#  sure all tests TERMINATED NORMALLY, and got correct numbers too.
#
if (null$1 == null) then
   echo "Please specify the desired binary version number to be checked",
   echo "    runall 00"
   echo "as an example, will test gamess.00.x"
   exit 4
else
   set VERNO=$1
endif
#
#   calculations will be done serially on the local node,
#   except at Iowa State University they run serially in a batch queue.
#
if (`hostname` == si.msg.chem.iastate.edu) then
   if (null$2 == null) then
      set QUEUE=$USER
      echo -n "ISU batch queue name? [$QUEUE] "
      set QUEUE=$<
      if (null$QUEUE == null) set QUEUE=$USER
   else
      set QUEUE=$2
   endif
   setenv GMS_TEST_DIR `pwd`
   echo "Testing gamess.$VERNO.x from $GMS_TEST_DIR in queue $QUEUE"
endif
#
#  Loop over all Ntest jobs supplied with GAMESS
#  The jobs are run in batch queues at Iowa State. 
#  Otherwise the test is executed interactively by 'rungms'.
#
set i=1
set Ntest=47
while ($i <= $Ntest)
               set NUM=$i
  if ($i <= 9) set NUM=0$i
  if (`hostname` == si.msg.chem.iastate.edu) then
     xgms -v $VERNO -q $QUEUE -l exam$NUM.log exam$NUM
     sleep 2
  else
     ./rungms exam$NUM $VERNO 1  >&  exam$NUM.log
  endif
  @ i++
end
