A Computer Program for Calculating Standard Deviations from

Dec 1, 1995 - To be scientifically meaningful, a measurement requires that two numbers be recorded: the value of the measurement itself and the uncert...
1 downloads 0 Views 3MB Size
black point with a slightly larger radius a t the same lx,y,z) coordinate. At each time step, a graphical image is produced and saved a s a variable. For example; the image a t the first time step is saved as p l , the image a t the second time step is saved a s p2, and so forth. Once the graphical images a t each time step are produced, the ShowAnimation command displays the images consecutively so that they appear a s a continuous movie. The speed of the animation may he controlled by buttons on a control panel. The notebook can be easily modified to produce animations with other molecular-dynamics simulation data. Both the numher of time steps and the number of different types of atoms can be varied. Results We have used the notebook to create movies of reactions between incoming gaseous fluorine radicals with Si,Fy adsorbates on the Si(100)-(2x1) surface. One of the reactions that we have studied is the reaction F(gl+ SiF,(al+ SiF4(g)

that takes place by a S Nmechanism. ~ Snapshots of the reaction a s it proceeds are presented in Figures 2a-d. Only the top two layers of atoms are shown in order to focus on the atoms that are directly involved in reaction. Figure 2a shows the atoms a t 6 fs after the fluorine radical was introduced into the simulation. The gaseous fluorine radical, F(g), approaches the SiF3 adsorbate a t a n angle that is approximately collinear with the suhstrate-silicon bond. At 45 fs into the reaction in Figure 2b, F(g) comes closer to the adsorbate and initiates inversion of the stereochemistry of the SiF8adsorbate. Midway through inversion a t 64 fs, the SiF3 adsorbate in the F-SiF3 complex passes through a trigonal planar configuration shown in Figure 2c. Figure 2d shows the tetrahedral SiF4 product beginning its desorption from the crystal surface into the gas phase a t 133 fs. Conclusions We have developed a Mathematica notebook, Moviema, that converts (x,y,tl d a t a from a molecular-dynamics simulation into graphical images t h a t a r e animated a s a movie. Mathematica produces noteworthy animations t h a t attract the interest of students and help them to understand the mechanisms of chemical reactions. As a n example of the method, the notebook produces a n animation of the reaction F(g) + SiFda), which takes place by a S N mechanism. ~ The necessary Ix,y,zl data for the coordinates of the silicon and fluorine atoms as a function of time are included with the notebook. The notebook can be easily modified to create animations for any chemical reaction once the lx,y,zl data files are generated. By creating a visual picture of a chemical reaction, we can help our students understand how molecules react on t h e atomic scale. Both a Macintosh and a n IBM version of the notebook are available. The minimum system re-

quirements are an IBM 486 machine with 8 MB of RAM and 15 MB of virtual memory or a PowerMAC 6100 with 8MB of RAM and 24 MB of virtual memory. About 10 min are needed to carry out the entire animation, including creating the initial frames, setting up the animation, and running the animation. Acknowledgment We thank 'Ikacy A. Schoolcraft a t Shippensburg University, Shippensburg, Pennsylvania, for a version of the molecular-dynamics simulation code for silicon-fluorine etching reactions and for numerous informative discussions regarding the numerical simulation of silicon-fluorine etching reactions. We thank both Frank Kinard and Gary Asleson a t the College of Charleston for their help in producing photographs of the graphical images from the computer screen. Financial support of this work by the College of Charleston, and Research Corporation under Grant No. C-3499 are gratefully acknowledged.

A Computer Program for Calculating Standard Deviations from Standard Deviations Edmund R. Malinowski Stevens Institute of Technology Hoboken, N J 07030 To be scientifically meaningful, a measurement requires that two numbers be recorded: the value of the measurement itself, and the uncertainty in the measurement. The measurement 25.0 f 0.2 is quite different from the measurement 25.0 f 15.5, even though the values are identical. The importance of uncertainty measurements in the chemical laboratory cannot he overly stressed. Uncertainties in measurements are usually expressed a s standard deviations that are readily obtained by replicate measurements or by least-squares fitting of data to functional forms based on chemical knowledge (5).I n many

Summary ol Exprdons horn fh* Theoly d the Ropagdon d Uncerlcrlntier y = function of measurables a and b. 5, S. and s, are uncertainties (standard deviations) in a, b, and y m = constant

addition

y=a+b

s,' = s'.

+ s,2

subtraction

y=a-b

s,'

+ s;

multiplication

y = ab y = ma

division

y =& y=dm

exponentiation

y = ab y = a" y = mb

logarithm

y=Ina Y = logaoa y = antiln a = e' y = antilog,, a = 10'

antilog

= s'.

$ = sja

s, = 0.434 s,/a sr = Y s. s, = 2.303 y s,

gure 3. Summary of expressions from the theory of the propagation of uncertainties, used in tV E D program. Volume 72 Number 12 December 1995

1079

ofAnalysis Laboratories a t Stevens Institute of Technology for the past four years with remarkable ease and success. The simplicity of the program is best demonstrated by means of a n example. Consider the following - calculation.

situations, several different measurements must be made and combined in some special way to yield the desired quantity. Although the numerical treatment of the measurement values mav be straightforward, the treatment of uncertainties is not straightforward, requiring special equations for each step in the computations. The Theory of the Propagation of Uncertainties is partitularly useful for processing uncertainties when such computations are involved (5). The well-known expressions relating the standard deviations s, and sb of measurables a and b to the calculated quantity y and its uncertainty sy are summarized in Figure 3. Unfortunately, however, applications of these expressions are often tricky and time-consuming. For these reasons, teachers and students tend to shy away from using these formulas in complicated situations. We have develo~eda user-friendlv Droeram that not onlv removes the labohous c ~ m ~ u t a t i o ~ a f d ~ drequired gery hi these equations, but also serves as a valuable pedagogical tool. The program is called Standard Deviations from Standard Deviations (SDSD), and is compiled for use with an IBM PC. I t has been used in the Instrumental Methods

X = -0.05916 log,, (0.2403+ 0.0037) - (0.2282 + 0.0012) (0.3853f 0.0024)~ In this expression the measured values and their respective deviations are given in the parentheses, Starting with the letter A, each measurable is assigned an alphabetical letter, In this problem, let A = 0.2403 0.0037. B = 0.2282 i 0.0012, and c = 0.3853 0,0024, ~f~~~these values have heen entered by keyboard in chronolog~calorder, they ap. pear on the screen as shown in Figure 4, The operator is then requested to Enter command (e.g.A+B)

+

a s shown in Figure 5. The codes for various mathematical operations are displayed in the KEY CODES box on the right of the The value of the numerator, under the log,o function, and the uncertaintv in the numerator are obtained by typir 1-B. The output is identified a s D in the first column of Figure 5. If we type CA2, the denominator and its uncercILLCUWLTOR WITE STBNDAPD DEVIATION Copyright @ 1994 by Bdmvnd R. Malinoweki ............................................................................ tainty are displayed a s E. The quo1ndep.var. value stand.~ev. computation tient and its uncertainty are obtained A .2403 .0037 XEY CODES by typing DIE, the result appearing as ------------B .2282 .0012 F. To obtain the base-10 logarithm, C ,3853 .0024 TVpeY one types #F, a s designated in the to edit data KEY CODES box. Typing -0.05916*G completes the computation. The final result is displayed as H on the screen, yielding

-

R

- exponent

@ 1" # log base 10 $

antiln

a antiloglo I sine L cosine

-------------------------

Type X to exit

I-

Enter conrmcind 1e.g. w e ) :

I

Figure 4. Computer screen displaying data input and key codes of the SDSD program.

-lPrATOR

WITE STANDARD DEVIATION

............................................................................. mdep.var. A deo var

c

dep D dcp E dep F dep c dep R

var

value .2403

.3853 var .0121 var .1484561 var 8.150555E-02 var -1.088813 6.441417E-02

- copyright @

stand.Dev. ,0037 ,0024 3.88973E-03 1.84944E-03 2.622088E-02 .1397154 8.265566E-03

1994 by Edrovnd R. Malinowaki

I

Conputation Type y to edit data

A-8 C-2 D/E log10 F -.05916*G

------------+ add - subtract

.

multiply

I

1

I divide exponent @ -.1

# log baee 10 s antiln antilog10 I sine 6 cosine

1

------------Type

Figure 5. Computer screen displaying step-by-stepcomputations 1080

Journal of Chemical Education

x

to exit

1

The above computations take only a few minutes to complete. Considerablv more time is reauired to carrv ouithe computations with a hand caiculator: the student is Drone to make numerical and computational errors, so each step must be double-checked carefully. Such tools are useful in the i n s t r u m e n t a l analysis laboratory, which often involves extensive calculations. The SDSD program can be used as a teaching tool. to reinforce imoortant. but subYt~e,cdncepts developeh in the lecture class. For example, the theory of the propagation of uncertainty assumes that the variables represent independent measurements. I n order to calculate the standard deviation in the square of variable C, the calculation must be entered as CA2,as done in the preceding example above. If the calculation were expressed a s C*C, t h e r e s u l t i n g s t a n d a r d deviation would be incorrect because this implies t h a t the two values of C a n d their uncertainties are independent. When the calculations involve several steps, subsequent steps must not use variables that were used in previous steps. For example, consider the following expression, typically used to

I --OR

WITS STANDW

so t h a t each variable appears only once in the expression. A protection has been inserted in the program to prevent variables from being treated a s independent when they are dependent, thus preventing erroneous computations. When a variable is used i n a computation, i t is labeled "dep var" a s shown in Figure 5 a n d cannot be used again i n subsequent steps. Attempts toviolate this r u l e produces a w a r n i n g o n t h e screen,

PROTECTION OFF1

DEVIATION

............................................................................. ~ndep.var. A 8 C

D E

vdne 10

10 100 100 100

stand.Dev. 1 1 20 14.14214 14.14214

computation

1'2 AtA ARB

t o edit data

------------- ~ubtract

# log bass 1 0

INVALID ENTRY! ... Dependent variables ... !

-------------

Such warnings arouse curiosity, and the learning process begins. The protection can be turned off so m t e r c m a n d (e.9. A+Bl: t h a t the differences between correct and incorrect computations can be exFigure 6. Computer screen displaying computations when the protection is turned off plored. For example, by turning the protection off, the student can treat determine mole fractions, weight fractions, or volume fracthe sauare of 10 f 1 asAA2 and A*A. The results are shown tions. in Figure 6, involving two independent variables, A and B, with identical values and standard deviations. Clearly the A*A is equivalent to A*B, but not to AA2. To fully comprehend what i s happening, students must delve into the I n order to calculate the standard deviation in Xfrom a theoretical basis of uncertainty theory. Thus, the SDSD knowledge of the standard deviations i n A-D, the expresprogram serves not only as a calculator but also a pedasion should be rearranged to gogical tool. In t h e example above, two significant figures i n the standard deviations wereretained. Rounding the standard deviations to one significant figure a t each step in the un~ y p ex

to exit

-

Chwss a set of points io (8.4) spa- at which the fundions Mll be ~v&ated:

Choose a set of pdnto in (8, +)space at which the fvnnionr will be waluated:

i=0..3t Thus. 8 goes from 0 ton, and 6 goes from 0 to 2%. Now, define me phsricai harmonic correspondingto the desired o M a l (the angular part) n m as I f v ~ i o of n 8 and (, uoing the definitions ofthe angular part* for the atomic mtals. Let us examine the 2p, mtital, fwwhich Yim is defined as:

9.:-

'

ni 31

ji0..41

+' . ~241-r j

mus, e goes from o to n,and 6 g w n from o to 2s. Now, define me iphsrical harmonic m r p o n d i n g to the desired omits1 (the angular part) n m as t fundion of e end +, using the definitions ofthe angular parts for the atomic ,rbtsls. Lei US examine the 3 6 1 orbital. f w which Ylm is defined so:

Define (x, y, r) in terms of (r,8 . 0 :

Generate a paramwic plot of (x, y, rl:

m

Figure 7. The Mathcad document for plotting the shapes of atomic orbitals. The example shows the angular part of the 2p,orbital.

Figure 8. The Mathcad document in Figure 1 used to plot the angular part of the 3d3 orbital by redefining the array Wmjj. Volume 72 Number 12 December 1995

1081

certainty calculations often produces poor uncertainty estimations. A copy of the compiled SDSD program can be obtained from the author by sending $15 to cover the costs of handling and mailing (specify 3l/2- or 5%-in. disk).

We generate the three s$ hybrid orbitals and represent them graphically.

The twop orbitals are represented by the corresponding spherical harmonics The s orbital can be represented simply by a constant:

Acknowledgment The author is indebted to the referees for valuable comments and suggestions.

Examining the Shapes of Atomic Orbitals Using Mathcad B. Ramachandran Louisiana Tech University Ruston, LA71272

pxi,j

=

S ~ ~ ( ~ ~ ) . C O S ( $ ~ py ) 1.J.

sin(~~).sin(+~)

Define the three hybrid orbitals, using the 5 orbital radius to be In: The s t hybrid orbital, ( I )

sp2l1,J.

=

The second hybrid orbital, s$(2):

sp22. .

=

1 lpxi,j 1 f

0.333

+

--

1 -.1 px. . - -.py

6 Ji

I J

One of t h e more difficult aspects of atomic structure theory a t the undergraduate level lies i n understanding the specific roles played by the radial and angular parts of hydrogenic wave functions i n giving t h e atomic orbitals their three-dimensional shapes. We recently described a way to generate three-dimensional contour surfaces of atomic orbitals using Mathematica (6). However, Mathematica i s a rather expensive package that runs on expensive hardware, and its user interface may seem somewhat intimidating to the first-time user. This article describes how three-dimensional contour plots of spherical harmonics, that is, surfaces on which I Y LI is~ constant, may be generated using Mathcad, versions 4.0 or higher. Mathcad is relatively inexpensive, runs on inexpensive PC's, and has a very intuitive user interface. Not surprisingly, several applications of Mathcad in teaching Chemistry have appeared in this Journal (7-10).

=

px..

The third hybrid orbital, sp2(3):

"1

.

-.1

Definethe x, y, z coordinates for the parametric plots: :1.1.J.

=

sp21.1.1..~in(0~).eos($~)

~2. 1.J . = sp22i,j~sin(8i)~cos(+j)

,I.1.1.

=

~ ~ I2.J ..sin(ei)-sin(,) 1.

:I.1.J.

=

~ ~ 1.J 2 ..cos(~. 1 - 11

y 2I.J . 2. 1.J.

,

=

=

~ p 2 2 ~ , ~ s i n ( e ~ )Js i n ( + . ) ~ . ~ 1.J 2 .2c .o s ( ~ ~ )

The Roles of Spherical Harmonics and Radial Now plot ( x l , yl, zl) for the first hybrid orbital. (x2, y2, 22) for the second, and Functions (x3, y3, 23) for the third. By keeping the ''tilt" and "rotations" the same for ail The three-dimensional plots of the real spheri- three, their relative orientations are clearly observable. cal harmonics (formed by superpositions of the complex ones where necessary) are very closely r e l a t e d to t h e three-dimensional s h a p e s of atomic orbitals that do not have radial nodes, that is, the i s , 2p, 3d, etc. Therefore, this exercise will clarify the role of the spherical harmonics in determining the shapes of the atomic orbitals. The role of the radial functions can then be introduced ( ~ e r h a o using s Mathematical to c o m ~ l e t e the picture. Figure 7 shows a typical exercise i n graphing a three-dimensional surface using the absolute value of the a n m l a r part of the 2pZ orbital, that

-

-

Figure 9. Use of Mathcad to generate the shapes of the three sp2 hybrid atomic orbitals. The notes, which can be placed anywhere in the document, can make the exercise and self-explanatory, ~h~ -live document^^ featureo f ~ a t h c a dallows one to gen. the crate a different atomic orbital simDlv . "bv" array Ern; .. For example, Figure 8 shows the surface on (= 1,obtained by redefining Ylmij i n Figure 7. which I One may also use the ideas outlined above and in the two figures to generate the shapes of hybrid atomic orbitals. 1082

Journal of Chemical Education

This is a particularly useful exercise because the role of the supemsitions of atomic orbitals i n giving the hybrid orbtals their shapes and orientation is rather nonintuitive. Figure 9 illustrates one such exercise, where the three sp2 hybrid orbitals are generated using the linear combinations of the 2s, 2pz, and 2p, orbitals. All three are plotted a t 0" rotation and 45" tilt (see the graph menu of Mathcad) so that their relative orientations are due to sp2(1),sp2(2),