I am working on a "Jmol Tutorial-Authoring Template" (JTAT) which 
supports multiple Jmols. Each "View" button can display 1, 2, 3, or 4 
Jmols, each containing a separate molecule/view.

While JTAT is not yet ready for prime time, in view of the recent 
discussion of multiple Jmols I thought it might be timely to make the 
"JTAT Demo" available. Although parts of it are unfinished, the 
support for multiple Jmols seems to be working well.

http://bioinformatics.org/jmol-tutorials

See especially Chapter 3, Comparing Molecules Side-by-Side.

My strategy for the underlying javascript is as follows. I will be 
happy to provide the current working (largely undocumented) code to 
anyone who asks, and offer guidance by email.

An HTML division is reserved for Jmol(s) in the HTML of the page, but 
Jmol is not invoked at the outset.

On loading the page, the Jmol(s) are written 
(onLoad="showInitialView()" in the body tag). Initially, no molecule 
is loaded. A message command sends a message via messageCallback when 
each Jmol is ready. Receipt of this message (processCallback() in 
dvrblite.js) triggers sending a script to the respective jmol.

Each "view" is defined with a call to setupButton(...) in 
_jsutil/dualquad.js. This call specifies the number of molecules 
(Jmols, 1, 2, 3 or 4), the molecule (PDB file) to load, the rendering 
script filename, whether or not spinning should be inherited, on or 
off initially, and whether or not the background color is black or 
white. The latter 4 parameters are repeated for each molecule.

If this is the first view, or if the number of Jmols is different 
from the previous view, new Jmols are written (writeJmols() in 
_jsutil/dualquad.js). As part of initialization, I do 
jmolSetDocument(0), which means that Jmol.js functions that would 
otherwise write into the document simply return the HTML/javascript 
code instead. I gather this code (e.g. from calls to jmolApplet(...)) 
and when it is finished, I write it into the Jmol(s) division using 
an assignment to innerHTML.

When a new View button is pressed, if the number of Jmols is not 
changing, the Jmols are not rewritten, but simply receive new scripts 
(which may include loading a different molecule -- but the molecule 
is not reloaded when it is not changing). All this is handled by 
multiJmolClick(buttonNumber) (in _jsutil/dualquad.js).

The files in JTAT are organized so that the code common to all 
tutorials is separated from the code specific to a given tutorial. 
Multiple tutorials can exist in side-by-side directories, and all 
share one jmolApplet.jar + Jmol.js.

-Eric


/* - - - - - - - - - - - - - - - - - - - - - - - - - - -
Eric Martz, Professor Emeritus, Dept Microbiology
U Mass, Amherst -- http://www.umass.edu/molvis/martz

Top Five 3D MolVis Technologies http://Top5.MolviZ.Org
Biochem 3D Education Resources http://MolviZ.org
See 3D Molecules, Install Nothing! - http://firstglance.jmol.org
Protein Explorer - 3D Visualization: http://proteinexplorer.org
Workshops: http://workshops.proteinexplorer.org
World Index of Molecular Visualization Resources: http://molvisindex.org
ConSurf - Find Conserved Patches in Proteins: http://consurf.tau.ac.il
Atlas of Macromolecules: http://atlas.proteinexplorer.org
PDB Lite Macromolecule Finder: http://pdblite.org
Molecular Visualization EMail List (molvis-list):
       http://bioinformatics.org/mailman/listinfo/molvis-list
- - - - - - - - - - - - - - - - - - - - - - - - - - - */


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to