Thank you those of you who have been testing the Jmol/ChemDoodle mash-up.

So, just to summarize:

With (Objective? Modular? What are we going to call this? Jmol 13.0?) Jmol
you can create an applet and start sending it whatever script commands you
want immediately. You can create as many applets or ChemDoodle instances on
a page as you want (within reason), and you  can start them getting data
from a server simultaneously. The only need for appletReadyCallback is if
you are going to be querying the applet for information, and probably then
you should be using loadStructCallback anyway.

The preferred method of naming the applet is to define a variable as its
own name:

jmol = "jmol"

The only name you should not use is "Jmol" itself, with the J capitalized
like that. That is the name of the library.

While this looks odd, it allows you to do something very interesting: It
allows you to create buttons and such anytime on the page, before or after
creation of the actual applet. So you can do this:


  Jmol.jmolLink(jmol,"set picking dragMinimize", "on");
  Jmol.jmolHtml("  whatever  ");
  Jmol.jmolLink(jmol,"set picking dragMinimize off", "off")

  jmol = Jmol.getApplet(jmol, Info);

  Jmol.jmolButton(jmol,"if (!molname) { molname = 'tylenol'};var x =
prompt('Enter the name of a compound',molname);if (!x) { quit }; molname =
x; load @{':' + molname} #alt:LOAD :??Enter a model name","Load MOL
(PubChem)")


Notice that the definition of "jmol" changes after Jmol.getApplet().
Initially it is just a string, which is all the controls need. But after
that it is an object.

You have complete control over what happens on a mobile device or tablet.
You can have the page automatically replace Jmol with an image instead, or
for a simple twiddlable interaction, you can have it switch to one of two
flavors of ChemDoodle -- one that does not require WebGL or one that does.
The replication in ChemDoodle is going to be rather minimal, but certainly
in many applications a simple rendering may be enough. Do you want Jmol to
be replaced with an image instead? Do you want ChemDoodle to be used as the
backup? Or only if WebGL is enabled? You decide this with settings in the
Info object. A page that demonstrates this is
http://chemapps.stolaf.edu/jmol/chemdoodle/test2.htm . Check the JavaScript
there for details.

This implementation of ChemDoodle incorporates just two classes of canvas
(a 2D and a 3D version) from ChemDoodle into Jmol. You should be able to
use the standard ChemDoodle JavaScript library, specifically
ChemDoodleWeb.js or ChemDoodleWeb-unpacked.js. Do not use
ChemDoodleWeb-lib.js, which is simply a collection of third-party
JavaScript libraries. This is because the jQuery version currently in
ChemDoodle does not support AJAX on MSIE, which doesn't run ChemDoodle
anyway, but is important for full browser coverage in Jmol. Instead, you
need jQuery.min.js and two small packages, gl-matrix-min.js and
mousewheel.js. These are provided with the Jmol distribution. Note that all
of these have separate licenses from Jmol's. It is your responsibility to
abide by those licenses.

Both the ChemDoodle and the image-replacement features of this new version
of Jmol, as well as some more advanced database features of the unsigned
Jmol applet itself require some sort of server-side connection. I've
provided one, as illustrated in the test pages, and you can use that. But
if you have access to a server that runs PHP and Java, you can easily
implement it yourself, and that would be wise. It's just two files --
jmolcd2.php and JmolData.jar. You just put them on your server, and they
start working.

The page JavaScript can have detailed information regarding the
capabilities of the device. A good example of a page that does this is
http://chemapps.stolaf.edu/jmol/chemdoodle/simple2.htm, where the buttons
are totally different for a smart phone than for a laptop . The way this
works is that in the creation of the applet object you can specify with a
third parameter that you just want to run a test:

appletCheck = Jmol.getApplet("", Info, true);

This does not create an actual applet or ChemDoodle instance. Instead, it
creates the overall object according to the specifications in Info and lets
you investigate its properties, specifically it's type, which is one of
"_Applet", "_Applet (signed)", "image", "_Canvas3D", or "_Canvas". In
addition, there is a flag, _is2D, that also lets you know you are working
with the more limited version of ChemDoodle.

So, for example, you can do this:

    if (appletCheck._jmolType.indexOf("_Applet") >= 0) {

       [buttons specifically for the applet here]

    } else {

      [buttons specifically for ChemDoodle here]

   }

I have implemented a crude scripting capability for these ChemDoodle
representations. The way you do that is to create buttons and links as you
usually do in Jmol, now using Jmol.jmolButton() instead of just jmolButton,
Jmol.jmolLink() instead of just jmolLink(), etc. But in addition, you can
indicate an alternative script to use if ChemDoodle is in play. The call
looks like this:

    Jmol.jmolButton(jmol,"spacefill #alt:SETTING van der Waals Spheres",
"spacefill")

where "#alt:" is a signal to the library that the ChemDoodle canvas, if
present, should be able to process this script with what follows that. It's
pretty minimal, but we could expand it if people like the idea. Check in
JmolCD.js for options, which currently just include SETTING and LOAD.

That's where we are at with that.

Many thanks to Paul Pillot for doing the lion's share of the coding for
converting the old Jmol.js (which is no longer necessary) to this new
version of Jmol.

Bob

-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


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
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to