Wednesday, June 24, 2009

Nicking transition states from Nick Greeves

Nick Greeves has made a wonderful website called ChemTube3D. And I mean this quite literally, the site is full of wonders: Jmol-animated reaction mechanisms for the most important organic reactions.

I especially like the way the usual 2D representations of reactions are tied to the 3D animation: you click on 2D structures to see 3D structures and "electron pushing", and on arrows to animate the reaction. This really drives home to the point that the static 2D pictures is meant to represent a dynamic 3D model. I wish this has been available when I took organic chemistry, which, somehow, wasn't made any easier by the fact that half the reactions hadn't been discovered yet.

In case you are curious how Nick obtained the structures along the reaction path, you can find the detailed instructions here. Generally speaking, they are obtained by finding the TS of the reaction and then following the atomic forces downhill to reactant and products using the intrinsic reaction coordinate method. This is done in the absence of solvent so for some reactions involving ions there is no barrier (and hence no TS) in the gas phase.

Because Jmol is used, the user can interact with the model, rotate, zoom, measure distances, and access the coordinates! That's right, ChemTube3D is also a transition state (TS) repository, and in the screencast I show how use Avogadro to extract the TS structure. But because the "TS part" of a TS is usually confined to a few bonds, one can use Avogadro to add substituents and create more complex TSs as well.

When I run the input file (which you can find here) that I make at the end of the screencast, GAMESS finds the TS in 20 steps (though I had to remove the $FORCE group which is inserted erroneously by Avogadro).

Finally, Steven Bachrachs blog is another good source for TS structures (many images link to a Jmol display of the structure). Look under the Reactions category in the left-hand column.

Tuesday, June 23, 2009

Vote early, vote often

Ever feel a tinge of guilt when you download a fantastic piece of software like Avogadro for free (Blank). Me neither! Free software is my God-given right. Voluntary contributions? Upgrading to the expert version? Provide feedback? So long, suckers!

That being said, if you enjoy using Avogadro, here's chance to give Geoff, Marcus, and the rest of the Avogadro Gang a real pat on the back for all the countless hours they spent on the program.

Avogadro has been nominated for the Source Forge Community Choice Award in the "Best Project for Academia" category. Please vote for them at It's free, but you'll need an account on Source Forge (Blank). But that is also free (Blank).

Thursday, June 18, 2009

A useful equation


This is a useful equation. Remember it, and your life will change for the better. The equation comes from one of the fundamental equations of statistical mechanics,
as you can see here

Both equations tell you how the energies of molecule A (EA) and B (EB) determine how many molecules of each (nA and nB) you will observe at equilibrium.

Eq (1) is simply a much more useful form of (2) for room temperature conditions, because it gives you a feel for what the relative energies mean in terms of chemistry. Yes, with a little practice you will be able to amaze and astound your friends.

An energy difference of 4.5 kcal/mol? Why, that means 0.001 times less B than A. 6.0 kcal/mol? 0.0001! The trick is to recognize that 1.36 is close enough to 1.5, and that 4.5/1.5 = 3 and 6.0/1.5 = 4, meaning that the energies correspond to concentration ratios of roughly 10-3 and 10-4, respectively. Respect, indeed! You'll be the life of the party.

You could of course use a calculator to get more accurate results, in which case you might as well use Eq (2). But if you routinely bring a scientific calculator to parties, then you have more serious problems to worry about anyway.

The astute reader will note that I made things pretty easy for myself by picking 4.5 and 6.0 kcal/mol, and that dividing, say, 5, by 1.5 is no mean feat. But at least you'll know that the answer is somewhere between 10-3 and 10-4, and that's often all you need.

If you believe in the metric system (Blank) you may prefer to work in kJ/mol, in which case 1.36 should be replaced by 5.70 and approximated by 6.

You can do the same party trick with rate constants by using transition state theory,

A barrier of 6 kcal/mol?, why that's a whopping 109 per second! 20 kcal/mol? Here it's a good idea to sip your beer, to stall for time ... 0.1 s-1, of course! I usually count by 3's (2 times 1.5), 2o is close to 21, 7 times 3, 14 times 1.5, meaning 1013-14, 10-1. Get me: I'm Richard Feynman!

On a different note, I firmly believe that animations similar to the screencast in this post could be used to make derivations much more accessible to students. I haven't been able to find any software to do this and I think this is a gaping hole in the world of software. I made the screen cast with Powerpoint, and there were many, many things I would change about if ppt would let me.

In case the notion of animated derivations strikes you as crazy, I leave you with a quote from Richard Feynman's aptly named book What Do You Care What Other People Think:

