Sunday, December 19, 2010

ChemDoodling on the iPad and the future of interactive chemistry textbooks

Interactive model of morphine

I have bought an iPad!  In honor of this purchase I bring to you this blog's first interactive figure that also works on the iPad (and most other mobile devices).  It is made with ChemDoodle Web Components (a modified version of this page), an open source javascript based toolkit for chemistry, made by Kevin Theisen and co-workers at his company iChemLabs.

Readers of this blog will know that I am quite fond of Jmol for interactive molecular models, but Jmol is written in Java, which is not supported by the iOS operating system that iPads, iPhones, and iPods use - and perhaps it never will be.   This decision by Apple basically means back to square one for interactive chemistry when it comes to the iPad.

I know of just two options for interactive models for the iPad: the Molecules app by Brad Larson and ChemDoodle Web Components (TwirlyMol does not appear to be interactive on the iPad).  The Molecules app looks a bit more three dimensional, but works only on the iPad.  Chemdoodle Web Components should work on most browsers and most operating systems, and a fully 3D version is also available.  The 3D version of ChemDoodle Web Components requires something called WebGL, which is not available in standard browsers yet, but should be soon.  You can get access to it now by downloading Google Chrome (BETA).

It is the Molecules app that is used in the interactive text book from Inkling that I wrote about earlier (thanks again to Henry Rzepa for the info).  But I think ChemDoodle Web Components holds tremendous promise for interactive chemistry textbooks when combined with another new innovation on the horizon: EPUB3.

Epub is basically code that makes XHTML look nice when viewed in an epub reader (such as iBooks), but the current version does not allow for things like javascript, needed for interactivity.  That will change with epub3 and, when combined with ChemDoodle Web Components, should allow us to make interactive chemistry textbooks that can be read on most devices.   It will be an exciting time.


Henry Rzepa said...

Well, Apple certainly want to move away from custom solutions to (HTML5) standards, and this page, which is (mostly) device agnostic is a lovely example of this working in chemistry.

But I have one question. Morphine in your example is constructed from JavaScript components and data (coordinates). Together, they produce a 3D model (I note that presumably one reason this works so well nowadays is that Javascript engines are so much faster than they used to be, often perhaps 100 times so). But right from the start, I have felt one other key ingredient was essential, what I call data-round-tripping. The need for this was recently illustrated with some real science and also here. I have only started looking at ChemDoodle myself recently, and still do not know much of its capabilities. One of these might be whether the data could be extracted from the ChemDoodle model, and saved to disk (or to a local iPad in some manner; iPads do not have file systems in the way we know them) for e.g. re-use in some other context? Would it be possible to enhance your morphine display with some means of extracting the coordinates? It would of course have to be done in a secure manner (which Jmol does by using signed applets). Is this possible?

Jan Jensen said...

Good question! I have passed your question on to Kevin Theisen, but one way to get to the coordinates is by viewing the page source. Not the ideal solution, so hopefully Kevin will enlighten us further.

Unknown said...

Just FYI... The morphine 3D thingy works perfectly on my Android phone too! Sent from my HTC Legend.

Jan Jensen said...

Thanks for that! I was wondering

Anonymous said...

Did you draw the unnatural enantiomer of morphine on purpose? :)

Henry Rzepa said...

Although only a rumor and vapourware, this link offers some interesting 3D possibilities for the future!

Jan Jensen said...

Henry: very cool! Once again gaming is driving scientific visualization.

On a somewhat related note Rich Apodaca has an interesting post on bringing Jmol to the iPad.

Jan Jensen said...

Anonymous: D'oh! :)