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.

Saturday, December 11, 2010

Computational chemistry exercises

Someone (I'll call him N. O'Boyle ... no, too obvious ... Noel O.) wrote me asking if I had any computational exercises I'd be willing to share. Since I took the trouble of writing him back, it occurred to me that I had free blog material. Here's my reply in a slightly edited form.

When I taught a computational chemistry course in Iowa I used exercises from "A Laboratory Book of Computational Organic Chemistry" by Warren Hehre et al., and Spartan in those pre-Avogadro days. Specifically experiments 4, 11, 34 and 76.  See here for an example.  The computational component of the other half of the course was individual research projects.

I would assign an experiment on a Monday, discuss it the following Monday, and have a write-up due  the Monday after that. I graded the first write-up (of exp 4) very lightly and then gave the student this example write-up of exp 4 so they could see how how to do it.  I also made this check list for a report and a list of questions for each experiment (taken from the book): exp 4, exp 11, exp 34, and exp 76.

Here in Copenhagen I co-teach a similar course with 5 other people, so I just get 1-2 exercises a year, and here I try to fit the content of the exercises in with the other instructors and the topic I cover. I teach the chapter on DFT and here I have developed an exercise using bond energies.

Sometimes I also teach the chapter on geometry optimization and then I use exp 76. Other instructors use Gaussian/Gaussview so that's what the student tend to use here too, so I have made no tutorials to go with the exercises.

"Exercises" in Molecular Modeling Basics: In Chapter 4 I illustrate applications of QM to various chemical problems, and Chapter 5 gives you some details of the underlying GAMESS input and output files (and there are now several blog posts with even more information on the various examples). The intent is that people can reproduce the results I present in Chapter 4 relatively easily.  Depending on the level of the course, reproducing these example may be challenging enough. Otherwise, one could easily come up with additional related problems. Let me know if that is of interest.

Many of the molecules and concepts are very P-chem oriented, i.e. uses small non-organic molecules to illustrate P-chem concepts, but there are some organic molecule/concept examples too: steric strain, hydrogen bonding, amide hydrolysis.  

Sunday, December 5, 2010

Arsenic and odd life


A recent Science paper describes "A bacterium that can grow by using arsenic instead of phosphorus", and molecular visualization is used to elegantly illustrate the basic idea, a shown in the above screencast (for the whole video visit gizmodo).

Whether the basic idea is correct is a whole other matter: for examples see here and here (be sure to check out the comments).

Saturday, December 4, 2010

Simulations in teaching physical chemistry: thermodynamics and statistical mechanics

In this post I summarize the simulations and I have used in teaching thermo and stat mech, and talk a bit about how I use them.

I co-teach two quite similar courses on this topic: one for nano-students and another for chemistry and biochemistry students.  In the nano course we use the book Molecular Driving Forces by Dill and Bromberg, and in the other Quanta, Matter, and Change by Atkins, de Paula, and Friedman.  At the end of this post I have organized the simulations by chapter for each book.

Some of simulations I have made (or modified extensively) and most of these have been discussed in previous blog posts, so I simply give the link to the respective blog post where there is more information.

The other simulations are from the Molecular Workbench (MW) library of models, and here I provide links that will open in MW, so you need to install MW before clicking on the links.  For some of them I also provide a brief description of what concepts try to demonstrate using the simulations.

How do I use the simulations?
All simulations are used during lecture to visualize concepts, start discussions, and motivate equations. I'll take Illustrating energy states as an example: instead of saying "Molecules in a gas translate, rotate, vibrate, and ....", I say "Here is a zoomed-in view of butane gas where you can see the molecules.  You can see that individual molecules move differently.  How do they move differently?  Anyone?  Right, they have different speeds.  This kind of motion is called translation.  What else? ..."

Practical tips
On a very practical note, my own simulations are all on web sites and I make sure to open all of them before the lecture, while I have all the MW simulations for the course indexed on a single MW page (click here to open in MW). It is not possible to embed these simulations in Powerpoint slides, but you can switch between Powerpoint and other applications without quitting Powerpoint (on a Mac you use command-tab and on Windows i believe it is windowskey-tab).  Note that you need access to the internet in the lecture room.

