Bob,
Re iPad: Wow.
It's going to take me some time to figure this all out. Very nice.
Otis
--
Otis Rothenberger
o...@chemagic.com
http://chemagic.com
On Apr 12, 2012, at 6:39 PM, Robert Hanson wrote:
> Paul, first, check this out now:
>
> http://chemapps.stolaf.edu/jmol/chemdoodle/test2.htm
>
> I'd say that was a productive day!
>
> This page is even more interesting. Pending Jmol user reports, it should pull
> up a twiddlable model on all platforms. It's working on my iPhone, my Windows
> laptop, and my MacBook. I can force it into ChemDoodle WebGL mode within
> Chrome; I can force it into ChemDoodle nonWebGL mode in Firefox, Chrome, and
> Safari. Default of Jmol is working on all non-Java-challenged platforms (I
> still can't force it into ChemDoodle for MSIE, but the default is to use Jmol
> anyway for that platform, of course. I don't know if Kevin can get ChemDoodle
> going on MSIE. Doesn't look like my version will, but it looks like a simple
> error that is probably trappable.)
>
> OK, how it works: The key is found in
> http://chemapps.stolaf.edu/jmol/chemdoodle/JmolCD.js This is a very rough
> draft set of extensions to ChemDoodle. Basically a slight modification of
> ChemDoodle.MolGrabberCanvas (for when there is no webGL) and
> ChemDoodle.MolGrabberCanvas3D (when there is), and the addition of
> ChemDoodle.MolGrabberJmol (when you want to use Jmol instead). In addition,
> I've modified some of the transfer methods in ChemDoodle to allow raw data
> transfer -- no need for server-side conversion to JSON, so now you can use it
> with any generic relay server. And if it's the signed applet, of course,
> there's no need to go to the server for anything. The applet itself can
> deliver.
>
> From a Java perspective, it involves an update to JmolData.jar that allows
> for a new command:
>
> write CD
>
> that writes a (crazy! -- sorry, Kevin ;) ) format that involves scaling by
> 20 and inverting the y axis and putting it all in JSON format (that's for the
> WebGL version of ChemDoodle; the scaling is all undone in the browser) and a
> bit of clean-up in JmolData.jar so that the output is clean to sytem.out when
> you use the WRITE command when you use the -i (silent) flag. I'm using the
> exec() command in PHP, and it is working very nicely.
>
> JmolData.jar -- with the fixes I did for Jonathan for Sage involving the
> -Djava.awt.headless flag -- is also used to create static images, if that is
> preferred. That would be good, for example, if the website is serving up
> proteins, because there's a lot there that can't be done with ChemDoodle
> anyway, and maybe just an image would be better. At least for now.
>
>
> Paul, I might even suggest that the object-oriented Jmol.js we were thinking
> of the other day might be this ChemDoodle/Jmol hybrid. That way, we have, for
> example,
>
> c.MolGrabberJmol.prototype.loadMolecule = function(mol) {
> _jmolFindApplet("jmolApplet" + this.id).script('DATA "model"\n' + mol
> + '\nEND "model"');
> };
> c.MolGrabberJmol.prototype.script = function(script) {
> _jmolFindApplet("jmolApplet" + this.id).script(script);
> };
>
> and one could imagine expanding that slowly to allow a higher level interface
> to ChemDoodle in general as well that lets us have essentially a ChemDoodle
> command line like we have in Jmol. I realize that Kevin doesn't see a need
> for that, and if you don't have a popup menu and you don't allow user input
> to a command line or console, that's probably fine. But I think it's well
> demonstrated that those are very useful in Jmol.
>
> This is from test2.htm. The line
>
> molgrabber = new ChemDoodle.MolGrabberJmol('molgrabberJmol', width,
> height, ".",
> (useSigned ? "JmolAppletSigned.jar" : "JmolApplet.jar"));
>
> creates the applet.
>
> So it's all set up via ChemDoodle. From test2.htm we have as below. (I'm sure
> there's a simpler way to check if webGL is working, but that's what I came up
> with, anyway. Kevin can surely clean that up.)
>
> Check it out!
>
> Bob
>
>
> (function(width, height) {
>
> // logic is set as follows:
> // -- if Java is present and have Jmol.js, use Jmol
> // -- otherwise, if WebGL is present and have ChemDoodleWeb.js, use
> ChemDoodle/WebGL
> // -- otherwise, if ChemDoodleWeb.js is present, use ChemDoodle/2D
> // -- otherwise, just display the image
>
> // ?USECD or ?USEIMAGE in the URL can force one or the other of these.
>
> // and, of course, a little tweaking of the logic would let you do anything
>
> myModel = "morphine";
> var dontUseChemDoodle = (document.location.href.indexOf("NOCD") >= 0);
> var useChemDoodle = (!dontUseChemDoodle &&
> document.location.href.indexOf("CD") >= 0);
> var useImage = (document.location.href.indexOf("IMAGE") >= 0);
> var useSigned = (document.location.href.indexOf("SIGNED") >= 0);
>
> if (!useChemDoodle && !useImage && _jmol && navigator.javaEnabled()) {
> molgrabber = new ChemDoodle.MolGrabberJmol('molgrabberJmol', width,
> height, ".",
> (useSigned ? "JmolAppletSigned.jar" : "JmolApplet.jar"));
> molgrabberJmol_isReady = function(app,isReady) {
> if (!isReady) return;
> molgrabber.setSearchTerm(myModel);
> }
> } else if (!dontUseChemDoodle && !useImage && ChemDoodle) {
> document.write("<div id=moldiv style='display:none'>");
> molgrabber = new ChemDoodle.MolGrabberCanvas3D('molgrabber', width,
> height);
> document.write("</div>");
> if (molgrabber.gl) {
> molgrabber.specs.set3DRepresentation('Stick');
> molgrabber.specs.backgroundColor = 'black';
> document.getElementById("moldiv").style.display = "block";
> } else {
> molgrabber = new ChemDoodle.MolGrabberCanvas('molgrabber1', width,
> height, true);
> molgrabber.specs.bonds_useJMOLColors = true;
> molgrabber.specs.bonds_width_2D = 3;
> molgrabber.specs.atoms_display = false;
> molgrabber.specs.backgroundColor = 'black';
> molgrabber.specs.bonds_clearOverlaps_2D = true;
> }
> molgrabber.setSearchTerm(myModel);
> } else {
> var img = "<img width=" + width + " height=" + height + "
> src=http://chemapps.stolaf.edu/jmol/jmolpic.php?model=" + myModel + "&width="
> + width + "&height=" + height + "/>";
> document.write(img);
> }
> })(300, 300);
>
> On Thu, Apr 12, 2012 at 2:44 PM, Paul Pillot
> <paul.pil...@ac-orleans-tours.fr> wrote:
> How does this work ?
> It apparently makes a call to a php script hosted on stolaf's server. Does
> this php script itself calls jmoldata.jar server side ?
> And how does it replies ? by sending back a mol file or a chemdoodle JSON
> object ?
> -Paul
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>
> --
> 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
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2_______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users