Welcome to
Summer 2000 CONFCHEM
Internet
Conference on Chemistry

Computer Animations and Simulations in General Chemistry

By Chung Chieh and Newman K.S. Sze
Department of Chemistry, University of Waterloo, Waterloo, Ontario, Canada N2L 3G1

Outline

  1. Abstract
  2. Introduction
  3. Creating Models
  4. Chemical Reaction Simulation
  5. Properties of Gases
  6. Electron Densities of the Hydrogen Molecule
  7. Other Examples
  8. Chemical Simulations on the Internet
  9. Discussion
  10. References

Abstract

Computer simulations and animations are usually excellent tools for education. Animations show step-wise sequences of diagrams, numbers, or images to illustrate complicated concepts or theories. Simulations, on the other hand, are imitations of systems for users. The user enters or alters certain parameters, and the computer will reveal the consequences or changes. Some random or uncertain elements are involved in simulations. Experiments using real systems are the best way to explore science, and simulations offer students alternative ways to discover when real systems are not available or impossible to setup.

A system may be set up according to some theories. For example, van der Waals equation can be used for real gases to illustrate how real gases differ from the ideal gas. These equations are implemented in a Java applet to simulate a system for a user to explore the difference. From this simulation, a user is asked to find out conditions in which the ideal gas law gives results within a set error limit.

A Java applet is written to simulate properties of gases. A user can choose one of several gases to investigate at a time. The temperature and volume are two independent variables that can be altered, and the pressures calculated by the two models are presented. This is a deterministic simulation, but the calculated pressures may be misleading. One of the suggested application is to ask students to formulate a general statement regarding the conditions, under which the model is valid. Gases such as He, H2, N2, H2O, CO2, etc are included the Java applet.

Differential equations are excellent for defining a system. Instead of solving these differential equations for explicit form, numerical methods may be applied. Numerical methods are often used for computer simulations.

Monte Carlo Simulation is another popular method used to explore systems involving large ranges of parameters. Instead of covering the entire range, results at some random points are calculated to represent the results over the entire range. Some examples of Monte Carlo simulations will be presented.

Some years ago, one of us taught a course Application of Computers in Chemical Problem Solving. Programs have been written to illustrate animations and simulations, and we will outline some of these projects.

Introduction

Simulation means different things to different people. In the broad sense, science is a simulation of nature. Newton used simple formulas to simulate the motion of objects, and the ideal gas law simulates the properties of most gases. However, these simulations have been around for such a long time that we accept them as fact, because so many people have validated these models or simulations.

Scientific investigations model nature under some limited conditions. Nature is complicated, ant it has many rules and parameters. Few people agree if we consider Nature as a complicated simulator, but there are many similar aspects between a simulation and Nature. Despite the many laws discovered and validated in the past, there are still more to be explored or discovered. Of course, building a simulator of Nature is impossible, because we still do not have all the rules or laws. However, by putting in as many rules as possible, many computer simulations have been built to predict the results under a set of conditions.

A simulation incorporates one or more rules to define a model. These rules apply within some limited conditions. Thus, a simulation is a good model for exploration or learning. Unfortunately, most educators create simulations as a hobby, we lack the expertise or time to construct sophisticated models.

In this paper, we present some simulations that have been used in general chemistry. We recognize their limitations, but we have had the pleasure in their creation, and they have delighted some students. A few Java applets are included to illustrate their potential. These applets are preliminary, because we have not had much experience in using Java to write simulations.

To Outline

Creating Models

Because energy and mass are not created, they cannot be destroyed. On the other hand, artwork, computer programs, buildings, machines and social systems are created, and they can be destroyed. A simulation is also a creation, and as such, it has a limited life and its application depends on the technology and time.

The first step to create a simulation is to define an appropriate system and collect the theories governing the changes in it. The foundation of the system is built on well-tested theories.

A simulation for teaching general chemistry is usually based on a few theories in the domain of this level. Perhaps the major attraction in these simulations is a lively visual effect to teach these theories. When creating a computer simulation, we plan to present the theory more attractively than those using words, equations, tables, and graphs. To achieve this goal, however, depends on many factors.

Changes in nature are usually continuous, but quantities in computers are discrete. The digital representation of quantities often causes problem for the simulation of physical and chemical changes. Special conditions have to be imposed in the program for meaningful results.

There are many books regarding computer simulations, and we list three (1, 2 & 3) for general guidance. We follow some typical steps for our creation of simulations:

  1. Define a system and describe the theories governing changes in the system.
  2. Determine the independent parameters we want users to change.
  3. Determine dependent variables to be presented to users in response to the input parameters.
  4. Develop the mathematical and algorithmic approaches to evaluate and present changes.
  5. Decide the method of user-computer interface for exit the simulation or continue with the simulation.
  6. Test, get feedback, and revise.
