#!/bin/csh -f
#
# Usage test.ml [working_directory]
#
   if ($#argv != 0) then
      set wrkdir = $argv[1]
   else
      set wrkdir = `pwd`
   endif
#
   cd $wrkdir
   mkdir par
#
   set multidir = `cat ~/.multi_path`
   set scriptdir = $multidir/script
   set basisdir = $multidir/basis
   set exedir = $multidir/exe
   set exe = $exedir/multilev.exe
#
#  Copy over the shuttles for the electronic structure program
#    to be use
#
   cp $scriptdir/g98shuttle $wrkdir/g98shuttle
   cp $scriptdir/pg98shuttle $wrkdir/pg98shuttle
   cp $scriptdir/g94shuttle $wrkdir/g94shuttle
   cp $scriptdir/g03shuttle $wrkdir/g03shuttle
   cp $scriptdir/g09shuttle $wrkdir/g09shuttle
   cp $scriptdir/Gau_External $wrkdir/Gau_External
   cp $scriptdir/ex_shuttle $wrkdir/ex_shuttle
#
#  Copy over the basis sets
#
   cp $basisdir/*.gbs $wrkdir
   cp $basisdir/*.gbs $wrkdir/par
#
   foreach i (test12 )
      cp ${i}.dat ml.inp
      (time $exe) >& ${i}.jobs
      echo " " >> ${i}.jobs
      mv ml.out ${i}.out  >>& /dev/null
      mv ml.sum ${i}.sum  >>& /dev/null
      rm extopt.inp >>& /dev/null
      mv extopt.out ${i}.extopt >>& /dev/null
      mv g94.out ${i}.g94out >>& /dev/null
      mv g94.inp.1 ${i}.g94inp >>& /dev/null
      mv g98.out ${i}.g98out >>& /dev/null
      mv g98.inp.1 ${i}.g98inp >>& /dev/null
      mv g03.out ${i}.g03out >>& /dev/null
      mv g03.inp.1 ${i}.g03inp >>& /dev/null
      mv g09.out ${i}.g09out >>& /dev/null
      mv g09.inp.1 ${i}.g09inp >>& /dev/null
      mv Test.FChk ${i}.fchk >>& /dev/null
      rm g94.inp.* g94.out.* >>& /dev/null
      rm g98.inp.* g98.out.* Test.FChk.* >>& /dev/null
      rm g03.inp.* g03.out.* Test.FChk.* >>& /dev/null
      rm g09.inp.* g09.out.* Test.FChk.* >>& /dev/null
      rm ml.inp >>& /dev/null
   end

   rm $wrkdir/g98shuttle  >>& /dev/null
   rm $wrkdir/g94shuttle  >>& /dev/null
   rm $wrkdir/g03shuttle  >>& /dev/null
   rm $wrkdir/g09shuttle  >>& /dev/null

   rm $wrkdir/*.gbs  >>& /dev/null

#
#  End of script
#
