Codes to Accompany

"Optically Pumped Atoms"

W. Happer, Y.-Y. Jau, and T. G. Walker
John Wiley and Sons, 2009

From the preface to the book:
"No special expertise is needed to model optically pumped systems as two- or three-level atoms, which often give good qualitative insight to observed phenomena. Unfortunately, these simplified models are often inadequate for quantitative analysis, have limited predictive value, and can lead to very serious errors in the determination of resonance lineshapes, transient responses, key experimentally determined parameters that account for relaxation phenomena, etc. In this book, we show that modern computer software makes it possible to model real, multilevel atoms in much the same way as two-level atoms. Throughout the book, the presentation is structured to allow translation of the key formulas into practical, consise, and readable computer codes. Many examples of practical computer codes are included in this book, and have been used with success in our research. These codes can, with fairly minor changes, be used to model very sophisticated modern experiments using optically pumped atoms."

We have collected here the computer codes given in the text of the book, with the following small modifications to facilitate their practical use. There are generally two types of codes: the generic modeling codes that are the focus of the book, and a few MATLAB functions that are called by those codes. The modeling codes generally build on each other, so a code appearing later in the book may assume several previous codes. To allow the reader to avoid tedious stringing together of the separate files for each code, we have prepended to each code commented out names of the previous codes that are needed. For example, Code01_05.m reads

%Code01_03 %input Code 1.3
rhoin = null(G); rhoin = rhoin/(rPS*rhoin);

The first line indicates that successful running of this code requires Code 1.3. Rather than copying the commands from the file for Code 1.3, the user only need delete the first "%" sign in the first line of Code01_05.m above, and then run Code01_05.m. For more complex codes later in the book, several such deletions are necessary.

The naming convention for the modeling codes is that "CodeXX_YY.m" corresponds to Code XX.YY in the book. The exceptions to this are the specialized MATLAB functions called by the modeling codes, which are named in the standard MATLAB fashion; i.e. the function CG() is in the file CG.m.

In addition to the codes directly from the book, we include some more detailed codes and some example codes for Chapter 10 on relaxation.

These codes are distributed as is by the authors. We have checked them on our computers, but cannot guarantee that they will work identically on every platform, and cannot guarantee that they are bug-free. When bugs become known, we will update the codes accordingly. You are free to copy the programs and modify them for your needs; if you find them helpful for your work we hope you will cite the book appropriately.

Zip file of the programs

The authors are grateful to the MINDS@UW program of the University of Wisconsin for their committment to providing permanent public access to these programs.