Looking into the issue of Jmol animation, it took me a while to figure
it out... but it's actually not that complicated.

Right now, a typical "SCRIPT" file might start like this:
------
data "model list"
10
empty
Xx -4.00002829615 -5.00002829615 -6.0
Xx 0.0 -5.00002829615 -6.0
Xx 4.00002829615 -5.00002829615 -6.0
Xx 5.00002829615 -4.00002829615 -6.0
Xx 5.00002829615 0.0 -6.0
Xx 5.00002829615 4.00002829615 -6.0
Xx -5.00002829615 -4.00002829615 -6.0
Xx -5.00002829615 -4.00002829615 0.0
Xx -5.00002829615 -4.00002829615 6.0
Xx 5.5 5.5 5.5
end "model list"; show data
------
There are ten points described here - the first nine are the locations
that will hold the labels marking the axes, and the tenth is added to
make sure that the applet scales correctly. Following this, it would
have various other commands organised to prepare the scene. Then, it
would have a bit of script like this:
-----
pmesh obj_863466 "obj_863466.pmesh"
color pmesh  [0,0,255]
pmesh obj_979891 "obj_979891.pmesh"
color pmesh  [255,0,0]
draw line_556707 diameter 1 curve {-4.00002829615 -4.00002829615
-6.0}  {-4.00002829615 4.00002829615 -6.0}
color $line_556707 translucent 0.5 [0,0,0]
-----
These (in this case) represent two "plots" drawn on the same image,
the first coloured blue, the second red, and then the first of the set
of lines framing the plot (the axes, basically) - there would be
twelve such "draw line_#" commands, for the twelve edges of a cube.

To add in animations, you would need to do two things. First, the data
section would need a repetition of the coordinates provided. For
instance, for two frames in the animation, it would look like this:
------
data "model list"
10
empty
Xx -4.00002829615 -5.00002829615 -6.0
Xx 0.0 -5.00002829615 -6.0
Xx 4.00002829615 -5.00002829615 -6.0
Xx 5.00002829615 -4.00002829615 -6.0
Xx 5.00002829615 0.0 -6.0
Xx 5.00002829615 4.00002829615 -6.0
Xx -5.00002829615 -4.00002829615 -6.0
Xx -5.00002829615 -4.00002829615 0.0
Xx -5.00002829615 -4.00002829615 6.0
Xx 5.5 5.5 5.5
10
empty
Xx -4.00002829615 -5.00002829615 -6.0
Xx 0.0 -5.00002829615 -6.0
Xx 4.00002829615 -5.00002829615 -6.0
Xx 5.00002829615 -4.00002829615 -6.0
Xx 5.00002829615 0.0 -6.0
Xx 5.00002829615 4.00002829615 -6.0
Xx -5.00002829615 -4.00002829615 -6.0
Xx -5.00002829615 -4.00002829615 0.0
Xx -5.00002829615 -4.00002829615 6.0
Xx 5.5 5.5 5.5
end "model list"; show data
------
Notice that the "data" and "end" lines remain, but the lines in
between get repeated as a block? The result of this is that it creates
a frame for each batch of coordinates (they're being stored as atoms,
you see), in this case named 1.1 and 1.2 (it names them this way
automatically). More generally, if you have N coordinates, it will
name them 1.1, 1.2, ... 1.N, with 1.10 following 1.9, and so on.

>From here, you need to populate each frame with the axes themselves
(no need to re-mark the axes with the labels) and the plots relevant
to each frame. To do this, the section I noted would look something
like this:
-----
frame 1.1
pmesh obj_863466 "obj_863466.pmesh"
color pmesh  [0,0,255]
pmesh obj_979891 "obj_979891.pmesh"
color pmesh  [255,0,0]
draw line_556707 diameter 1 curve {-4.00002829615 -4.00002829615
-6.0}  {-4.00002829615 4.00002829615 -6.0}
color $line_556707 translucent 0.5 [0,0,0]
... <More of the "draw line_" commands> ...
frame 1.2
pmesh obj_123456 "obj_123456.pmesh"
color pmesh  [0,0,255]
pmesh obj_234567 "obj_234567.pmesh"
color pmesh  [255,0,0]
draw line_345678 diameter 1 curve {-4.00002829615 -4.00002829615
-6.0}  {-4.00002829615 4.00002829615 -6.0}
color $line_345678 translucent 0.5 [0,0,0]
... <More of the "draw line_" commands> ...
frame 1.3
... <You get the point, I think> ...
-----
Once this is done, the remainder of the script can remain as generated
by sage already, which should then be followed by
----
frame 1.1;animation mode loop 0 0;animation fps 10;animation on
----
where the "0 0" after loop can be replaced by decimals indicating the
number of seconds to pause on the first and last frames, respectively,
and the "10" can be replaced by an integer representing the number of
frames per second.

A couple of side notes. First, the scripts as they stand are somewhat
bloated, doing more than is necessary (due to added functionality in
the version of Jmol being used by Sage right now) - specifically, all
of the lines that say "color $line_345678 translucent 0.5 [0,0,0]" can
be replaced by one single line at the end of the "draw line_" series
of commands, in the form "color $line_* translucent 0.5 [0,0,0]",
which will apply that to *all* of the lines (on all frames).

Second, it should actually be possible to create an interactive
version of Jmol that doesn't have to be re-loaded with each change. It
should be fairly trivial, for example, to delete a plot (pmesh) and
replace it with another one, without having to restart the entire load
process. The first step to this would be to have an animation start/
stop control of some sort provided. But I think just getting animation
working to start with would be a good idea, and let the rest of it be
addressed once that step is done.

-Aielyn

On Sep 26, 11:40 pm, Jonathan <gu...@uwosh.edu> wrote:
> For animations where the function is changing this is a good idea as
> we haven't implemented efficient communication with Jmol yet.  For
> things like spinning, zooming, etc...that functionality is in the 3-D
> Jmol applet used for default 3-D display in the notebook.
>
> Jmol can do animation with user control of frame rate and the ability
> to step back and forth, it just requires building the input data
> sets.  Nobody has done that yet.
>
> Jonathan

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to