In cleaning up the code in the "bob200603 10.x branch" I discovered
that my previous post regarding spinning and rotating was slightly
incorrect. This post is meant to clear that up.
Jmol 10.2 and spinning/rotating
-------------------------------
Jmol 10.2 allows for one Chime-based rotation mechanism:
rotate [x|y|z] [degrees]
rotate x 33.3
rotate y 10
and one Chime-based means of spinning:
set spin [x|y|z] [degrees-per-second]
spin ON
set spin x 30; spin y 10; spin z 0; spin ON
In addition, Jmol 10.2 adds the capability to rotate around any fixed
axis through a previously identified center of rotation:
rotate AXISANGLE [x] [y] [z] [degrees]
This is the extent of the spin/rotate capability in Jmol 10.2. Jmol
10.x.04 preserves the Chime-based spin/rotate commands, and
(currently) requires that the vector specified with AXISANGLE be
enclosed in braces:
rotate AXISANGLE {[x] [y] [z]} [degrees]
(Upon request, this could be made backward-compatible to not require
the braces; see below.)
Jmol 10.x.04 spin/rotate extensions
-----------------------------------
The prototype Jmol 10.x.04 introduces several additional spin/rotate
features, including consolidation of the spin and rotate commands,
expanded axis definition, the ability to rotate the model about axes
defined in terms of molecular coordinates, and the ability to
designate the center of rotation within the spin/rotate command itself.
Spin/rotate consolidation
-------------------------
Probably the most significant change is that "spin" and "rotate" are
consolidated. The basic syntax is
[spin|rotate] [axis] [center] [degrees] [degrees/second]
You can use either "spin" or "rotate" interchangeably. The only
difference involves what happens if you leave off one the numbers
representing degrees:
rotate x 120 # rotate 120 degrees about x
spin x 30 # spin about the x axis at 30 degrees per second
The idea here is to provide natural defaults that are as close to
Chime-based syntax as possible.
Expanded axis definitions
-------------------------
Jmol 10.x.04 introduces a wide range of methods to define the axis of
rotation. These include:
-The six designations: "x", "y", "z", "-x", "-y", and "-z"
rotate -x 30 # same as "rotate x -30"
-Two cartesian coordinate points:
rotate {1,1,1} {2,1,1}
-Two fractional coordinate points (when there is a unit cell defined)
spin {1/2,0,0} {1/2,1,0}
-Two atom expressions (evaluated as the geometric center of each)
rotate (atomno=10) (hydrogen and connected(atomno=10)) 180 30
-A drawn line:
draw line1 (atomno=10) (atomno=30)
rotate $Line1
draw line2 {1/2,0,0} {1/2,1,0}
rotate $line2 180 60
-An axis perpendicular to a drawn plane:
draw plane1 (atomno=10) (atomno=20) (atomno=30)
rotate $plane1 30
Molecular- vs. fixed-frame axes
-------------------------------
With Jmol 10.x.04 you can specify which axis set you want to use --
the fixed window frame axes (as in Chime and Jmol 10.2), or the
"inernal" molecular axes defined by the cartesian coordinates of the
atoms in the model. Simply add the keyword "MOLECULAR" if you want
molecular axes:
rotate MOLECULAR x
rotate MOLECULAR AXISANGLE {1/2,1,1}
spin MOLECULAR y 180 60
This behavior is not possible in Jmol 10.2.
Designation of the center of rotation
-------------------------------------
Jmol 10.x.04 allows for the optional designation of the center of
rotation as part of the rotation/spin command. The average position of
the atoms determined by the atom expression is used.
rotate x (atomno=3) 10
rotate x {1,1,1/} 180 60 # fractional coordinates here
spin MOLECULAR x (atomno=15)
spin MOLECULAR z (visible) 180 60
spin MOLECULAR AXISANGLE {0,0,1} (atomno=15) 180 60
Using this method, you don't have to issue the "center" command first,
which would automatically shift the rotation center to the window
center. Instead, the molecule rotates in place, based on whatever axis
and center is defined in the spin/rotate command itself. This behavior
is not possible in Jmol 10.2.
Sequencing
----------
Limited-rotation animations are very simple to implement using Jmol
10.x.04. Just issue the rotate command with both the number of degrees
and the degrees per second explicitly given.
spin x 180 30
Each spin is its own "thread", and the code is set to allow only one
spin at the same time, so the following will NOT produce a sequence of
two slow rotations:
spin x 180 30; spin y 180 20
Instead, you have to add a delay:
spin x 180 30; delay 6; spin y 180 20
In Jmol 10.2, the above would be (approximately) scripted:
set spin x 30; set spin y 0; set spin z 0;
spin ON; delay 6; spin OFF
set spin x 0; set spin y 20;
spin ON; delay 9; spin OFF
(I think!)
Default values
--------------
Defaults include:
rotate x # 10 degrees about x, once
spin x # 10 degrees/second about x, until stopped
rotate # 10 degrees about y, once
spin # same as Jmol 10.2 -- spin on, with 30 deg/sec about y
(only present for compatibility)
Compatibility issues
--------------------
Because of the more complex syntax, coordinates and vectors must be
enclosed in braces. This means that
rotate axisangle 1 0 0 10
will not work. I will modify the code to allow this specific use of a
vector without braces if requested to do so.
Because of the more complex issues relating to axis and center
definition, 10.x.04 is set to stop spinning when a new model is
loaded. If requested, I can change that behavior to allow continued
spinning, provided the current spinning is the Chime-based "set
spin"-variety only.
Availability and integration into the main Jmol "trunk"
-------------------------------------------------------
Jar files can be found at
http://www.stolaf.edu/people/hansonr/jmol/test/proto
There are currently no plans to integrate these features into the trunk.
Summary
-------
The upshot is that you can do just about anything in terms of spinning
and rotating with these commands. As always, comments are welcome.
Bob Hanson
--
Robert M. Hanson, [EMAIL PROTECTED], 507-646-3107
Professor of Chemistry, St. Olaf College
1520 St. Olaf Ave., Northfield, MN 55057
mailto:[EMAIL PROTECTED]
http://www.stolaf.edu/people/hansonr
"Imagination is more important than knowledge." - Albert Einstein
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers