[ Movie rotate view | Mc movie ]
above).
This will increase the image quality.
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
endfor
Now you can add a specific display ( cpk, skin or anything else)
and add the write image command after set view .
The following script and macro make a .mov file for a specified molecule.
# 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
[ 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.- First,
skinand surface are not automatically recalculated and redisplayed upon the conformational change. - Second, if you would like to display computationally heavy forms of graphical representation the interactive trajectory may become too slow.
In this case, the process of making a molecular movie animating the trajectory can be split into two steps.
The first step is a preparation of a series of images stored as separate files. Watch the ICM trajectory by the display trajectory command and select a range of frames you are going to include to the movie. There are two ways how a series of the molecular graphics images can be saved as
tif or rgb formatted files.
wire, cpk, ball, stick, xstick and ribbon .
The image option of the ICM display trajectory
command is required. An example:
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 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 image
Computationally 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.
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
Whatever protocol you make use of, a series of files should appear in the
s_tempDir
directory. List their names in a file, for example, alpha.lst:
/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`
Upon completion, use the movieplayer IRIX command to see the movie. UNIX man on-line help should allow you to learn more about these (and other) helpful commands. And let us give you several helpful hints:
- While the collection of the image files is in progress, do not hide any portion or the whole area of the graphics window by opening another window which can cover the first one, and do not move the mouse cursor through the graphics window area. This procedure typically requires quite a time, so be ready to be off your terminal/workstation for the whole time required for the image collection to complete.
- Do not forget to deactivate your screen saver before you start!
-
Make sure you have enough disk storage. All images are assumed to be
stored in the directory specified by
s_tempDirstring variable. The easiest way to estimate the required disk storage is to store the content of a single image by the write image command, and multiply the size of the resultingtiforrgbfile by the number of frames. You could do it without leaving your ICM-session. For example, if you have a molecular image in the graphics window, then: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
s_tempDir variable).