From: Robert H. <ha...@st...> - 2012-10-13 04:21:25
|
Jmol Developers -- Some of you may know that since the end of August, after coming back from the ACS meeting in Philadelphia, I became convinced that we needed to explore ways of taking Jmol to the next level -- the JavaScript/HTML5/WebGL level. I began experimenting with various ways of doing this -- first with Google's web toolkit (a disaster), and then with compiling Jmol into JavaScript using the amazing package Java2Script, created by Zhou Renjian. If you have followed my code check-ins at all, you know that this has involved a substantial amount of refactoring of the Java code, and that was a challenge, but it was worth it. Today I can point you to a not-exactly-fully-functional version of Jmol (we are calling it JSmol or maybe J2Smol for now) that uses WebGL for its rendering (based on GLmol, by Takanori Nakane). With the help of a St. Olaf student, Duncan Blue, we are busy testing this and, of course, finding problems daily. But the enormous progress just these last few days prompts me to let the cat out of the bag. http://chemapps.stolaf.edu/jmol/jsmol/test2.htm Consider it alpha. I do believe we have solved some of the LONG standing problems with JavaScript-only molecular visualization. For example: - All ASCII file readers should work exactly as in Jmol itself (tested so far: XYZ, MOL, PDB, CIF) - VDW surface and solvent-accessible surface creation is no problem - partial charge calculation using MMFF94 is implemented - MEP mapping of isosurfaces works beautifully - JVXL surface files are read just fine - SMILES/SMARTS matching works - all database access (RCSB, PubChem, NCI-Cactus) is exactly as in Jmol/Java - protein and nucleic acid cartoons work just fine - LCAOCartoons work just fine - "load append" and multiple file loading/frames are no problem - Jmol scripting is fully implemented - Jmol math is fully implemented The list goes on and on. (Though obviously there are bound to be some limitations.) Some of you will recognize that many of these capabilities (all of these capabilities?) are completely unheard-of in JavaScript. This goes way, way beyond what any currently available JavaScript-only option provides. There are no server-side tricks being played here. It is just exactly as client-side as the Jmol Java applet itself. Surfaces are being calculated and mapped on the fly, and they look and handle almost as well as in Jmol itself. I know others have struggled for a long time to do this, and all I can say is that Java2Script is amazing. It took a bit of optimizing and adapting, some careful coding, but in the end that library just flies. We are fully autobonding a protein in 125 ms, creating VDW surfaces for small molecules and even proteins in about 1-3 seconds. It's really something to behold. What's absolutely amazing about this is that I have not created a new program at all. "All" I've done is used Zhou's incredible Java-to-JavaScript compiler to allow the Jmol trunk Java code to be turned into a JavaScript alternative at the click of a button within Eclipse. The Java classes and Jar files are all still there. It's one development stream. It's really very bizarre. But, wow, does it work. And the code management is a snap -- There are not two versions of Jmol here -- there is just the trunk Java version code that can be compiled either into class files or their JavaScript alternatives. The debugging it totally bizarre -- stepping through the compiled Java/JavaScript code using Firebug. Who'd have thought it possible?? What we have is a perfect combinations of efforts -- Zhou's compiler, Takanori's GLmol interface, and Jmol. I cannot overemphasize the importance of the contributions of these two guys. Perhaps some day we can meet, but already I can tell you that none of this would be possible without their obviously huge efforts. I have to tell you that this has been perhaps the most exciting, rewarding, and at the same time totally weird two months of my life. Seriously, two months ago I thought there was absolutely no chance we were ever going to see Jmol transcend Java, and, in fact, I argued that it couldn't be done, but here we are - surfaces and all! I'm still catching my breath. Go ahead and exercise it some if you want on that test page. Explore the code. Don't expect perfection -- this is definitely a work in progress. I'm off to Washington, D.C., to spread the word... Bob ps: TODO includes draw, labels, echos, animation, spinning, minimization, MOs, binary file loading, and a number of other things. -- Robert M. Hanson Larson-Anderson Professor of Chemistry Chair, Chemistry Department St. Olaf College Northfield, MN http://www.stolaf.edu/people/hansonr 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 |