Prev | ICM Language Reference Animation | Next |
[ Movie rotate view | Mc movie ]
How to rotate and zoom in a script |
The simplest script will use the View(v1,v2,r) function to interpolate between views with different rotation and zoom. Example:
build string "ACDF" # tetrapeptide # zoom out and create a small remote view v1=View() # the 1st view # zoom in and rotate v2=View() # the last view for i=1,100 set view View(v1,v2,i*0.01) # interpolation endforNow you can add a specific display ( cpk, skin or anything else) and add the write image command after set view .
# makemovie -f qt -o tamox.mov -c qt_anim -r 15 `ls -tr ../f*.tif` print "DO NOT FORGET icmt -24; set view 10 10 640 480" macro molkino i_tZoom (20) i_tRotate (20) l_preview (yes) R_startView R_endView s_Files ("/icmdata/movies/tamox/f") GRAPHICS.ballQuality = 15 nfr=30 for i=0,i_tZoom*nfr set view View(R_startView ,R_endView, 0.5-0.5*Cos(180.*i/Real(i_tZoom*nfr))) if(!l_preview) write image s_Files + i endfor B = 0. for i=0,i_tRotate*nfr A = 360./Real(nfr*i_tRotate) * i A = 180. - 180.*Cos(A/2.) rotate view Rot({0. 1. 0.} A-B) B = A if(!l_preview) write image s_Files + (i_tZoom*nfr+ i) endfor endmacro #read object "tamoxifen" read object "propecia.ob" set window 10 10 640 480 GRAPHICS.ballRadius=0.4 display xstick color a_//c* green color a_//h* white read rarray "v0" read rarray "v1" set view v0
Saving a movie to a movie file (in addition to the ICM animation), see also write movie To export an extermal movie file you need to use the following set of commands
write movie "/tmp/forutube.avi" # give a name to your movie file. Option heavy for high quality # your script write movie on # option smooth for anti-aliasing # some actions write movie off # preparations for the next scene write movie exit
How to make a molecular movie from a Monte Carlo trajectory |
[ Image collection | Image frame by frame ]
We assume that you have a Monte Carlo trajectory saved as an ICM trajectory file. Displaying this trajectory interactively on your graphical screen is the simplest form of animation. You just load the object, the ICM trajectory file and run the display trajectory command. Adjust your window and view and the allowed types of representation. This method will not work in two situations.Image collection (type I) |
build "alpha" read trajectory "alpha" display ribbon color ribbon a_/1:9 magenta color ribbon a_/10:18 green print "Adjust the view, press ENTER to continue" pause # Pause to adjust a view of the molecule # start of the collection of the image disk files # (note, tif files are to be saved) nframe = Nof(frame) print "Total number of frames = ", nframe # specify the range you need, for example: ifrom = 10 ito = 20 # otherwise, for all frames: # ifrom = 1 # ito = nframe display trajectory ifrom ito imageComputationally more expensive skin and surface molecular representations (or a combination of any of these two with those mentioned above) require an ICM script, as in the following example.
Image collection (type II) |
build "alpha" read trajectory "alpha" display xstick a_//n,ca,c set window 600 30 640 480 # good to convert it later into NTSC format # change 640 480 to appropriate dimensions for PAL lineWidth = 3. print "Adjust the view, press ENTER to continue" pause nframe = Nof(frame) print "Total number of frames = ", nframe ifrom = 10 ito = 20 icount = 0 l_confirm = no IMAGE.compress = yes for iframe = ifrom, ito load frame iframe icount = icount + 1 imgname = s_tempDir + "alpha_" + String(icount-1) display xstick a_//n,ca,c green display surface a_/7:12/!n,ca,c a_/7:12/!n,ca,c magenta write image imgname undisplay surface # should be removed and redisplayed at the next step endfor
/usr/tmp/alpha_0.tif /usr/tmp/alpha_1.tif /usr/tmp/alpha_2.tif /usr/tmp/alpha_3.tif /usr/tmp/alpha_4.tif /usr/tmp/alpha_5.tif /usr/tmp/alpha_6.tif /usr/tmp/alpha_7.tif /usr/tmp/alpha_8.tif /usr/tmp/alpha_9.tif(Note, image numbers are started from zero, and "_" (underscore) is inserted before the current frame number.) Now, you can put these image files into a movie file. We suggest to use the makemovie command for Silicon Graphics machines. The following is a sample UNIX-shell command line which should be entered to make a non-interlaced MPEG-formatted movie with the frame size 640 by 480 saved in the Apple QuickTime movie file alpha.qt:
makemovie -f qt -o alpha.qt -c qt_anim -s 640,480 -r 30 ` cat alpha.lst`
write image "testsize" unix ls -l testsize.tif | awk '{print $5}' > testsize.rar read rarray "testsize.rar" sizeValue = testsize[1] nFrame = 0 nFrame = Ask("Number of frames?", nFrame) printf "Required storage for %d frames is %8.3f Mbytes\n", \ nFrame, Real(nFrame)*sizeValue/1048576. unix rm testsize.tif testsize.rar delete sizeValue testsize nFrames
Prev Stereo reconstruction | Home Up | Next Symmetry |