These steps are easy to follow, but artistic design, test, getting feedback, and revise take time and patience. The design of interface between the user and the computer is very important. How a user changes the parameters and how the results are presented require careful consideration. Often, a number of design changes have been made.

To Outline

Chemical Reaction Simulations

Chemical reactions form the backbone of chemistry, and on this topic, we usually concentrate on the rate laws because we want students to learn the skills needed to calculate the variations of reactants or products in the system. There are many types of chemical reactions, and their modelling depends on the reactants, the products, and the rate constants. Every reaction is a unique model, and they may be divided into many types.

Among these types, we choose to model the conversion from A to C via an intermediate B as indicated below.

A ---ka® B ---kb® C

where ka and kb are rate constants for the indicated steps. These models apply to the kinetics of consecutive radioactive decays, and also to an isomeric conversion with an intermediate. In the case of decomposition to produce two products, C represents the amount of one of the products.

For simplicity, we consider both steps follow a first order mechanism, and the differential equations for the chemical kinetics are:

  dA
- -----
  dt
= ka A
  dB
- -----
  dt
= kb B   dC
= -----
  dt

These are the rules that govern the changes of the system. Rate constants ka and kb are independent variables. Furthermore, we assume the system starts with an initial amount of A, and for simplicity, the initial conditions are restricted. A more sophisticated system allows the user to set up an initial amount of A and B. Quantities A, B and C are evaluated by numerical methods (4, 5 & 6) in the Java program. The italicized letters denote the amounts of the various species. A more complicated simulation can include the order of the reactions to be different from the first order.

In this simple simulation, the user may choose any combination of values for ka and kb. When the values are chosen, the amounts of A, B, and C vary as functions of time. A bar graph shows the variations of the amounts as the functions are plotted.

There are many different ways to present the results for each simulation, but a choice has to be made. The present choice is somewhat academic, because the plots require additional interpretation.

If a definite set of instructions is given, students will simply follow the instructions. Thus, we suggest some questions for the students to answer as they explore the simulation. It will be interesting to ask students to write a report to discuss how they have used the simulation if the class is small.

We have used this simulation to demonstrate how the intermediate B varies as the ratio of the two rate constants change, but there are other applications. We will be interested in knowing how you might use it.

We have also written a simulation to show the variation of reactants and products using random rate constants and order of reactions. The object of this simulation is for the user to figure out the order and the rate constants. Some aids were built in. For example, by pressing certain keys, the user can plot diagrams to figure out the order of the reactions. Evaluation of the rate constant is easy.

To Outline

Properties of Gases

Properties of gases are integrated in general chemistry. Avogadro's law, Boyle's law, Charles's law, and Dalton's law (the ABCD laws of gases) and the ideal gas law have always been important parts of general chemistry. Thus, a simulation on the properties of gases is interesting.

For real gases, the van der Waals equation provides a slight improvement in predicting the gas properties compared to the ideal gas law. However, both the ideal gas law and the van der Waals equation work well only for some ranges of temperatures and pressures. Few students at this level paid much attention to the limitations. An interesting exercise is to ask them to find out the limitations of a simulation for the modelling of real gases. In this simulation, some conditions will result in negative pressures, meaningless quantities.

In this simulation, the properties of helium are given as the default. Please change the gas from helium to a different gas to begin, because for some unknown reason, the simulation from the default at the start does not give the desirable results. On the other hand, once a different gas has been chosen, the simulation works fine. This error may be caused by a bug in Java or the Netscape 4.6 browser. The user can investigate a gas by changing the amount in moles, the volume in L and the temperature in K. The simulation gives the pressures calculated according to Model A and Model B.

We will develop a more sophisticated simulation, but in the time frame we have, this preliminary version is included here.

Suggestions for Using the Simulation

The following questions or points are suggested, but use your imagination and feel free to use the simulation in any way you see fit. Again, your suggestions are more than welcome. This example simulation that presents numerical values rather than graphics. Students may be asked to plot the data in a graph to represent a law of gases from the data of the simulation. For this purpose, a simulation with a cylinder and a barometer is more attractive.

To Outline

Electron Densities of the Hydrogen Molecule

The Monte Carlo Method can be applied to plot the electron densities of atomic orbitals and molecular orbitals. This method applies to any number of dimensions, but we choose a 2-dimensional approach to simulate the electron densities of bonding and antibonding orbitals of the hydrogen molecule on the plane bisecting and containing the nuclei of the two atoms.

The wavefunctions of molecular orbitals of H2 can be a linear combination of atomic orbitals (LCAO) of the two hydrogen atoms in the molecule. Utilizing appropriate normalizing factors, the bonding orbital is the sum of two 1s atomic orbitals, whereas the antibonding orbital is the difference of the atomic orbitals. The electron density is proportional to the square of the wavefunctions.

To calculate the electron density throughout the entire space is time consuming, and impractical even if a very coarse grid is chosen. However, we can randomly (the Monte Carlo method) choose points in the space of interest to us and evaluate the square of the wavefunction. The program actually places a dot at that point in the 2-dimensional space if a random value is greater than the probability. Thus, the density of the dots is proportional to the electron density of the orbitals.

