Real-time computer simulation of aqueous equilibrium - Journal of

Jan 1, 1983 - Real-time computer simulation of aqueous equilibrium ... The computer program described in this article illustrates that a model based o...
0 downloads 15 Views 2MB Size
edited by JOHNW. MOORE

Bits and Pieces, 13 Most authors of Bits and Pieces will make available listings and/or machine-readable versions of their programs. Please read each description carefully to determine compatibility with your own computing environment before requesting mate& from any ofthe authors. Revised guidelines for authors of Bits and Pieces appeared in the Decemher 1982 issue of the JOURNAL.

Automatically Finding Eigenvalues in One Dimension and for a Simple Chemical Bond Robert Hunt Anderson

Western Michigan University Kaiarnazao, MI 49008 The one-dimensional Schrodinger equation is usually solved for a few simple potential energy wells. The average chemist^ student has some trouhle with the finite square well to say nothing of the twin-well problem. Since this is the simplest case of anvthine resembline a chemical hond, it is natural that " most chemists do not really have much conviction of the importance of Schrodinger's equation to chemistry. The reason appears to he the involved mathematics required to obtain the eigenvalues and eigenfunctions in all hut the simplest cases. In addition, for most well shapes, especially asymmetrical wells, there is no way except numerical methods to obtain the solutions. Melander ( I ) in 1962 proposed the twin square well as a model to increase the students' understanding of the chemical bond. Several programs have been described which calculate or plot psi versus X (2-5). With the exception of Johnson (2) these programs simply produce a solution of psi versus X. It is left to the student to trv different values of the enerev until "

.

.

the energy until a well-behaved solution is found for the auantum number svecified. It handles asvrnmetrical potential

figures which they spent'30 minutes getting in an e&er assignment. The user need only write a simple FORTRAN function for the potential energy well. For a class assignment this may he furnished, and theprogram may then h&un with no knowledge of FORTRAN. It enables students to solve easily the Schrodinger equation for any V ( x ) .One option permits psi and X to be stored in a data file which can later be plotted usine a nlottine vroeram such as our GPPLOT (6). Figure 1 gives these results more easily than the mathematical procedure described by Melander (1). This program should he useful to acquaint students with the role of quantum chemistry in explaining the energy of the chemical hond. I t can also provide a better understanding of well-behaved functions and the relation between eigenfunctions and the corresponding eigenvalues. Thirdly, it can he used to obtain eigenvalues for various potential wells in a simple and uniform manner, thus separating the physical

Figure 1. The energy eigenvaluesof atwin square well potential of constant depth of 10 hamees as a function of R, the distance between the centers of the wells. Eo and E, show a bonding effect and correspond to symmetric wave functions.

internretation from themathematical process. The work of getting results is much less than by other methods. SCHROD is an interactive FORTRAN program with 490 statements and 240 comment lines. E x e c u ~ i o require ~s 12K 36-hit words or 24 pages in core on a DEC-10. The source program is 39K including the six subroutines. A HELP command gives instructions to the user. Documentation includes a listing and a sample execution. These are available for $4. The program is availahle on 9-track magnetic tape written in ASClI (or EBCDIC) at 1600 Bpi (or 800) 20 records per hlock, 80 characters per record for $15 to cover postage and tape charge. Make out check to Bob H. Anderson and send to the Chemistry Department a t the above address.

Real-Time Computer Simulation of Aqueous Equilibrium J. W. Schilling Trinity University San Antonio, TX 78284

The program described below illustrates that a model based on simple kinetic arguments explains why the reaction quotient approaches a constant value called the equilihrium constant. I t also illustrates the idea of the position of equilibrium; Le Chatelier's Principle; the mass action principle; the principles of electrical neutrality and mass balance; and the influence of the forward and reverse rate constants upon the value of the equilihrium constant. I t has both qualitative and quantitative fidelity to the actual chemical process being represented and is appropriate for physical chemistry and advanced general chemistry students. Volume 60 Number 1 January 1983

43

Operation of the Program

The primary data needed by the program are the forward and reverse rate constants hi and h,, and the orders of the forward and reverse reactions, Or and 0,. The systems most directly simulated are a solubility equilihrium and the dissociation of a weak acid. In anv case the svstem mav .he .oerturhed by the removal of one bf the prod;ct species so that students can ohserve the operation of LeChatelier's Principle. Initially 128 "f" symbols are displayed on the left side of the screen representing the numher of molecules of the reactant species, e.g., molecules of a weak acid, HA. The time per unit reaction is computed independently for the forward and reverse reactions, depending on the order, rate constant, and the numher of molecules present. For the forward reaction this is called the "dissociation time" of HA; for the reverse reaction it is called the dissociation time of H 3 0 f . After an interval of one forward dissociation time a "f"symhol is erased and the svmhol proeram places in the middle of the screen a ~. representing hydronium ion and a "-"symhol representing A ion. The dissociation times are continually updated. As the forward reaction proceeds, the reverse dissociation time decreases and dissociation of the hvdronium ions beeins to occur: an; a "-". he the program adds one "+" andheletes a reverse reaction is accompanied by an audible click to call attention to the event. As the program runs, the two times approach each other's values until equilihrium is achieved. The program in no way "forces" equilibrium; it occurs because the formula for the

