The next release of Jmol (10.00.49) will include two new features:

(1) select/connect  (revised)

select (source atom selection)
connect <min distance> <max distance> <bond type> (target atom selection)

You specify:

a source atom selection,
a minimum distance (optional),
a maximum distance (optional),
a bond type (optional -- SINGLE, DOUBLE, TRIPLE, AROMATIC, HBOND, DELETE),
and a target atom selection

The command then connects (or disconnects) all atoms in the source
set to all atoms in the target set. It doesn't matter
if they were connected or not before this. Example:

select (atomno=3)
connect 1.4 1.6 SINGLE (oxygen)
connect 1.2 1.4 DOUBLE (oxygen)

connects atom number 3 to any oxygen > 1.4 and <= 1.6 Angstroms from it with
a single bond, and to oxygens > 1.2 and <=1.4 Angstroms from it with a double
bond.

example of use of connect can be found at
http://www.stolaf.edu/people/hansonr/jmol/test/json/connect.htm



(2) applet.getProperty("property","optional param")

This JavaScript function (where "applet" is an applet object)
allows direct reading of current applet properties, including:

----------------------------------
applet.getProperty("fileName")

 the full path to the file

----------------------------------
applet.getProperty("fileHeader")

 the PDB header or the second line of an XYZ file
 (we could expand this upon request)

----------------------------------
applet.getProperty("fileContents")

 the contents of the file

----------------------------------
applet.getProperty("fileContents","<filename>")

 the contents of some other file on the system

----------------------------------
applet.getProperty("atomInfo","<atom selection>")

 information for each atom in the selected set.

Example: applet.getProperty("atomInfo","carbon and within(1.5,oxygen)")
I'm betting someone will find a use for this!

Information returned is in the form of an array:

atomInfo=new Array()
atomInfo[0]=new Array()
atomInfo[0].ipt=2
atomInfo[0].number=3
atomInfo[0].sym="C"
atomInfo[0].atno=6
atomInfo[0].x=0.0567293
atomInfo[0].y=0.8527195
atomInfo[0].z=0.39231563
atomInfo[0].name="C"
atomInfo[0].model=0
atomInfo[0].info="C 3 #3"


----------------------------------
applet.getProperty("orientationInfo")

 the current orientation, expressed three equivalent ways:

orientationInfo=new Array()
orientationInfo.moveTo="moveto 1 -666 -641 381 54.7;"
orientationInfo.rotateZYZ="reset; rotate z -122.8; rotate y 50.3; rotate z 145.0;" orientationInfo.rotateXYZ="reset; rotate x -45.3; rotate y -24.6; rotate z 32.7;"


----------------------------------
applet.getProperty("transformInfo")

 the current transformation matrix:

transformInfo=[
 [0.76531374,-0.13044612,-0.6303013]
,[0.49099332,0.7515107,0.44063392]
,[0.41619936,-0.6466966,0.6391895] ]

----------------------------------
applet.getProperty("centerInfo")

 the current center

centerInfo=[-0.23140144, 0.61279976, 0.071704745]


----------------------------------
applet.getProperty("boundboxInfo")

 the current boundbox information

boundboxInfo.center=[-0.23140144, 0.61279976, 0.071704745]
boundboxInfo.edge=[3.1490116, 3.4308553, 2.4460702]

----------------------------------
applet.getProperty("zoomInfo")

 the current percent zoom

zoomInfo=85

----------------------------------
applet.getProperty("modelInfo")

 information about each model in the file. For example:

modelInfo=new Array()
modelInfo.modelCount=1
modelInfo.modelSetHasVibrationVectors=false
modelInfo.PATH_SEPARATOR=";"
modelInfo.PATH_KEY=".PATH"
modelInfo.models=new Array()
modelInfo.models[0]=new Array()
modelInfo.models[0].ipt=0
modelInfo.models[0].num=1
modelInfo.models[0].name="Caffeine"
modelInfo.models[0].vibrationVectors=false


examples of use of getProperty() can be found at
http://www.stolaf.edu/people/hansonr/jmol/test/json/json.htm

The output for any of the above properties that have "Info" in them
is in the form of a JSON (JavaScript Object Notation) string
(see http://www.json.org/).

The idea behind JSON strings is to provide a compact way of transmitting
data structures from one computer to another via "DOM script nodes".
I just thought this might be a convenient way of getting information
from the applet to a web application. As it turns out, it's perfect.

These strings are very easily turned into JavaScript structures
(as I've displayed above). To do this, one just does something like:

var applet=document.getElementById("jmolApplet0")
var Info=eval("("+applet.getProperty("orientationInfo")+")")

(Adding the parentheses before the eval() is essential.) Now

Info.orientationInfo.moveTo

is defined. If you do:

var Info=eval("("+applet.getProperty("atomInfo","*")+")")

then you now have a data structure

Info.atomInfo[]

that contains all the atom information in the model.

The basic idea here is to avoid callbacks. The information I've
started us off with replaces the "show" script command. I'm sure
there will be other properties we will want to consider including,
but this is enough for now. (bonds, for example?)

Enjoy!

-Bob Hanson

ps -- the use of JSON and DOM script nodes is a bit amazing.
Did you know that with this capability I could:

-follow every stroke you make, every molecule rotation, every button push,
 on any page I've posted.
-follow this by pulling up the same web page and just watching it all happen
 on MY computer as though you were sitting at it.
-control what happens on YOUR page -- I could rotate the model for you, for
 example, or change Jmol display settings.
-in effect, using getProperties() and DOM scripts, we could both really
 "be on the same page."

Don't believe me? Take a look at http://www.google.com/webhp?complete=1&hl=en




-------------------------------------------------------
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-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to