The simulation code

Learning by inspecting and tweaking

As mentioned in the forward, my learning breakthrough was facilitated by observing and modifying the code that actually performed the simulations. The purpose of this site is to help facilitate that learning process — and there really isn’t any substitute for looking at and playing with code that performs the ion simulations. The code for this site is freely available. The code that powers the Simulation Playground is written in Rust and contained in a single “lib.rs” file that can be found in the “Simulation Code” folder. The Rust code is compiled to and then compiled to Webassembly. Hosting is provided by GitHub. No cookies are used for this site, although Javascript must be enabled to use the Simulation Playground.

Python version

The code that started it all

This site all came about from a small script that I provided to my students. To download a .zip file containing this script (“ion_simulation_script.py”) as well as a “readme.pdf” and an “electrodes.png” files that are helpful for using the script, click the button below:

I have also provided the readme as a webpage. This readme walks through setting up the Python toolchain, using the script, and a few modifications to a simple einzel lens simulation. It also provides a short introduction to the Python programming language and some conceptual questions.

License and Citation

If you are interested in using this site

All Javascript, CSS, and Rust code for this site is Licensed by the MIT License. You are free and welcome to use it, although I’d love a shoutout if you do.

The text Simulating Fields, Ions, and Optics is © 2021 by Ian Anthony. All rights reserved. No part of this book may be reproduced without written permission from me. Send requests to igmanthony@gmail.com. Reproductions that qualify as fair use under U.S. copyright law do not require permission.

Please use the following information for any citations:
Anthony, I. G. M. “Simulating Fields, Ions, and Optics.” igmanthony.com, May 2021, igmanthony.com/fields-ions-optics/

Design

More stealing and praise

Although the overall design for this site was stolen from Jack Schaedler, some of the design specifics might be of interest to some.

The color scheme is usually Material Design — mostly because I have no eye for color coordination, but also because I’m colorblind and I can tell apart all the colors. The color map used in the Simulation Playground is Turbo, which I find to be a much-improved version of Jet and very suitable for visualizing the positive and negative voltages of electrodes.

The fonts for this site are Montserrat and Crimson Pro. I’ve long been a fan of Sebastian Kosch, the designer of Crimson. I think Crimson Pro works even better than Crimson as a webfont. Montserrat is likely one of the most-used webfonts around — although a bit overexposed, it worked really well for the Simulation Playground so I kept it for the headings. Although it likely isn’t apparent from the text, I owe a great deal of gratitude to Matthew Butteric for his excellent book on Typography, both in terms of a resource but also as an example of how to do web book typography well.

Images are credited below the specific image, but most have been cropped and dithered to reduce their size and add visual interest. The inspiration for dithering large images was from LOW←TECH MAGAZINE. I used Dither Me This and GIMP for dithering and .png compression, respectively.

The HTML code for this site was all hand-written. The inspiration for that is mostly due to a love of @thebarrytone’s infamous site as well as some derivative works. By writing every line by hand, I can reduce the size of each page and shrink the overall footprint of the site. I can also ensure that the formatting looks good and that the site is a bit more accessible.