"When I see equations, I see the letters in colors – I don't know why. As I'm talking, I see vague pictures of Bessel functions from Jahnke and Emde's book, with light-tan j's, slightly violet-bluish n's, and dark brown x's flying around. And I wonder what the hell it must look like to the students."

Monday, June 15, 2009

The force is strong in this one

Here's a Jmol application I wrote to illustrate energy minimization/geometry optimization during a lecture in a molecular modeling course. Specifically, I wanted to illustrate how the atoms are displaced along the atomic force.

The arrows you see are the forces (or the gradient for the "start/gradient" button), which are the negative of the gradient (the derivative of the energy with respect to coordinates). The scale of the arrows relative to the scale of the molecule is arbitrarily adjusted to look nice. By clicking the buttons you are taken through the 8 steps it takes to reach a minimum. Select "wireframe" first to see the arrows more clearly.

Note that while the energy always goes down, the force vectors actually increase in the early steps. This is because if you simply displace the atoms along the arrows (i.e. perform the optimization in Cartesian coordinates) to decrease the angle, you also decrease the O-H bond length (which were fine to begin with). This increases the force on the atoms initially. However, as we get closer to the minimum the optimization fixes this.

The steps to create this Jmol application were as follows:

1. I performed the optimization with the GAMESS program at the PM3 level of theory (you can find the output file here).

2. I then wrote a python program (available here) to extract the geometries and gradients from the file and create the xyz+vib file that Jmol displays. The xyz+vib format is the normal xyz format (atom symbol, x, y, z coordinate) followed by the x, y and z component of the vector. You can access this file through Jmol as shown in a previous post.

3. I then created the html code, where I played around with scaling the vectors until everything looked nice. I finally decided on a scale factor of 10. You can access this html code as shown in a previous post.

PS: Very small arrows are not places correctly on the atoms. I think this is a bug in Jmol.

Sunday, June 14, 2009

Just one of those links

Every once in a while you come across a web page that really blows your mind. This is one of them. My first reaction was "I have to learn how to do this!", and this is what really got me interested in Jmol. It took a while, but eventually I came up with something a little bit similar (helped in no small part by this excellent tutorials page) and showed it to everyone that came within shouting distance. You can watch it on a separate page or click on the image here.

In a previous post I showed how to get the coordinate file and the html code. However, the set of commands for this animation is too lengthy to include in the html, so I used a separate script file, which can be downloaded here.

The script is kind of long but of most the lines are actually the same commands used over and over again. For example, here is how I go from a spacefilling model of the protein to just the backbone chain:

select protein
spacefill 400; wireframe 0.0; trace
spin on
set echo top center
echo A protein is long chain that is folded| in a certain way
delay 2
spacefill 300; wireframe 0.3; trace; delay 0.2
spacefill 200; wireframe 0.3; trace; delay 0.2
spacefill 100; wireframe 0.3; trace; delay 0.2
spacefill 0.0; wireframe 0.3; trace; delay 1.0
spacefill 0.0; wireframe 0.2; trace; delay 0.2
spacefill 0.0; wireframe 0.1; trace; delay 0.2
spacefill 0.0; wireframe 0.0; trace;
delay 5
spin off

The key command here is "delay x" which stops the script for x seconds and this is what drives the animation forward. x is what you play with (endlessly).

Then there is the "moveto" command which does the cool repositioning.

echo Let's have a closer look at BADX
moveto 1.0 { -109 890 -443 149.21} 245.66 0.0 0.2 {32.302 28.212 29.408} 45.037945 {0.0 0.0 0.0} 42.396088 -68.80987 50.0;

The input to the moveto command looks very intimidating, but can be generated very easily by the "show moveto" command, as I show in this screen cast.

Finally, the subject of the animated presentation is an ongoing research project. Just like in teaching, animation can be used to bring across very complicated and detailed points to the viewer. Imagine explaining the content of this animation in words! I think molecular animation is a powerful, and overlooked, recruiting tool - as long as there is some kind of guiding narration. So you can also find a link to the animation on my research page.

I have also used snippets of the animation in research talks. But there I have broken the animation into segments, and installed buttons so I can control the timing, using html. More about this in a later post.

Thursday, June 11, 2009

It takes a village to solve a Jmol puzzle

(Click-drag on the image to rotate the molecule!)

The past few days I have been trying to put Jmol animation into the blog. I knew this was possible because of the pioneering efforts of Felix over at Chemical Quantum Images.

His post on vibrations in p-cresole has been a long-time inspiration. I found the entry through google because I was interested in animating vibrations with Jmol, and it taught me a lot about that.

But more importantly, it was the first blog I came across where someone talked about the details of their computations and showed images resulting from the computations simply because they were beautiful. So Chemical Quantum Images was a major inspiration for this blog. Thanks, Felix!

