#!/bin/csh

if ( -e k_all ) then
    /bin/rm k_all
endif
if ( -e t_all ) then
    /bin/rm t_all
endif
if ( -e f_all ) then
    /bin/rm f_all
endif
if ( -e g_all ) then
    /bin/rm g_all
endif
if ( -e mipd.out ) then
    /bin/rm mipd.out
endif
if ( -e points0 ) then
    /bin/rm points*
endif

./rand3 $1 >numbers
touch k_all
touch f_all
touch g_all
touch t_all
touch mipd.out
foreach i (`./sequence $1`)
    cat protofile >file$i
    ./uncat3 numbers $i >>file$i
    echo "1.0 1.0" >points$i
    /bin/nice -19 ./multisim file$i >>points$i
    /bin/nice -19 ./tork points$i >points{$i}\k
    cat points{$i}\k >>k_all
    /bin/nice -19 ./tort points$i >points{$i}\t
    cat points{$i}\t >>t_all
    /bin/nice -19 ./torf points$i >points{$i}\f
    cat points{$i}\f >>f_all
    /bin/nice -19 ./torg points$i >points{$i}\g
    cat points{$i}\g >>g_all
    /bin/nice -19 ./tormipd points$i >> mipd.out
    /bin/rm file$i
end
/bin/rm numbers