"+"

"+"

Figure 2. Screen display for simulation of aqueous equlllbrlum showing 106 HA molecules. 22 H+ ions, and 22 A- ions.

For the HA dissociation model, Or = 1 and 0, = 2. The reason for the pseudo first order kinetics of the forward reaction is discussed with the students. A solubility equilihrium is simulated by specifying Or to he zero and 0, to be 2. Since only a small numher of molecules is simulated, the program cannot obtain exactly the equilibrium constant expected from the ratio of rate constants. For example, let hi = 5, Of = 1,h, = 1.0, = 2 (the "weak acid" mode). Denote the numher of HA 23, givingK = 5.04. The display thus oscillates between ;Lat configuration and N,Nh = 106.22 ( K = 4.57). eivine an im.

.

a 4% error (see Fig. 2). This program was written in Assembler Language for the Datapoint 2200 minicomputer and will not he transportable to the large majority of readers.

Apple II Program for Visualizing Molecular Vibrations "concentrations" will he seen to he approximately equal to the ratio of the forward and reverse rate constants. A snecial i n ~ u t parameter causes the program to stop each time a certain amount of reaction time has passed so that the student can collect data. The reaction quotient Q can he computed from the tallies so that its variation with time mav he observed. Once each millisecond, a time variable is Lncremented for each reaction. When either reaches the appropriate value of t , the display is revised to show that a dissociation has occurred, and the dissociation times are recalculated. (Typical dissociation times are 20 ms or greater.) All of this is done in an interrupt service routine (ISR). When there is no dissociation occurring the ISR takes much less than a millisecond to perform. But the routine becomes very time consuming (possibly 100 ms) when a reaction takes place, especially the updating of the display and the numeric quantities. A skew then is introduced into the time variable because the reaction is in effect halted for many milliseconds while all this is taking place. If N is plotted against time determined by a stopwatch, the "experimental" rate constants come out too low by afactor on the order of two to 10. To combat this the program monitors the actual time during which interrupts are enabled, i.e., the actual reaction time, and halts for data collection when this quantity is equal to the stop-time parameter entered by the user. At any time the student can strike a special key which causes the program to pause and ask for the numher of moles of base to he added to the system as if he were titrating the acid. The specified numher of hydroninm ions are removed and an equal number of symhols representing HB and C+ are placed on the right-hand side of the screen. ( H B is assumed to be much weaker than HA so that there is no free B- present a t any time.) The program then resumes its ordinary operation and the equilibrium is seen to he reestablished with the position of equilihrium shifted to the right but the same value of K. This is pedagogically useful because it illustrates the situation where H+ z A-. 44

Journal of Chemical Education

Eduardo L. Varettl

Universidad Nacional de La Plata La Plata, Argentina The vibrations of simple molecules are usually represented in the literature by "sticks and halls" models with attached arrows which indicate the relative movement of each atom. Such static representation of an eminently dynamic phenomenon invites improvement for educational purposes. A microcomputer program that represents such vibrations in animated motion has been developed as an instructional aid. The animation speed of the program is naturally limited due to the inherent slowness of the BASIC lan~uaee.However. gular triatomic molecules. Besides, the frequency of vibration can he modified a t will during the demonstration using one of the microcomputer games controls, allowing a good visualization of the distorted molecule. This feature is useful when the changes of dipole moment and molecular polarizahility are discussed in relation with the infrared or Raman activity of the vibrations. We use the program during a short introductory course on vibrational spectrosco~voffered to oeoole workine in academe or industry.-of course, it could be useful in any course on general or physical chemistry. Program VIBRO was written in Applesoft BASIC for an Apple I1 Plus microcomputer. Graphics are presented in black and white in the high resolution mode making intensive use of the shape tahle utility. This feature allows one to predefine a shape that is to he sent to the screen and store it & the machine memory before running the program. VIBRO has 100 multi-statement lines, no comments, and requires about 6K of memory, whereas the shapes definition table needs 180 bytes of memory. Program and shapes definition listings and the corre-