Jmol 10.x.33 introduces:

AJAX-JS support

Jmol-new.js now supports Asynchronous JavaScript, allowing web 
developers to create pages that draw from any molecular data resource on 
the web. To use this service, nothing more than Jmol-new.js is required. 
No server-side application is needed. Currently both of the two known 
AJAX-JS servers are supported -- one at St. Olaf College serving up RCSB 
biomolecular structures as well as just about any uncompressed 
structural model files anywhere on the web, and the American 
Mineralogical Society's AJAX mineral structure server at the University 
of Arizona.

Using the latest (7/22/6) 
http://www.stolaf.edu/people/hansonr/jmol/test/proto/Jmol-new.js, the 
following simple JavaScript function:

  jmolLoadAjax_STOLAF_RCSB()

automatically loads any CIF file in the Protein Data Bank into YOUR 
applet (by prompting the user).

Similarly

  jmolLoadAjax_STOLAF_ANY()

loads ANY uncompressed resource (that isn't too large) on the web into 
YOUR applet.

To repeat, because it's still a bit strange to most of us, AJAX-JS 
programming technology allows you to call up resources from some server 
(not necessarily your own -- a key point) without totally reloading the 
page. It's as though your applet were connected to anybody's system. The 
days of "only data from my server" are gone. Even better, it's not 
rocket science. All Ajax-JS does is set up something called a "DOM 
script node" that loads and runs JavaScript. Unlike HTML or XML, 
JavaScript in browsers can come from any number of machines anywhere on 
the web. The AJAX servers are delivering molecular structures "wrapped" 
as JavaScript arrays, thus allowing them to be sent to any machine. 
Jmol-new.js just has a few small functions that send and receive this 
data and then load it inline to the applet.

These two Jmol-new.js functions use an AJAX-JS server at St. Olaf 
College to deliver the necessary JavaScript.
A second AJAX-JS site has been established at the University of Arizona, 
courtesy of Bob Downs of the Mineralogical Society of America, and the 
work of Ian Johnson. See http://rruff.geo.arizona.edu/AMS/amcsd.php
To insert this mineralogical data directly into Jmol, use

  jmolLoadAjax_MSA()

It prompts for a field (mineral, author, etc.) and then a value, such as 
"quartz"



HoverCallback

When a user's mouse hovers over an atom, usually what happens is that a 
box pops up that identifies that atom. HoverCallback works like 
pickCallback, except the user doesn't have to click. Hovercallback is 
active even if hover OFF has been executed. Thus, with hover OFF the 
user will not see any effect of hovering, while the web page can be made 
fully aware of it. Callback functions can now be specified using the 
Jmol-new.js function "jmolSetCallback":

  jmolSetCallback("messageCallback","functionName")
  jmolSetCallback("pickCallback","functionName")
  jmolSetCallback("hoverCallback","functionName")
  jmolSetCallback("loadstructCallback","functionName")
  jmolSetCallback("animFrameCallback","functionName")

which presumes the JavaScript

  function functionName(appID, atomInfo, atomIndex) {...}

(Frankly, I don't know if loadstructCallback really does anything much.) 
Make sure that function name is in quotes. We're just passing the NAME 
of the function, not the function itself, to Jmol. The first parameter 
in the callback is the applet id. Second is a descriptive string 
indicating the atom's identity and xyz coordinates. Third is the atom's 
index (atomIndex), which can be used, for example, with

  var atomData = jmolGetPropertyAsArray("atomInfo", 
"atomno="+(atomIndex+1))[0]

(This says, "return the atom info entry for atomno=n", where n is one 
more than that atomIndex given in parameter 3. This information comes 
back as an array with only one element, 0.) See 
http://www.stolaf.edu/people/hansonr/jmol/docs/atomInfo.txt for details.

The calls to jmolSetCallback() must be made BEFORE the call to 
jmolApplet() so that the applet code can incorportate them.



set scriptQueue ON and quit/exit


Many people have reported issues with script commands running over each 
other, and it was also found that scriptWait() worked for the applet 
only, not applications. These problems were due to the fact that 
different scripts run on different threads on their way into Jmol but 
use the same underlying data structure.

This problem now largely solved (pending more testing, perhaps by YOU). 
applet.jmolScript() and viewer.script() deliver scripts to a queue, and 
if that queue is turned on using "set scriptQueue ON", they are properly 
sequenced. Thus, when the queue is turned on, each script waits for the 
previous to complete.

Note that this is NOT standard Jmol procedure for the reason that 
sometimes one needs one script to interrupt another, as, for example, 
when a LOOP command is involved. In that case, the only way to interrupt 
the looping script is with another script. So, to account for this 
issue, the roles of "quit" and "exit" have been expanded. quit or exit 
at the very beginning of a script command halts any previous 
still-running script. Anywhere else in the command, quit and exit abort 
that specific running script. In addition, exit clears the script queue 
of any remaining scripts, thus stopping all script processing. You can 
try this out at 
http://www.stolaf.edu/people/hansonr/jmol/test/proto/new.htm. I've also 
implemented it at http://fusion.stolaf.edu/chemistry/jmol/xtalx, where 
you can experiment some with AJAX as well.

The current plan is to make scriptQueue OFF the default. So if you like 
this function, you should use "scriptQueue ON" explicitly. I tried this 
some at these sites and could not get the applet to crash. Even quickly 
clicking 20 links in a row allows all 20 to run.


set logLevel 0-5

Nico and I wrote code to allow much better 
error/warning/information/debug reporting specifically to the Java 
console. See the new documentation of "set logLevel" at 
http://www.stolaf.edu/people/hansonr/jmol/docs . The default log level 
is 4: all errors, warnings, and information, but not full debugging 
(which is 5). You will find the Java console much cleaner.


Bob


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to