Schrodinger

From PHYSpedia
Revision as of 15:51, 18 January 2012 by Jwmaseberg (talk | contribs)

Jump to: navigation, search

Authors: Aaron Brown and Jack Maseberg

Goal: We wish to solve the time-dependent Schrodinger equation in 2 dimensions (using gfortran) and plot our still images of the wavefunction with POV-ray to make an animated movie!

Step 1) Install Xubuntu 11.10 “Oneiric Ocelot” (dual booting: it's easiest to have windows installed and free drive space, then just install Xubuntu onto the free drive space).

Step 2) Use the Synaptic package manager to install gfortran(4.6.1-9ubuntu3). Use the Synaptic package manager to instlal povray(3.6.1). Use the Synaptic package manager to install imagemagick. Use the Synaptic package manager to install vlc.

Ffmpeg:

sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update

sudo apt-get install ffmpeg libavcodec-extra-53



Scripts for making a movie from still photos: (note-- to make a bash script executable do sudo chmod a+x filename.sh)

  1. rename.sh
  2. !/bin/sh

if [ $# -ne 1 ] ; then

 echo "Usage: $(basename $0) subdirectory (with pictures)"
 exit 1

fi

dir="$1" pattern="pic_" count="1"

for filename in $(ls $dir*) do

 new=`printf "%04d" $count`
 newname="$pattern$new.jpg"
 filename="$(echo $filename | sed 's/__/ /g')"
 echo "renaming \"$filename\" to $newname"
 mv $dir/"$filename" $dir/"$newname"
 count=$(( $count + 1 ))

done

exit 0


  1. resize.sh
  2. !/bin/sh

if [ $# -ne 1 ] ; then

 echo "Usage: $(basename $0) subdirectory (with pictures)"
 exit 1

fi

dir="$1"

for filename in $(ls $dir*) do

 filename="$(echo $filename | sed 's/__/ /g')"
 echo "resizing \"$filename\" to $filename"
 convert $dir/"$filename" -resize 1440x1080 $dir/"$filename"
  1. convert $dir/"$filename" -gravity center -background black -extent 1920x1080 $dir/"$filename"

done

exit 0


  1. makemovie.sh
  2. !/bin/sh

if [ $# -ne 1 ] ; then

 echo "Usage: $(basename $0) subdirectory (with pictures)"
 exit 1

fi

dir="$1"

ffmpeg -r 0.390 -i $dir/pic_%04d.jpg -aspect 1440:1080 -vcodec libx264 -crf 1 -vpre lossless_slower -y -r 24000/1001 video.mp4

  1. -r 0.4 means 0.4 frames per second, or 2.5 seconds per frame
  2. you can put another -r 30 near the end to specify 30fps video
  3. the -crf (constant rate factor) option means 1 pass encoding and is related to bitrate, 15 is higher quality than 24, ommiting seems to default to 0 which is highest quality
  1. if you have jpg files from diffenent cameras that are causing problems, try:
  2. identify -verbose *.jpg make sure that the geometry and resolution are the same for all images!
  3. mogrify -format bmp *, then rm *.jpg, then mogrify -format jpg *, then rm *.bmp
  1. to add an audio track you can do:
  2. ffmpeg -i track.aac -i video.mp4 -acodec copy -vcodec copy videowsound.mp4
  3. make audio track with:
  4. ffmpeg -i track.mp3 -acodec libfaac -aq 255 -ar 44100 -ac 2 track.aac

exit 0


  1. sound.sh
  2. !/bin/sh
  3. to add an audio track you can do:

ffmpeg -i track.aac -i video.mp4 -acodec copy -vcodec copy videowsound.mp4

  1. to convert mp3 to aac try
  2. ffmpeg -i track.mp3 -acodec libfaac -aq 255 -ar 44100 -ac 2 track.aac

exit 0