11.3.9 is ready for release and can be experimented with at

http://chemapps.stolaf.edu/jmol/docs/examples-11

Two new features ready for testing:

1. symmetry "range"
2. new "synchronize" command


symmetry "range"
----------------

The load command has a new option. Eric Martz suggested having the 
capability of looking at the close contacts around a crystalline protein 
that are to atoms that are in proteins in adjacent unit cells. I am 
happy to say that this is now possible. First you have to load the 
protein with symmetry applied:

  load =1crn {1 1 1}

but this is not quite it, because then you only get the atoms in the 
base unit cell (cell "555"), which in this case includes two protein 
units. So what we do is instead load all 27 cells centered on 555:

  load =1crn {444 666 1}

But the problem with this is that it is WAY too many atoms. So now the 
new part:

  load =1crn {444 666 1} range 3.0

This says "load all 27 unit cells, but only include the atoms in 
surroundings unit cells that are within 3.0 Angstroms of SOME atom in 
the {1 1 1} set.

It's really quite an interesting effect. You see all the close contacts. 
Lots of applications in the inorganic and organic crystallography area 
as well, I think.


new "synchronize" command
-------------------------

An idea that has been bouncing around for way too long is a good way to 
get a Jmol applet to synchronize with another -- so that when you rotate 
one, the other rotates as well. Happy to say this is now possible. It 
turned out way more complex than I had hoped, but I think the end result 
is going to be a hit -- provided it works on Macs. We'll see. Please 
test this. You can check it out at 
http://chemapps.stolaf.edu/jmol/docs/examples-11/sync2.htm.

The basic idea is that you identify a "sychronization set" (by default 
just the applets on a given page) and then set some to be "slaves" and 
some to be "drivers". If you change the orientation of any of the 
drivers, all the others in the set (including the other drivers) change 
orientation as well.  This is done by direct transfer of moveTo commands 
from one applet to the other. No JavaScript!

So, for example:

  sync * ON

synchronizes all applets on a page (as drivers) regardless of which 
applet is sent the script.

Besides "*" there is "." (this applet only) and ">" (all other applets):

  sync . ON; sync > SLAVE

sets the applet receiving the script as the driver and all others on a 
page to be "slaves".

Interestingly (I think), the sync command is not restricted to 
orientation changes. All the applet is doing anyway is sending a moveTo 
command to the other applet, so...

  sync * ON; sync * "set echo top left; echo This message is from Applet 
1";sync * OFF

just temporarily sets the sync for all applets, then puts a message on 
all applets, and then turns off the sync. That means here is a nice 
mechanism for setting parameters (backgrounds, file loading, etc.) for 
all applets on a page at the same time.

  sync * ON; sync * "load myfile.pdb"; sync * "cartoons on;wireframe 
off;spacefill off"; sync off

loads the same file in each applet and sets the same display for each. 
Cool, eh?

Here are the options. The full command is two parts -- a target appletId 
and a command. Everything is optional, with reasonable defaults.

# synchronize .|>|*|appletId[syncId] ON|OFF|SLAVE|command
#
# The synchronize (sync) command allows two or more applets to be 
synchronized in
# terms of orientation. Move one with the mouse, and the other moves as 
well.
# In addition, the sync command allows ANY command to be sent to one or more
# other applets directly, without the intervention of JavaScript.
#
# Applets are identified by appletId (jmolApplet0, for instance)
# along with an optional bracketed sync group identifier -- generally a 
random
# number that identifies the page containing the controlling applet. If the
# syncId is not given, then the ID for the page containing the 
controlling applet
# is used. This feature is important for cross-frame synchronization only.
#
#
# .          this applet only
# >          all applets except this one
# *          all applets
# appletId   id of a specific applet
# [syncId]   (optional) a unique string of digits -- brackets included
#
# ON         sync as driver (default)
# OFF        turn sync off
# SLAVE      turn sync on, but not as driver
# command    command to send
#
# for example:
#
# sync     # same as "sync * ON"
# sync jmolApplet1  #syncs this applet with jmolApplet1 both as drivers
# sync * ON; sync "set echo top left;echo OK";sync > OFF  # sends OK to 
top left of all OTHER applets
# sync jmolApplet2[254678942] OFF  # turns sync off for an applet ON A 
DIFFERENT PAGE
#                                  # or in a different FRAME
# sync . OFF # turns sync off for this applet
#     
# new Jmol.js feature: jmolGetSyncId(); jmolSetSyncId(id);
# allows control over the sync ID via javascript. jmolSetSyncId(id)
# should be called prior to jmolApplet() and should incorporate some sort of
# random digits and no space characters. (A number is good.)
# This should only be necessary for multi-frame pages.
 

The really tricky part turned out to be separating applets on one page 
from applets on another page and still being able to synchronize between 
frames and pages if desired. Basically, the problem was that 
"jmolApplet0" on one page wasn't being distinguished from "jmolApplet0" 
on another page. The solution was to add a "synchronization id" -- a 
unique identifier for each page. This is also unique to a FRAME, so if 
you want to do synchronization across frames, you will have to 
explicitly set the sync ID for all applets you want to synchronize. You 
do this with JavaScript just before the jmolApplet() command:


jmolSetSynchId(someNumber)


Mind you, that number should be relatively random -- it has to appear 
differently each time the user loads a page, even if it is the same 
page, because otherise a user could have two of the same page in two 
different windows, and they might be surprised at the cross-talk between 
applets.

So there's a new Jmol.js that goes along with this that creates a unique 
random sync ID for each PAGE (or FRAME) that contains applets, and 
delivers that to the applet as a parameter. Most people won't need 
jmolSetSynchId, because Jmol.js will do it for them, and "*" will mean 
"all applets ON THIS PAGE" not "all applets on all pages".



Bob Hanson

-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get. 

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to