Probably the easiest but not the most attractive way to generate an animated gif of electron density during a relaxation process is the combination of Jmol with imagemagik. You run our code to generate a molden file with densities in sequential orbitals, and then run the following Jmol script after opening that molden file and dragging this into the script console. I have shamelessly adapted this script from Google:
print “Dumping densities... ” for (var i = 1; i <= 1000; i = i+4) print i; var filename = "movie"+("00000"+i)[-4]+".jpg”; mo @i; mo cutoff 0.000005 mo translucent 0.3; mo Fill noMesh noDots frontOnly frontlit; write IMAGE 600 400 JPG @filename; frank on; select *; set fontScaling false; end for
At that point in your Jmol has dumped .jpg’s into it’s directory which you can then convert into an animated gif by simply running the following command in that directory provided you have installed imagemagik. The animated .gif made below is the excess electron density (above the DFT ground state) caused by light irradiation along the x-axis of a hydrogen ring (click to see the animation in Chrome). “Energy” in the text of the plot is actually the time of the frame in atomic units. The occupancy of the excess electron is small because the applied field was ~0.0001 atomic units, and it oscillates while the excited states persists before it eventually decays to zero.
convert -delay 10 -loop 1 *.jpg animated.gif