if [ $# -ne 1 ]; then
  echo "Must be passed target directory"
else
  olddir=$(pwd)
  cd $1
  echo > abcmol.script set write on
  for ppmfile in *.abc
  do
    echo >> abcmol.script load abc4 \"$ppmfile\"
    echo >> abcmol.script rotate x -73
    echo >> abcmol.script wireframe 80
    echo >> abcmol.script colour atoms temperature
    echo >> abcmol.script write $(basename $ppmfile .abc).ppm
    echo >> abcmol.script zap
  done
  echo >> abcmol.script quit
  abcmol -nodisplay < abcmol.script
  rm abcmol.script
  cd $olddir
  paramgen $(slash $1)*.ppm
  mv movie.param $1
  cd $1
  ppmtompeg movie.param
  rm *.ppm
fi
