### Lab 6: Simulating an Ionic Reaction

Maths Lab 6 is available at http://metric.ma.ic.ac.uk/chem/1998/Mathslab6.nb.

Here the main focus is on the idea of differential equations and their solutions. The Lab is built around a reaction simulation that is effectively a Newtonian three-body problem, and therefore not exactly integrable in general. The solution process, which is numerical, is hidden inside Mathematica's `NDSolve` function, and we don't ask first-year chemistry students to explore that.

The assignment involves simulating a reaction between a free chloride ion and a sodium chloride dipole. For simplicity, the ions are treated as Newtonian point charges and their movement is restricted to one dimension.

Again, setting things up is rather involved. First the students need to set some physical constants: the permittivity of the vacuum, Avogadro's number, and so on. Then they define a couple of force functions, representing empirically derived classical approximations to what is actually, of course, a quantum phenomenon. These cover interactions between particles of like charge

and unlike charge

respectively. After setting a duration for the "reaction," and a set of initial positions and velocities for the three ions, the student is finally ready to solve the equations of motion of the ions.

The solutions that come from this call to `NDSolve` are then used to define position and velocity functions, which set up a fairly crude animated "simulation."

Some frames from this animation are shown in Figure 2. Here, the starkness of the representation and its inferiority to what could be achieved with more sophisticated Mathematica code or with dedicated simulation software are perhaps even more apparent than in Lab 3. This graphical crudeness is forced upon us because we want to keep our code simple enough for students to read, edit, and use as a model for their own code. One of the things that Mathematica, used in this way, offers us is the opportunity to make clear the connection between the Newtonian equations of motion of the three ions, clearly apparent in the above code, and the behavior of the system. If we hadn't used a computer algebra system at all, or if (as is fashionable in some quarters) we'd used one but hidden the algebra part beneath a more friendly user interface, this advantage would have been lost. It would also, we believe, have been somewhat compromised even if we'd put some of the code in a package. We might also note in passing that a system whose typesetting capabilities aren't as good as those of Mathematica--and those do, of course, exist--would have made rather less obvious the key fact that the equations of motion are simply rearrangements of Newton's second law.

Figure 2. Frames from the worked example animation in Maths Lab 6.

After typing in our code, the students have four things to do. First, they're asked to write some code of their own for viewing the system's behavior by means of a graph instead of an animation. Next, they have to vary the initial positions and velocities of the particles systematically in order to make the system behave--apparently, anyway--in at least three ways.

1. The chloride ion that was dissociated becomes bound, and vice versa (a reaction occurs, in other words);
2. The dissociated chloride ion interacts with the dipole but is repelled, and becomes dissociated once more;
3. The interaction between the three ions continues forever, with neither chloride ion becoming dissociated from the other two.

The third task is to test the model itself, specifically to check that energy appears to be conserved. This involves converting the forces into potentials, and sampling (or graphing) the total mechanical energy of the system during the reaction. Although the details of the numerical solution method are kept hidden behind `NDSolve`, students are asked to use Mathematica to make sure that the dynamical behavior that comes out of `NDSolve` is physically plausible. In other words, the very system that generated the data can be used in a natural way to examine that data critically. With Mathematica, a black box needn't be completely black.

Finally, students are asked to devise from scratch a Mathematica-based test for ionic dissociation and use this to find out whether the three reaction outcomes listed above have actually been realized in their work or merely apparently so. The test does not have to be perfect and foolproof, but it must take one further than merely observing the reaction. Figure 3 shows three graphs from the work of a certain student, who approached this problem by partitioning the potential energy of the system among the three particles (in a fairly plausible way), then graphing the total mechanical energy of each ion against time. In the figure, we see this graph for one of the chloride ions--the one on the left of the frame in Figure 2--in the context of each of the three reaction outcomes listed above. A particle is dissociated, in this student's analysis, if it has a total mechanical energy greater than zero. As you can see, the test seems to work quite well.

Figure 3. (student's work). Graphs of total energy (×10-19 J) against time (×10-12 s) for the left-hand chloride ion in the context of the three reaction outcomes described above.

We were, in general, very pleased by the standard of work on this rather challenging task, which increased our confidence that we had been right to use Mathematica in the first place and, in particular, right to use it like this.

Converted by Mathematica      September 30, 1999 [Prev Page][Next Page]