Author, Publisher, Developer, Stitchcoder

Blog

The Wonderful World of Molecules

My new app Molecules is Editor's Choice as of today! (This lasts a week.) That means Apple thinks it's the best new iPad app this week, and who's to argue with them, eh? (Oh, and the print edition is currently #20 on the New York Times Science best-…

My new app Molecules is Editor's Choice as of today! (This lasts a week.) That means Apple thinks it's the best new iPad app this week, and who's to argue with them, eh? (Oh, and the print edition is currently #20 on the New York Times Science best-seller list. OK, it's not the main list, and it's only #20, but still...it is the NYT!)

Molecules exist on a scale far smaller than the wavelength of visible light: Seeing them is a physical impossibility. And the tempo of their dance, set by the vibrational frequency of a bonded hydrogen atom, is about a thousand million million beats per second. 

It seems like an untouchable world, but with clever software and clever devices, we can come close to dancing with the molecules, joining them in their world and learning their ways first hand.

This is what we've tried to do with the iPad/iPhone App edition of my book, Molecules.

The print edition of Molecules is a very nice thing indeed (and if you don't have a copy, that's a problem you might want to consider addressing). But the App version is something quite remarkable. I think it's going to change the way many people think about molecules, by making it possible for anyone with an iPad, iPhone, or iPod Touch to inhabit the world of molecules and relate to them on their own terms.

I should say first that the Molecules app is a full ebook edition of Molecules. It's got all the text and all the pictures from the print edition, and it's worth it just for that. Here's a gallery of screen shots from the app:

And here's a spiffy trailer video we made for it:

But what really sets the App edition of Molecules apart is the wiggling molecules.

How this aspect of the App came about is kind of a fun story. I'd been thinking that it would be really nice to let people see how molecules actually behave, and it seemed like iPads and iPhones should be powerful enough to simulate at least simple molecules. I considered having the excellent team at Touchpress write a very simple simulation engine that faked, in a semi-realistic way, the forces acting between atoms in a molecule. But I really didn't want to do that, because the resulting simulations would not be "real", and you could not rely on the intuitions gained from playing with them. Writing real molecular dynamics simulation code is not an afternoon project.

Then my girlfriend Nina forced me to go to a New Year's Eve party at the house of some people I didn't know (which is definitely not my thing, especially since I was told that dancing would be involved). But it was OK, they had carrots, and while chatting with a nice couple, Barry and Deanna, the conversation soon turned to molecular dynamics (it's that kind of town). I discovered that one of them worked in a research group at the University of Illinois that happened to work on just the kind of software I was looking for (this university being why it's that kind of town).

Several days later, after hours of further conversation, I discovered that this particular group was the Theoretical and Computational Biophysics Group, headed by none other than Klaus Schulten, who I randomly happen to have known for over 30 years, since he spent a summer living in my parent's house! For some reason it never clicked in my head to talk to him until I randomly ran into one of his associates, which made me really glad I randomly agreed to go to that party (and I didn't even have to dance!).

So thus it came to be that the Molecules iPad app contains a full, robust implementation of the NAMD simulation engine, one of the most sophisticated pieces of software in the world for modeling the behavior of molecular systems. Normally it is run on building-sized supercomputers, modeling the behavior of giant biological macromolecules with hundreds of thousands of connected atoms. But we use it to let you tie knots in much smaller molecules, up to a few hundred atoms.

NAMD simulations are "real" simulations. By that I mean that when you see them, you are seeing very close to the real behavior of actual molecules, just slowed down by a factor of about 10^12, and magnified by a factor of about 10^8. You can gain a lot of intuition and understanding of the properties of molecules by playing with them this way, and that intuition is real, that understanding useful.

Playing with molecules also turns out to be surprisingly fun. It was delightful each time we got a new molecule working, because I could try out things like how hard it is to flip around a double bond, or whether you could tie a knot in a molecule. (The answer is yes, you can, as long as it's one of those long thin ones. Maitotoxin is pretty easy to get into a knot, while some of the fatty acid esters in beeswax are trickier.)

Once you have a molecule in a knot you really appreciate the thing that our iPad implementation of NAMD has made possible for the first time ever (that we know of): Multi-touch interactive molecular dynamics. That means you can use two fingers to pull opposite ends of the molecule and tighten the knot!

You see, NAMD is generally run on workstation computers, and interactivity is through a mouse (just one) or a haptic feedback device (again, only one). The haptic devices are cool (they let you "feel" the molecule through virtual force feedback as you poke it), but it's really hard to tie a knot with just one "finger" at a time. Our iPad implementation lets you touch and pull on the molecule in up to 11 places at once (the maximum number of touch points supported by the iPad screen). No one has done that before, and it's every bit as cool as it sounds.

It's not just knot-tying that benefits from the multi-touch interface. For example, I was very eager to get my fingers on the indigo molecule:

See the double-bond in the middle that joins the two identical halves? Double bonds don't allow free rotation, but rotation is possible if enough force is applied. I wanted to see if I could pin down one half of the molecule with a few fingers (locking that half in place), then use my other hand to flip the other half of the molecule around. I could imagine this in my head, but would it actually work?

Yes, it works like a charm. You can quite easily flip this molecule so the two red oxygen atoms are both on the same side (which is not the way indigo is supposed to be). You can then use the temperature slider to heat the molecule up until it eventually flips back again: The orientation with one oxygen on each side is more stable because two hydrogen bonds form across the two halves of the molecule when it's arranged that way. (Don't worry if this doesn't mean anything to you, it's still lots of fun to play with the molecules anyway. I mention the bit about hydrogen bonds only to show off the fact that NAMD is actually simulating them correctly, which is pretty cool if you know what hydrogen bonds are.)

Members of the Theoretical and Computational Biophysics Group at the University of Illinois who all helped create the interactive molecular simulations in the Molecules app. Sadly not pictured are Klaus, the head of the group, and Barry and Deanna, all of whom were out of town on the release day.

The App has over 350 molecules you can play with, all drawn from the text of the book (which means in most cases there's also a photograph of what the substance looks like on a human scale). This doesn't just happen: Each molecule has to have a "force field" created for it, which encodes the unique profile of forces created by the quantum mechanical interactions of the electrons in the molecule. Sometimes this is easy, sometimes it's a real struggle, and I am tremendously grateful for all the work put in by members of the research group, Deanna, Barry, and Chris in particular, who created these force fields.

Being able to interact with individual molecules really drives home how much of chemistry boils down to mechanics. By getting a feel for how they work, you take a step towards understanding how they will behave in chemical reactions, which is the ultimate goal of most of chemistry (and, coincidentally, the subject of my next book, Reactions, due in 2016).

OK, to be perfectly blunt, what I'm saying here is that if you are at all interesting in understanding how chemistry works, you should really get this app. I'm not kidding: I learned more from ten minutes of playing with these simulations than I did from years of studying chemistry, which, incidentally, included a year in graduate school at Berkeley running molecular dynamics simulations on their Cray 1 (yes, I'm that old). Back then the output of the simulation was tables of numbers, not the living, breathing, wiggling, jiggling, dancing, delightful bundles of joyful atoms you see in this app. Sure, this technology will make it into other apps in the future, probably cheaper ones, but don't you want to see it now? Come on, be the first on the block with the new wiggling molecules! I guarantee you will think it was worth every penny. Plus, you get the complete ebook version of Molecules, which is easily worth the price by itself.

Here's a convenient link to the App Store.

 

 

 

 

Theodore Gray4 Comments