And now, through the comments to that post, and some very helpful suggestions by Noel over at Noel O'Blog (thanks, Noel!), I now also know how to embed Jmol within this blog. Noel pointed me to another way of doing it, via a Microjmol Widget application written by Jeffrey Moore and that provided me with the penultimate piece of the puzzle.

Anyway, just in case anyone else is interested in doing this: the text I put into this blog window to generate the Jmol window can be found below. Note that this will not show up in Preview, only when you post (and that was the final piece of he puzzle).

<script src="" type="text/javascript"></script> <script type="text/javascript"> jmolInitialize(""); jmolApplet(300, "load;");jmolBr();jmolButton("spin y" ,"spin y");jmolButton("spin off" ,"spin off");<br /></script>

Wednesday, June 10, 2009

Symmetry Prozac

Molecular symmetry has newer been my strong suit. I do fairly well with C1, but my palms already get sweaty at Cs, and upper-lip-trembling and not-so-silent whimpering occurs with any point group involving a sigma-h plane ("what is that sound ...?"). S2? Don't go there.

So you can imagine I was delighted to find Dean Johnston's symmetry server. It's Jmol based, so it is very interactive and intuitive. I put a small snippet of screencast in this post but you should really check it out for yourself. (I should note that because of the implementation it is not possible to access the coordinates - thanks to Dean for getting back to me on that one).

Molecular symmetry is actually a great example of how molecular animation can help make things clearer. I can't remember a single explanation of symmetry that didn't involve the phrase "now imagine rotating the molecule ...". Now you don't have to.

Saturday, June 6, 2009

An Atkins diet of Molecular Workbench

In a recent post I showed an example of how to use Molecular Workbench (MW) in a p-chem lecture. The idea with that post was to keep it simple. Here I'll tell you what I actually prepared for the lectures, but the main point is really to draw your attention to the MW simulations, which are simply wonderful.

I had two back-to-back 45 minute lectures to cover chapter 16 in Atkins et al.'s Quanta, Matter, and Change on physical equilibria, i.e. phase changes and diagrams, chemical potential, colligative properties, ideal solutions, activity, etc.

So, I scoured MW for simulations related to these topics and created a new MW document with a list of the simulations I wanted to show during lecture (the screencast shows how), which can be found here. If you use MW as your "browser" loading new simulations is much faster than, say, powerpoint.

I'll say it again: rhe main point of this post is really to draw your attention to the MW simulations, which are simply wonderful. They really bring rather abstract points (like the deviation from non-ideality) or complex behavior (like osmosis) to life, and helps keep everyone awake (including myself). I should say that thermodynamics was not why I fell in love with science.

Btw, we're using Atkins Quanta for the first time, and I find it a great improvement over his P-Chem book in the thermo-department. Most references to steam engines and phase rules are relegated to various addenda in the back of the chapters. This was clearly a painful decision, as this quote attests to

"One [point] is that one of the most celebrated results in chemical thermodynamics. the phase rule, can be used as a basis of discussing the implications of the phase diagram, but it is not essential. It is described in Further Information 16.1."

I always found lecturing on steam engines and other celebrated results of thermodynamics a bit like Mr. Burn's attempt to send a telegram to the Prussian Embassy in Siam by first aerogyro: a tad dated. And on that note, I believe it is time to 23-skidoo.

Friday, June 5, 2009

Some Jmol basics

Here is a Jmol application I wrote to illustrate rotational and vibrational energy states (in HCl) during a p-chem level lecture on energy states and statistical mechanics. You can find it here.

There are 3 main points:

1. It's an example of how you can use Jmol to visualize molecular motion. Maybe you like it and want to use it, or get inspired to do something much cooler.

2. The vibrational mode comes from a GAMESS calculation, and I show how you can access the GAMESS output file directly from Jmol. (Note you can get the coordinates of any molecule displayed with Jmol that you find on the web that way.)
November, 2010: In newer versions of Jmol the menu has changed a bit.  You now access the coordinates from "About" at the very bottom of the menu.

3. As with many web pages, the underlying html can be accessed from the browser.

So you have everything you need to reconstruct this example if you want. Of course you need to install Jmol on the computer that hosts the web site, and the GAMESS file needs be in the same directory as Jmol (at least on my web server).

The increases in rotational speed (100 and 1000) and vibrational displacements (0.1, 0.5, and 1.0) that I chose in the html code are completely arbitrary. I thought this got the point across. Click here for a complete list of commands.

A more complicated example (H2O) can be found here.

Thursday, June 4, 2009

Do I have to draw you a phase diagram?

(I suggest zooming in on your browser before watching, or click here)

