Title :HP45 Calculator program (enhanced) V1mod7 Keywords :HREM, Wavelength, Scherzer, Resolution, hex, oct, bin Computer :anything with F77 Operating System :anything with F77 Programming Language :Fortran 77 Hardware Requirements :CPU, terminal Authors :Tony Pitt, Owen Saxton, Graeme Wood, Mike O'Keefe, ... Correspondence Address :MAOK@CSA2.LBL.GOV :M.A. O'Keefe, NCEM, LBL 72-213, Berkeley, CA 94720 Description: This is a program designed to emulate a scientific calculator operating in reverse polish mode (originally based on a HP45, but now with many enhancements, including binary, hex, and octal numbers, and electron microscope functions like wavelength and resolution). The HELP command provides one-line explanations of each command. Commands are - + - * / SQRT REP SIN COS TAN TYPE DEL PI EXP CLR CUBE SQU REC SWOP SWAP CHS POC ROLL LOG ALOG ASIN ACOS ATAN LN OCT HEX X DISP INT COMS BIN DEC INV DEG RAD D>R R>D EXIT WAVL KV SCH OPT RSCH ROPT LIMD LIMA STO RCL HELP Exact functions of each command are easily read in the Fortran source, which has extensive inbuilt documentation. Extra user-defined commands are easily added to the source at the designated place. The program stores input numbers in a stack, and commands operate on the top one or two of the stack members. Expressions can be up to 80 keystrokes long and are evaluated in reverse-polish convention. E.g. the result of the expression 6 5+ is 11, that of 6 5/ is 1.2, the result of 5 5+5+3/ is 5. The calculator is entered in "radian-decimal" mode (the prompt expresses this fact by taking the form "RAD:DEC>" on entry), but can be changed to other modes by the commands DEG, BIN, OCT, HEX, DEC and RAD. In radian mode the commands SIN, COS, TAN assume that all angles are in radians; DEG puts the calculator into degree mode, and all trig functions then assume that all angles are measured in degrees; RAD switches the calculator back from degree mode to radian mode. The commands BIN, OCT, HEX and DEC are used to switch the calculator into binary, octal, hexadecimal and decimal modes respectively. The mode-change commands can be used within arithmetic expressions; e.g. with the calculator in decimal mode, the command line 23hex2b+dec will place the decimal number 23 on the stack, convert to hexidecimal mode, place the number 2b on the stack, add the top two numbers, and convert the result to decimal 66. The commands WAVL, KV, SCH, OPT, RSCH, ROPT, LIMD, LIMA are useful in computing quantities used in high resolution transmission electron microscopy. The WAVL command gives the electron wavelength in Angstroms assuming that the top number on the stack is the accelerating voltage of the microscope in kV. The command KV computes the voltage from the wavelength in Angstrom units. The commands SCH and OPT compute the Scherzer defocus and "optimum" defocus respectively, assuming that the top two numbers on the stack are the objective lens spherical aberration coefficient Cs in mm. and the electron wavelength in Angstroms. The Scherzer defocus is defined as the square root of (wavelength times Cs), and the "optimum defocus" as the square root of (wavelength times Cs times 1.5). E.g. the command string 400 WAVL 1.1 OPT is used to compute the "optimum" defocus for a 400keV microscope with a Cs of 1.1mm. The command RSCH (Resolution at SCHerzer defocus) gives the resolution in Angstroms corresponding to the spatial frequency at which the linear-image CTF reaches cross-over at Scherzer defocus; the command ROPT (Resolution at OPTimum defocus) gives the resolution in Angstroms at the spatial frequency at which the linear-image CTF reaches the upper limit of the optimum defocus pass-band. The command string 400 WAVL 1.1 ROPT will give the "structure- image" resolution for a 400keV electron microscope with a Cs of 1.1mm. The commands LIMD and LIMA give the "Information Limit" resolutions due to the effects of partial temporal and spatial coherence respectively -- i.e. the limits at which the "envelope functions" due to chromatic aberration (spread of focus) and incident beam convergence drop to exp(-2). LIMD is the resolution LIMit (in A) due to Delta, where delta is the spread of focus in Angstrom units due to the combined effects of chromatic aberration, high-voltage ripple, energy spread in the electron beam, lens current ripple, and vertical vibration of the specimen relative to the objective lens polepiece. LIMD is calculated from the electron wavelength (in A) and the spread of focus in Angstrom: e.g. the expression 400 WAVL 85 LIMD would give the spread-of- focus resolution limit of a 400keV microscope with a delta of 85A as 1.48A. LIMA is the resolution LIMit (in A) due to Alpha, where alpha is the semi-angle measured in milliradian of the cone of electrons incident on the specimen. The value of LIMA varies with defocus and Cs, and thus requires the presence of four parameters on the stack -- the electron wavelength (in A), Cs(mm), the defocus(A), and alpha(milliradian). The expression 400 WAVL 1.1 -500 .5 LIMA calculates a convergence resolution limit of 1.27A for a 400keV microscope with a Cs of 1.1mm focussed at an underfocus of 500A with a convergence semi-angle of 0.5milliradian. NOTE: Although the other three parameters may be entered in arbitrary order, the last entry on the stack must be the value of alpha. References: O'Keefe & Pitt, Electron Microscopy 1980, vol.1, pp.122-123. Compilation procedure: standard F77 Linking procedure: standard Test data: none General comments: i/o is to Fortran unit 3, so assign this logical unit to your terminal