Since the points are randomly chosen, it takes very little time to plot many dots to fill the entire plane. Since the dots fall randomly on the plane, the actual plotting is very interesting to watch. It is particularly impressive to plot the dots in a dark room with light blue dots. A plot resembles a clear night sky.

In this simulation, symmetry of the wave functions is assumed in plotting the dots, but electron density does not have to follow the symmetry. The presentation is a matter of choice.

The effect of this type of simulation depends on the computer speed. When we first execute a version of this simulation, we adjust the speed of plotting to make watching the plot rather interesting. When the same version is executed later in fast computers, the dots are plotted too fast to be interesting.

In this Java applet, we limit the number of dots plotted. Otherwise, the dots will cover the entire window in little time.

To Outline

Other Examples

The following simulations were written in Quick Basics 4.5, and they cannot be executed within your browser. If you are interested, you can download one or more programs into your computer and then execute them. All programs require the file BRUN45.EXE to run. Please download this file and place it into a temporary directory in your computer. Download BRUN45.EXE If you already have the file BRUN45.EXE in your computer, you need not click to download it. Any of the following files will execute as long as it is in the same directory as your BRUN45.EXE file.

Since downloading a file is much more trouble than browsing it on the screen, only a few programs that require no additional data files are included for those who are interested.

To Outline

Chemical Simulations on the Internet

No doubt, more chemical simulations will appear for this CONFCHEM session. In the mean time, we have noted some other chemical simulations on the Internet as well. Some examples are given below:

To Outline

Discussion

A BASIC program showing similar plots as the Chemical Reaction Simulation was shown to many science faculty members in the 1980s when the personal computers appeared on the market. The biologists and earth scientists were enthusiastic, because they thought this type of simulation could be employed to show phase transitions, growth and decay of populations in colonies, and transformation of mineral types. Using simultaneous differential equations to state the rules is an excellent approach to simulation. Since then, we have employed simulations for students to use on their own and shown them during lectures.

Few students while taking general chemistry have said much about the simulations or animations. However, a few senior students plus some graduates have commented that they appreciate having seen the simulations. As they mature, they appreciate the amount of work in making the simulations. Today, students are familiar with computers, and they probably are not excited by simple simulations.

Computer simulations are used for education, problem solving, and prediction of natural phenomena. These simulations involve many theories and parameters, and their calculations are very complicated. For example, H. M. Bell at Virginia Tech has written PC software for NMR, radioactive decay, and IR simulations. A Compilation of Educational NMR Software collected by P. Lundberg gives many sites that have NMR simulations. Overview of interactive programming methods for the World Wide Web by B. M. Tissue includes simulations using JavaScript and Java applets. A search on the Internet usually results in many links related to simulation.

There are many different ways to make up simulations and animations. D.E. Mencer's Internet site gives simulations made up using forms on the web page and scripts on the server. He has discussed this aspect in his paper: Developing and Implementing Web-based Computer Simulations for In-Class, Individual, and Small Group Work (Summer 2000 CONFCHEM, Paper A-1). Students' usage can be monitored with scripts in the server for this type of implementation.

Animations and simulations have been made up using Macromedia Director by B. Pankuch, who has presented some of these in his paper: Why use animations and simulations? (Paper A-3) The extensible markup language XML is on the horizon for simulations. Some examples of its application can be found in the MoDL tutorial. We have attempted these options, but we have yet to implement any animation or simulation using these technologies.

Java applets are suitable for course Internet sites. We have An Internet Site for General Chemistry for many years, and we are planning to add Java applets to some of the pages. Java applets are now widely accepted by most browsers. However, the computer technology changes rapidly, and we work hard at catching up. The dependence of simulation on technology is a discouragement for us, because by the time we have caught up, the situation is again different. However, change is the invariance of life, and we have accepted it.

To Outline

References

  1. W.J.Graybeal and U.W. Pooch (1980): Simulation: principles and methods, Winthrop Publishers, Inc., Cambridge, Massachusetts.
  2. R.E. Shannon (1975): Systems Simulation: the art and science, Printice-Hall, Inc.
  3. R.E. Stephenson (1971): Computer Simulation for Engineers, Harcourt Brace Jovanovich.
  4. W.E. Schiesser (1991): The numerical method of lines : integration of partial differential equations, Academic Press.
  5. G. Fairweather (1978): Finite Element Galerkin Methods for Differential Equations of the series "Lecture Notes in Pure and Applied Mathematics; 34" M. Dekker.
  6. H. Kocak (1989): Differential and difference equations through computer experiments: with diskettes containing PHASER, an animator/simulator for dynamical systems for IBM personal computers, Springer-Verlag.

CONFCHEM Discussion

E-mail: cchieh@uwaterloo.ca