If you use animation in the context of multiple files, you may find that
Jmol does not behave quite as you would expect.
This message describes how frames need to be addressed in that context,
and what the animFrameCallback parameters mean.
frame numbering
---------------
In a multifile context frames should always be referred to in a way that
designates both the file number and the model number. There are two ways of
doing this.
1) You can refer to a frame as decimal number: "1.2", "1.20", or "3.4". Note
that "1.20" is not the same as "1.2" in this context.
2) You can refer to a frame as 100000 * fileNumber + modelNumber: 1000002,
1000020, or 3000004.
The reason for the second method is to make sure that there is a numerical way
of referring to a frame that is unambiguous. The problem is that "1.2" and
"1.20" aren't the same frame, but they are the same decimal number. In
addition, Java has a tendency to destroy decimal numbers, and this would be
disasterous in a frame context. For example, "4.71 + 0.01" in Java is
"4.7200003". Notation (2) is more reliable. Nonetheless, the script compiler
has been written to accept "1.2" and "1.20" as different numbers in the context
of frames. So the following is perfectly OK:
frame range 1.1 1.10 #first ten frames from file 1
Note that "frame 3" in a multifile context will be interpreted as "frame 3.0"
-- that is, all models in the third file -- not "the third frame."
In fact, it's not a bad idea to always refer to frames this way, even if there
is just one file. "frame 1.1" is always the first model in file 1, even if a
PDB MODEL record calls it something else.
animation range
---------------
We can now designate a subset of the frames in Jmol as the working set for an
animation using "frame range", and that range can span file boundaries:
frame range 2.3 5.4
Means, "When I say 'animation play' I want Jmol to run an animation from the
third model in the second file to the fourth model in the fifth file."
[Note the use of "animation PLAY" here. In contrast, "animation ON" disregards
the set range, resets the range to ALL, and runs the entire set of frames as an
animation.]
More likely we might see:
frame range 3.0 #all models in file 3
[there is a bug in 11.1.38 in this regard when the file only contains one model
that I just fixed for 11.2]
In fact, simply issuing
frame 3.0
does two things: It sets both the current frame and the animation range to "all
models in file 3". Typically this displays all those models superimposed on
each other. In contrast:
frame range 3.0
sets the same range for animation, but sets the current frame to 3.1,
displaying just that one file.
"display" and "frame"
---------------------
I recommend if you are using multiple frames that you stick to "display all"
and then use something like "frame 3.1" to display a given model. The
alternative is to set "frame ALL;display 3.1" to display a selected model.
Certainly you can do this, and in certain circumstances, such as when you want
to overlay two or more models that are not sequential (frame ALL; display
3.1,3.5,3.8), this is the only way to go. Mixing these, as, for example,
"display 3.1; frame 4.2", makes no sense and will show no atoms.
If you are animating, "display all" tells Jmol that no matter what frame is the
current frame, you want to see all the atoms; then select the frames to use in
the animation using "frame range x.x y.y", and use "animation play" to start
the animation.
animFrameCallback
-----------------
The animFrameCallback JavaScript function now returns seven values, several of
which are specifically useful in a multifile context:
function animFrameCallback(app,frame,fileno,modelno,firstno,lastno,isRunning){
//#1 app: applet identifier
//#2 frame: absolute frame number, starting with 0
//#3 fileno: file number associated with this frame, starting with 1
//#4 modelno: model number associated with this frame, starting with 1
//#5 firstno: the file and model of the first frame in the animation range as
1000000 * fileno + modelno
//#6 lastno: the file and model of the last frame in the animation range as
1000000 * fileno + modelno
//#7 isRunning: 0 -- animation is off; 1 -- animation is on
}
Parameter 1, as for all callbacks, is the applet id, for example "jmolApplet0".
Parameter 2 tells you which absolute frame number is the current frame, in the
original Chime way, with 0 being the first frame.
Parameters 3 and 4 are what you would use to construct the frame command for
the current frame:
jmolScript("frame " + fileno + "." + modelno)
Parameters 5 and 6 tell you what the current animation range is, in integer
notation. To turn this into fileno and modelno, you would use:
firstFileNo = Math.floor(firstno / 1000000);
firstModelNo = firstno % 1000000;
lastFileNo = Math.floor(lastno / 1000000);
lastModelNo = lastno % 1000000;
Parameter 7 tells you if animation is on or not.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users