This screencast shows an example of how to enhance a physical chemistry lecture using Molecular Workbench (MW) by showing an animated phase diagram: search MW for what you need and create a link for your powerpoint or course page.

In order for others to view the simulation from the link, they need to install MW on their computer. Remember this is not a movie but a simulation run in real-time.

If you are at a school that boasts a "deep commitment to enhancing the educational experience of every students" but doesn't provide an internet connection in your classroom, I suggest installing the off-line version of MW on your machine as well.

Cool new build option in Avogadro 0.9.5

Avogadro version 0.9.5 has been released. You can read more about it in the release notes and Marcus' blog.

In addition to full translation in Indonesian (terima kasih) is has a cool new build feature where you can switch elements via the keyboard (see screen cast) by just typing, say, "o" or "n". This will save a lot of time.

I also tried typing "2" to see of it would switch to double bonding but no luck (kutukan!). Maybe in the next release?

Building a Transition State

One of the coolest things about molecular modeling is finding the structure of a transition state (TS). It's nearly impossible to do experimentally, and it tells you so much about the reaction mechanism, clues to making catalysts, etc.

You can draw the most crazy initial guess structures for the reactants and products, and upon minimizing in Avogadro you will still have something reasonable. But there are no general force fields that can handle TSs so you have to make the TS guess much like you make a bonsai tree: small adjustment applied with infinite patience, and plenty of water.

The screencast shows how to make a guess for the TS of the Sn2 reaction F- + CH4 => CH3F + H- in Avogadro. The point is not how to choose the TS geometry but how to make it in Avogadro once you have decided what is should look like (how to do that is the subject of another post).

Once the guess is build you need to compute the vibrational frequencies to see if there is an imaginary frequency, and I show how to set up a GAMESS input file for such a calculation at the MP2/6-31++G(d,p) level of theory.

(The screencast was made with Avogadro 0.9.4. 0.9.5 has just been released and looks a little bit different. I haven't even published this post and it is out of date. Welcome to the blogosphere).

Wednesday, June 3, 2009


My first screencast! OK, actually it is my 3rd. The first one was a movie of my cursor moving around on the screen (I'm saving that for the bloopers reel), and in the second (my first real attempt) I forgot to move a window. The fact that I got this on the 3rd try tells you something about how easy it is to do this (though adding the comments takes a little time).

Anyway, this screencast gives a very brief overview of molecule-building with Avogadro and setting up a GAMESS input file.

Tuesday, June 2, 2009

Tools of the trade

Here are some wonderful programs that I use all the time in teaching and research (all programs are free and work on Windows, Mac, and LINUX):

I use Avogadro for building molecular structures and setting up input files for GAMESS (see below). Avogadro is still in beta version but quite close to "1.0" release. The main practical result of this is that there is very little documentation, and no real manual. Fortunately, Avogadro is very intuitive and there are a few screencasts that are quite informative (though I say so myself - some of them are mine).

I use GAMESS for quantum chemical calculations. It is not yet possible to submit GAMESS input files created in Avogadro automatically to the GAMESS program, so you must save the input file in Avogadro and submit the GAMESS job from the command line.

I visualize the GAMESS results by opening the output files in MacMolPlt (which also works on Windows, and LINUX despite its name). Much of what I do with MacMolPlt could also be done with Avogadro or Jmol (see below), but MacMolPlt is written specifically for GAMESS so it has some features lacking in the other two programs.

I usually do anything to do with structure in teaching with Jmol. Jmol is written in java, so the students can interact (rotate, zoom, download coordinates, etc.) with the models I post on the web. Furthermore, Jmol has a very powerful scripting language that allows one to create animations and control the animations via html. Note that virtually anytime you see a Jmol model on the web you have access to the coordinates by clicking on the window while holding down the ctrl key.

Finally, for anything to do with molecular dynamics I use Molecular Workbench in teaching. This wonderful program is molecular editor, MD engine, and analysis tool wrapped in one, and comes with a powerful scripting language. It is a bit like Avogadro/GAMESS/MacMolPlt/Jmol wrapped in one, but for MD instead of quantum chemistry. I'll show several examples of MW on this blog.

As you will see in future posts, I am a great fan of screencasts rather than written manuals and tutorials. Ironically, for screencasts I use a program that is neither free (it costs $100, ... ok $99) nor cross-platform (it works only on Macs running Leopard) called ScreenFlow. I am sure there are free alternatives, but based on what I read on google, this is by far the easiest to use. I can certainly testify that it is very easy to use.

Getting started

In this blog I will catalog various examples of how to get started with molecular modeling and how to use it in chemical education.

The title of the blog reflects that of a book I am working on and that will be published by CRC press in 2010.