#!/usr/bin/perl
#

# Stable, timestep=50, t = 0
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=0.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 0 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=0.dat' using 4:6 ";
  $cmd .= "  with points pt 5 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 50
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=50.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 50 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=0.dat' using 4:6 ";
  $cmd .= "  with points lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=50.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 100
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=100.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 100 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=50.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=100.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 150
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=150.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 150 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=100.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=150.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 200
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=200.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 200 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=150.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=200.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 250
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=250.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 250 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=200.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=250.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 300
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=300.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 300 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=250.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=300.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 350
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=350.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 350 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=300.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=350.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 400
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=400.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 400 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './stable_t=350.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './stable_t=400.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Stable, timestep=50, t = 3600
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "stable_t=3600.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 50 sec, T = 3600 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105]  ";
  $cmd .= "      './stable_t=3600.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Unstable, timestep=100, t = 0
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=0.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 0 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './unstable_t=0.dat' using 4:6 ";
  $cmd .= "  with points pt 5 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Unstable, timestep=100, t = 100
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=100.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 100 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './unstable_t=0.dat' using 4:6 ";
  $cmd .= "  with points lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './unstable_t=100.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Unstable, timestep=100, t = 200
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=200.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 200 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][0:105] './unstable_t=100.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './unstable_t=200.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Unstable, timestep=100, t = 200 -- extended temp range
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=200_a.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 200 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][-1000:1000] './unstable_t=100.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './unstable_t=200.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }



# Unstable, timestep=100, t = 300 -- extended temp range
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=300_a.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 300 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][-1000:1000] './unstable_t=200.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './unstable_t=300.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }

# Unstable, timestep=100, t = 400 -- extended temp range
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=400_a.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 400 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][-1000:1000] './unstable_t=300.dat' using 4:6 ";
  $cmd .= "  with linespoints lc -1 pt 5 ps 1 lw 1 t '' ";
  $cmd .= " , ";
  $cmd .= "      './unstable_t=400.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }


# Unstable, timestep=100, t = 3600
  
  my($output_file, $term_options);

  # get the arguments
  $output_file = "unstable_t=3600.ps";
  $term_options = "postscript color font 'Helvectica,18";

  $cmdfile = "gnuplot.in";
  
  open (CMDFILE, ">$cmdfile") || die("can't open $cmdfile for writing");
  printf CMDFILE "set output '$output_file' \n";
  printf CMDFILE "set term $term_options \n";
  printf CMDFILE "set grid \n";
  printf CMDFILE "set nokey \n";
  printf CMDFILE "set xlabel 'Position along rod (m)' \n";
  printf CMDFILE "set ylabel 'Temperature (K)' \n";
  printf CMDFILE "set title 'Timestep = 100 sec, T = 3600 sec' \n", $aper;
  
  $cmd = "plot [0:1.0][]  ";
  $cmd .= "      './unstable_t=3600.dat' using 4:6 ";
  $cmd .= "  with linespoints lc 1 pt 6 ps 2 lw 3 t '' ";

  printf CMDFILE "$cmd \n";
  printf CMDFILE "set output \n";
  printf CMDFILE "quit \n";
  close(CMDFILE) ;
  
  $retval = `gnuplot < $cmdfile`;
  printf "retval is ..%s..\n", $retval;
  
  if ($term_options =~ /postscript/) {
    $psfile = $output_file;
    $giffile = $psfile;
    $giffile =~ s/.ps/.png/;
    $cmd = "convert -rotate 90 $psfile $giffile";
    printf "cmd is ..$cmd.. \n";
    $ret = `$cmd`;
  }

