This messages is for users who have been using message callbacks from
the Jmol applet on web pages. Ignore if you are not into this sort of
thing.
I'm working on an idea that allows access to information about a model
and does NOT require using callback functions. I'm just testing it
out; it should show up in the next release, but I expect some changes
to occur as we start seeing how it works.
The idea is a new JavaScript method for that applet that looks like
this, assuming jmolApplet0 is an applet already on a page.
var objInfo=getProperty("some property name")
or
var objInfo=getProperty("some property name","some atom selection")
(Note that what is returned is a JavaScript OBJECT, not a STRING. To
turn it into a string, so that you can work with it, you have to add a
a blank string to it -- as in var strInfo = objInfo+"".)
So, for example, say you want to get the actual file data in raw form.
All you would have to do is use
objInfo=getProperty("fileContents")
or any file on your system, for example:
objInfo=getProperty("fileContents","caffeine.xyz")
Currently, this sort of information is available only through a
message callback from the "show file" script.
The two other properties I've tried are "atomList" and "atomDetail"
so:
var objInfo=getProperty("atomList","within(1.5,carbon) and not carbon")
will list all the atoms that are within 1.5 angstroms of carbon but
not carbon. I'm sure you see where this could be useful!
Better, though, is "atomDetail". This would return a JSON (JavaScript
Object Notation) string detailing the atoms in the atom expression.
For more information about JSON, see:
http://en.wikipedia.org/wiki/JSON
http://www.crockford.com/JSON/
http://www.crockford.com/JSON/js.html
So, for example:
var objInfo=getProperty("atomDetail","selected")
gives a JSON string:
[{"ipt":8,"number":9,"sym":"O","atno":8,"x":-0.49267972,"y":-2.8180554,"z":-1.2094731
,"name":"O","model":0,"info":"O 9 9"}
,{"ipt":10,"number":11,"sym":"O","atno":8,"x":-2.2301338,"y":0.79886246,"z":1.089973
,"name":"O","model":0,"info":"O 11 #11"}]
To actually use this, what you do is this:
var Info = eval(""+objInfo)
Now we have:
Info[0].ipt=8
Info[0].number=9
Info[0].sym="O"
Info[0].atno=8
Info[0].x=-0.49267972
Info[0].y=-2.8180554
Info[0].z=-1.2094731
Info[0].name="O"
Info[0].model=0
Info[0].info="O 9 #9"
Info[1].ipt=10
Info[1].number=11
Info[1].sym="O"
Info[1].atno=8
Info[1].x=-2.2301338
Info[1].y=0.79886246
Info[1].z=1.089973
Info[1].name="O"
Info[1].model=0
Info[1].info="O 11 #11"
To check out how this works, see the temporary installation at
http://www.stolaf.edu/people/hansonr/jmol/test/json/json.htm
OK, now this is just an idea I'm working with. What I'm interested in
is others' ideas of what to implement here. Obviously anything that
can be currently "shown" should be implemented this way --
orientation, for example. What else?
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
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users