While I have screencasts of most of simulations on the blog posts, I don't use these during lecture.  I think it is too passive, and puts the students to sleep.  But I believe the screencasts are a good way for the students to review the main points of simulations after the lecture.  I put links to the blog posts on the course web site and in the lecture notes.

Is using simulations a good idea?
If possible I try to use a simulation within the first five minutes of a lecture, and have a maximum of 20 minutes between simulations.  I now only have one (45 minute) lecture left where I don't use a single simulation and I can just feel how I loose the student's attention after about 30 minutes.  You can just see it.  That being said, no one has ever mentioned the simulations in their course evaluations (good or bad), so I have no hard evidence that it improves my teaching.  But I can tell you that I enjoy lecturing much more with the simulations, so unless I get complaints I'll keep doing it. 

Making room for simulations in the lecture
I have taught the topics for many years without any simulations, and was never at a loss for material to cover.  Lecture time is precious, and these simulations take time to present and discuss.  You really have to introduce the simulation carefully (don't rush this part!) before you start them, and very often you want the students to speculate about what will happen before you start them.  Furthermore, they tend to stimulate many more questions, that you can hopefully turn into a discussion instead of simply answering them, than derivations - that's the whole point.

So how do you "make room" for the simulations?  I have cut out most of the derivations from the lectures.  To pay for my sins, I provide relatively detailed (typed) lecture notes ahead of lecture (I generally don't use Powerpoint), which include step-by-step derivations. So I'll say things like "Starting with these assumptions we can write down this equation.  This can be rewritten as this equation, which is much simpler.  The details on how we got from here to there are in your notes, but note that in step 3 we assume that ... which is an approximation."  No complaints so far.  If only more progress had been made on simulating derivations ...

Here are the simulations organized by chapter

Molecular Driving Forces by Dill and Bromberg (1st edition)

Ch 6: Entropy and the Boltzmann distribution law
Illustrating entropy

Ch 10: Boltzmann distribution law
Polymer unfolding: The book uses two simple bead models of polymers in this chapter to illustrate micro and macrostates and model protein melting.  I use this example extensively both in lectures and homework problems.  So I made this simulation to illustrate how higher energy macrostates become more likely at higher temperatures.


Ch 11: Statistical mechanics of simple gasses and solids
Illustrating energy states
Energy states in the water molecule: a slightly more complicated molecule than HCl (used in Illustrating energy states) with more than one vibrational mode and 3 rotational degrees of freedom.
Internal energy and molecular motion
Entropy, volume, and temperature


Ch 12: Temperature, heat capacity
The molecular basis of differential scanning calorimetry: heat capacity and energy fluctuations

Ch 13: Chemical equilibria
Seeing chemical equilibrium (opens in MW)
Dalton's law of partial pressure (opens in MW)


Ch 14: Equilibria between solids, liquids, and gasses
Seeing specific and latent heat (opens in MW): I use this simulation to illustrate how the same substance can be solid, liquid, and gas depending on the temperature.
A gas under a piston (opens in MW): I use this simulation to show that, for example, decreasing the pressure can have the same effect as increasing the temperature.
The phase diagram explorer (opens in MW)
Raoult's law: ideal solutions (opens in MW): Here, I use the simulation of the pure liquid to illustrate vapor pressure.


Ch 15: Solution and Mixtures
Mixing gasses, and mixing of ideal and non-ideal liquids
Raoult's law: ideal solutions (opens in MW)
Raoult's law: negative deviation (opens in MW) 
Raoult's law: positive deviation (opens in MW)


Ch 16: Solvation and transfers of molecules between phases
Visualizing osmotic pressure in an osmotic equilibrium (opens in MW)
Desalination using reverse osmosis (opens in MW)




Quanta, Matter, and Change by Atkins, de Paula and Friedman (1st edition)

Ch 13: The Boltzmann distribution
Illustrating energy states
Energy states in the water molecule: a slightly more complicated molecule than HCl (used in Illustrating energy states) with more than one vibrational mode and 3 rotational degrees of freedom.
Internal energy and molecular motion

Ch 14: The first law of thermodynamics#
The molecular basis of differential scanning calorimetry: heat capacity and energy fluctuations
  
Ch 15: The second law of thermodynamics
Illustrating entropy
Entropy, volume, and temperature
  
Ch 16: Physical equilibria
Seeing specific and latent heat (opens in MW): I use this simulation to illustrate how the same substance can be solid, liquid, and gas depending on the temperature.

A gas under a piston (opens in MW): I use this simulation to show that, for example, decreasing the pressure can have the same effect as increasing the temperature.

The phase diagram explorer (opens in MW)
Raoult's law: ideal solutions (opens in MW): Here, I use the simulation of the pure liquid to illustrate vapor pressure.
Visualizing osmotic pressure in an osmotic equilibrium (opens in MW)
Desalination using reverse osmosis (opens in MW)

Ch 17: Chemical equilibria#
Seeing chemical equilibrium (opens in MW)
Dalton's law of partial pressure (opens in MW)

# I don't teach this part of the course, but if I did I would use these simulations

Related posts:
An Atkins Diet of Molecular Workbench 
One, Two, Three, MD 
Tunneling and STM (a first stab at using Molecular Workbench to teach quantum mechanics)

Illustrating mixing

This screencast shows Molecular Workbench simulations I have made to illustrate mixing.

The first simulation illustrates the mixing of 2 ideal gases, which mix readily.  Since the gas particles don't interact you can think of the mixing as each gas expanding to fill both containers independently of each other.  As I have shown in this simulation, the driving force for this expansion is an increase in entropy.  Therefore, the driving force for mixing two ideal gasses is also purely entropic.
The second set of simulations illustrates the mixing of 2 liquids.  Since they are liquids there must be attractive interactions between the atoms.  If there were no interactions they would be (ideal) gasses.  The strength of the interactions (and the temperature) determine whether they mix or not.

In the first liquid simulation, the attraction between two green atoms (εGG), between two blue atoms (εBB), and between a green and a blue atom (εGB) are the same.
This means that a green atom doesn't care whether it is sitting next to a blue atom or another green atom.  The net effect is that green and red atoms are equally likely to be on the right or left side of the container, and the liquids mix for the same reason as the ideal gasses mix: the driving force is purely entropic. That means the enthalpy of mixing is zero:
This is the definition of an ideal mixture (or ideal solution).  The two liquids will mix at any temperature.

In the second liquid simulation, the attraction between two blue atoms (εBB) is stronger than between two green atoms (εGG) and between a green and a blue atom (εGB).
Note that the ε's are negative: a smaller ε means a stronger attraction.  This means that the blue particles would rather be with other blue particles, i.e. the enthalpy increases if the particles are mixed.
(z is the number of contacts between particles in solution, and xG is the mole fraction of green atoms).  This is an example of a non-ideal mixture, where the definition for a non-ideal mixture is
Because ΔmixH > 0 this non-ideal solution mixes spontaneously (i.e. ΔmixG < 0) only for
Oil and water is a common example of such an non-ideal mixture: the oil-oil interactions are stronger than the oil-water and water-water interactions.

Salt and water is another example of on idea mixture, but here ΔmixH <  0 so salt and water almost always mixes spontaneously.  The interpretation is that the interactions between the salt ions and water is stronger than the average interaction between salt ions and between water molecules.
Implications and limitations
The definition of ΔmixH in terms of the ε's suggest that liquids should also mix if
which would be a more general definition of an ideal mixture.

This is tested in the third liquid simulation.  As you can see the liquids mix more than in the second simulation, but not quite as much as in the first simulation.  This is mostly because of the simulation runs only for 100 picoseconds, which is to short to mix fully.  But another reason is that there is less space (on average) between the blue atoms compared to the green atoms, because the blue atoms attract each other more.  The next effect is that the blue particles tend to stay together to lower the enthalpy.  More mathematically,  z (the number of contacts between particles in solution) is not exactly the same for the blue and green particles so the interpretation of ΔmixH in terms of the ε's breaks down.  The "safest" definition of an ideal mixture thus remains:
i.e. "like dissolves like".

Accessing the simulations
You can play around with the simulations here and here, or you can download the models here and here if you have Molecular Workbench installed on your computer.