#!/bin/sh

if [ "$6" = "" ] ; then
  echo "Usage: secular_theory.sh a e inc node peri capm \"g g1 g2 s s1 s2\"";
  exit 1
fi

LD_LIBRARY_PATH=.; export LD_LIBRARY_PATH

cp makein.src makein.in
echo "$1 $2 $3 $4 $5 $6" >> makein.in

./makein < makein.in > makein.out
./pltp.awk < makein.out
echo -e "param.in\npl_Jupiter_Saturn.in\ntp.in\n" > swift_rmvs3.in

#baryc2 2 3 4 5 8 9 10 < makein.out > baryc2.out
#laplac < baryc2.out > laplac.out
#pltp.awk < laplac.out
#echo -e "param.in\npl.in\ntp.in\n" > swift_rmvs3.in

./swift_rmvs3_SECULAR_THEORY < swift_rmvs3.in > swift_rmvs3.out

./follow2 bin.dat follow2.out 1
#echo -e "./nu.awk 1 -2 -3 $7 follow2.out > nu.out" > nu.out
./nu.awk 1 -2 -3 $7 follow2.out > nu.out

GNUPLOT=/usr/local/bin/gnuplot4
GNUPLOT=/usr/bin/gnuplot

$GNUPLOT ./at.plt
$GNUPLOT ./et.plt
$GNUPLOT ./it.plt
$GNUPLOT ./varpit.plt
$GNUPLOT ./nodet.plt
$GNUPLOT ./perit.plt
$GNUPLOT ./hk.plt
$GNUPLOT ./pq.plt
$GNUPLOT ./nu.plt

$GNUPLOT ./at_JS.plt
$GNUPLOT ./et_JS.plt
$GNUPLOT ./it_JS.plt
$GNUPLOT ./varpit_JS.plt
$GNUPLOT ./nodet_JS.plt
$GNUPLOT ./perit_JS.plt

exit


