# (p.388) Appendix 1

# (p.388) Appendix 1

The following FORTRAN program calculates values of the defocus *f*, spherical aberration constant *C* _{s}, and astigmatism constants from optical diffractogram ring radii *S _{n}*. It is based on the method of Krivanek (1976) and was written by M. A. O’Keefe. As written,

*it is restricted to the case of large under-focus settings*, but is easily modified for over-focus (Δ

*f*positive) values, as described below.

The method depends on the fact that minima will occur in the diffractogram intensity (given by eqn (3.42)) if

Here *N* is any integer (including zero). On dividing by *u* ^{2}, we find that a plot of *N*/*u* ^{2} against *u* ^{2} forms a straight line with slope (*C* _{s} *λ* ^{3}/2) and intercept (Δ*fλ*). The program uses linear regression to find the slope and intercept (and hence *C* _{s} and Δ*f*) from the values of *N* and *S _{n}* supplied. The ring radii

*S*must be specified in Å

_{n}^{–1}, and are related to the measured ring radii by eqn (10.5). Input data include a title and the microscope accelerating voltage in kilovolts. Then follows one line of input data for each maximum or minimum, containing the number of the ring, a zero (for a minimum) or a one (for a maximum), and the radius of this maximum or minimum (in Å

^{–1}). The method of numbering the rings is indicated by the numbers across the page in Fig. A1.1. These numbers correspond to −

*N*in eqn (A1.1). (The program actually works with a new

*n*= 2

*N*for convenience, evaluated after line 10, so that the slope and intercept are twice the values given above.)

The correct numbering of the rings requires some care. All the worked examples in Krivanek (1976) follow the system indicated in Fig. A1.1, which is correct only for large under-focus (Δ*f* negative). Figure A1.2 shows *χ*(*u*)/*π* plotted for three defocus values with *C* _{s} = 1.8 mm at 100 kV. The values of *N* from eqn (A1.1) are indicated on the curves. It is seen that there are essentially three cases: (1) positive focus, for which *N* = 1, 2, 3, 4, …; (2) near Scherzer focus, for which the first value of *N* must be 0 (*N* = 0, 1, 2, 3, …); and (3) larger negative focus, in which case (for the example shown) *N* = −1, −2, −3, −3, −2, −1, 0, 1, 2, 3, 4, …. The turning point occurs at the stationary phase condition (see eqn (5.66))

Here the declining values of *N* start to increase, and may or may not repeat at the minimum value (e.g. −3 in the last paragraph). The stationary phase condition may *sometimes* be identified on a diffractogram by a broad intense ring; however, if this condition coincides with *χ*(*u*) = −*mπ*, a broad absence of intensity will result. In practice, as shown
(p.389)
in Fig. A3.1, the turning point may be driven beyond the resolution of the microscope by choosing from eqn (A1.2)

where *u* _{0} is the highest spatial frequency in the diffractogram. Then the values of *N* will increase monotonically by unit increments with negative sign. These are the conditions for which the FORTRAN program is written. An additional test of internal consistency also exists, since the program returns values of the standard deviation for slope and intercept. Because of the method of analysis, these values should *not* be taken as the errors in *C* _{s} and Δ*f*. They may, however, be used to confirm that a good straight-line fit has been obtained, and that the values of *N* have therefore been correctly chosen.

The best way to use the program for the calibration of a new microscope is to record several through-focus series at focus settings satisfying eqn (A1.3) (using the manufacturer’s data for *C* _{s} and *U* _{0}), from which the smallest focal step increment (and *C* _{s}) can be deduced. The Scherzer focus required for structure imaging can then be obtained by counting ‘clicks’ from the minimum contrast position, given by eqn (6.26) (see also Section 12.5).

# (p.390) Reference

Krivanek, O. L. (1976). Method for determining coefficient of spherical aberration from a single electron micrograph. *Optik* **45**, 97.

# (p.391) A FORTRAN program for finding defocus and spherical aberration constants from measured optical diffractograms ring radii

- C PROGRAM CSEPS

- C TO DETERMINE CS(MM) AND DEFOCUS (ANGSTROMS) GIVEN RING DIAMETERS

- C FROM DIFFRACTOGRAMS OF MICROGRAPHS OF THIN AMORPHOUS MATERIALS

- DIMENSION NAME(13),X(20),Y(20)

- C READ IN VOLTAGE IN KV

- C READ (5,100) NAME,VOLTK

- C CALCULATE WAVELENGTH

- WAVL = 0.387818/SQRT(VOLTK * (1.0 + 0.978459E − 3 * VOLTK))

- WAVCUB = (WAVL * * 3) * 1.0E7

- 70 N = 0

- 20 CONTINUE

- C READ IN NUMBER OF RING (1 FOR FIRST, 2 FOR SECOND
….),

- C WHETHER RING IS MAXIMUM (MAXIMIN = 1) OR MINIMUM (MAXIMIN = 0)

- C RADIUS OF RING IN RECIPROCAL ANGSTROMS

- READ(5,110)NRING,MAXMIN,URAD

- IF(NRING,NE.0) GO TO 10

- IF(N.EQ.0) GO TO 80

- GO TO 30

- 10 CONTINUE

- IF(N.EQ.0) WRITE(6,200) NAME, VOLTK,WAVL

- N = N + 1

- USQ = URAD * URAD

- X(N) = USQ

- Y(N) = −FLOAT(2 * NRING-MAXMIN)/USQ

- C CHECK WHETHER MAXIMUM OR MINIMUM

- IF(MAXMIN.EQ.0) GO TO 25

- IF(MAXMIN.EQ.1) GO TO 35

- WRITE(6,260)

- GO TO 80

- 25 WRITE(6,220) NRING, URAD,X(N), Y(N)

- GO TO 20

- 35 WRITE(6,210) NRING,URAD,X(N), Y(N)

- GO TO 20

- 30 CONTINUE

- C IF N.GT.1 THEN FIT CURVE

- IF(N.FT.1) GO TO 40

- WRITE(6,230)

- GO TO 70

- 40 CONTINUE

- SUMX = 0.0

- SUMY = 0.0

- SUMX2 = 0.0

- SUMXY = 0.0

- SUM2 = 0.0

- FN = FLOAT(N)

- C SUM OVER N POINTS

- DO 50 1 = 1,N

- XI = X(I)

- YI = Y(I)

- SUMX = SUMX + XI

- (p.392) SUMY = SUMY + YI

- SUMX2 = SUMX2 + XI * XI

- SUMXY = SUMXY + XI * YI

- SUMY2 = SUMY2 + YI * YI

- C CALCULATE CURVE PARAMETERS

- 50 CONTINUE

- DELTA = FN * SUMX2 − SUMX * SUMX

- A = (SUMX2 * SUMY − SUMX * SUMXY)/DELTA

- B = (SUMXY * FN − SUMX * SUMY)/DELTA

- EPS = A/(2.0 * WAVL)

- CS = B/WAVCUB

- C = FN − 2.

- C IF NUMBER OF POINTS IS LESS THAN 3 THEN SKIP STD. DEV. CALCULATION

- IF(C.LT.1.E − 3) GO TO 60

- VNCE = (SUMY2 + A*A*FN + B * B * SUMX2 − 2.0 * (A * SUMY + B * SUMXY − A * B * SUMX))/C

- SIGA = SQRT(VNCE * SUMX2/DELTA)

- SIGB = SQRT(VNCE * FN/DELTA)

- R = (FN * SUMXY * SUMX * SUMY)/(SQRT(DELTA * (FN * SUMY2 − SUMY * SUMY)))

- SIGEPS = SIGA/(2.0 * WAVL)

- SIGCS = SIGB/WAVCUB

- WRITE(6,240) A,SIGA,B,SIGB,R,EPS,SIGEPS,CS,SIGCS

- GO TO 70

- 60 CONTINUE

- WRITE(6,250)A,B,EPS,CS

- GO TO 70

- 80 CONTINUE

- CALL EXIT

- 100FORMAT(13AG/F10.5)

- 110FORMAT(2I2,F12.6)

- 200FORMAT(1H1,13AG,/,15HOVOLTAGE (KV) = ,F8.2,10X,16HWAVELENGTH (A) = ,

- $ F9.6,//)

- 210FORMAT(1H0,10X,17HRADIUS OF MAXIMUM,12,2H = ,F7.4,17H (RECIP.ANGSTROM),

- $ 20X,3HX = ,F7.5,5X,3HY = ,F8.2)

- 220FORMAT(1HO,10X,17HRADIUS OF MINIMUM,12,2H = ,F7.4,17H (RECIP.ANGSTROM),

- $ 20X,3HX = ,F7.5,5X,3HY = ,F8.2)

- 230FORMAT(1HO,10X,41HONLY ONE POINT IN DATA SET–DATA IGNORED,/)

- 240FORMAT(1HO,10X,11HINTERCEPT = ,F8.2,2,H(,F5.2,11X,7HSLOPE =

- $ ,F8.2,2H (,F6.2,1H),11X,12HCORR.COEFF. = ,F6.4,///,1HO,50X,20HDEFOCUS

- $ (STD.DEV.) = ,F9.2,2H (,F6.2,6H) ANG.,5X,15HCS (STD,DEV.) = ,F6.3,2H

- $ (,F4,3.5H) MM.,//)

- 250FORMAT(/,1H0,10X,

- $ 11HINTERCEPT = ,F8.2.5X,7HSLOPE = ,F8.2,39X,9HDEFOCUS =

- $ ,F9.2,5H ANG.,5X,4HCS = ,F6.3,4H MM.,//)

- 260FORMAT(1HO,20X,***RING NOT LABELED AS MAXIMUM OR MINIMUM***)

# (p.393) Sample data and output from program (100 kV)

- TEST OF PROGRAM — O.L.’S DATA

- VOLTAGE (KV) = 100.00 WAVELENGTH (A) = 0.037013

- RADIUS OF MAXIMUM 1 = 0.0770 (RECIP.ANGSTROM) X = 0.00593 Y = −168.66

- RADIUS OF MINIMUM 1 = 0.1120 (RECIP.ANGSTROM) X = 0.01254 Y = −159.44

- RADIUS OF MAXIMUM 2 = 0.1400 (RECIP.ANGSTROM) X = 0.01960 Y = −153.06

- RADIUS OF MINIMUM 2 = 0.1660 (RECIP.ANGSTROM) X = 0.02756 Y = −145.16

- RADIUS OF MAXIMUM 3 = 0.1890 (RECIP.ANGSTROM) X = 0.03572 Y = −139.97

- RADIUS OF MINIMUM 3 = 0.2150 (RECIP.ANGSTROM) X = 0.04622 Y = −129.80

- RADIUS OF MAXIMUM 4 = 0.2420 (RECIP.ANGSTROM) X = 0.05856 Y = −119.53

- RADIUS OF MINIMUM 4 = 0.2890 (RECIP.ANGSTROM) X = 0.08352 Y = −95.78

- INTERCEPT = −171.83 (0.85) SLOPE = 908.90 (19.57) CORR.COEFF. = 0.9986

- DEFOCUS (STD.DEV.) = −2321.26 (11.50) ANG. CS (STD.DEV.) = 1.792 (0.039)MM