Simulating Fields, Ions, and Optics

A guide for learning about ion simulations

This website is intended to serve as an introduction to many of the concepts that you will encounter with more professional ion simulation programs – specifically SIMION, a program to perform complex ion simulations. As SIMION is mostlyintended to simulate mass spectrometry (MS)-related components, this text is biased towards concepts and examples relevant for MS. Although this text is intended as an introduction, it assumes familiarity with terms such as: ion, electron, electrode, electric field, voltage, and mass.

The simulations discussed are for gas phase ions in high vacuum environments, such as those that might be found in outer space. This website does not discuss simulating liquid-phase ions, such as those that might be found in a battery. It simulates the translational motion of ions, not their internal states, so inter and intra-molecular forces and interactions are largely ignored, except for the pages on Ion mobility and Reactions.

Almost all the pages in this website are accessible directly from the top menu. Each section is similar to a short chapter and contains six web pages, grouped by topic. Although you do not need to read the pages in order (and in the case of The Playground and Bonus details pages, you are encouraged to only read on if you are particularly interested in the topic), in general the concepts build on one another.


Motivation, history, & influences

When I first started studying MS instrumentation I was exposed to SIMION. Entire literature articles, or even PhD dissertations, could be written with little or no experimental data – with only the data collected from rigorous simulations performed with SIMION. We had a copy of SIMION in the research lab where I worked. Loading SIMION for the first time, I was greeted by its rather unfriendly user interface. After clicking around a bit and becoming frustrated with not understanding what I was doing, or how to do what I’d have liked, I closed the program and didn’t reopen it for years. In fact, when I did reopen it, it was because I was attempting to develop course material that related to ion simulations. (Those who can, do; those who cannot…)

My fresh attempts to learn SIMION to make some course materials were also a bit of a non-starter. I persisted through flying ions in the SIMION time-of-flight tutorial the second time, but felt my motivation waning as my understanding did not improve. Luckily, there was an ex-colleague of mine that I remembered had developed a MATLAB script for performing rudimentary, 2D-based ion simulations. I contacted him and he happily provided me the script. It loaded a little 200×200 bitmap – that could be made and edited with Microsoft Paint – and flew a single ion from some x and y coordinate (from 0 to 200 units). I read through the code, translated the it into Python, and suddenly I was able to understand those high-level papers on SIMION-based ion simulations that had eluded me for so long.

Excited by my newfound learning crutch, I proceeded to simplify the Python script, heavily comment it, and write a thorough tutorial on how to use it. I presented it to the students I was teaching, hoping that they would find it useful. Even if they didn’t know Python, the comments should allow them to get it working…

And it turns out not understanding Python isn’t the biggest hurdle to running and tweaking a Python script. There are a lot of little stumbling blocks – installing the Python toolchain, downloading libraries, working with the command line, and small differences between operating systems lead to a lot of cognitive overhead, like the overhead I’d experienced with SIMION originally. Those that understood Python already, or who were more persistent at learning than I, really learned a lot. The rest, well they found some point where they became frustrated and, understandably, gave up.

That brings us back to this site and specifically the Simulation Playground. The Simulation Playground is yet another translation and expansion of the code that was so helpful to me. The Simulation Playground is the crux of this site and the text serves to provide context and meaning behind it.


Praise and stealing

Most, and possibly all, of the information in this site can be found in the SIMION User Manual.1 Although my own failures to initially learn SIMION might seem to indicate that it doesn’t have enough learning materials, nothing could be further from the truth. The SIMION User Manual and SIMION itself are full of tutorials, helpful explanations, and information about where to find out more. These just didn’t click with me until I’d already learned a bit about ion simulations. These tutorials are immensely helpful and go into much more depth than this site.

Similarly, most of the Implementation section is information regurgitated from David A. Dahl’s paper discussing the development of SIMION.2 Much of the implementation of the Simulation Playground relies on information discussed in this paper, as well as through observations of the SIMION program and the added functionality it gains from its many Lua scripts.

The layout and idea behind this site is stolen directly from Jack Schaelder’s SEEING CIRCLES, SINES, AND SIGNALS. Everything from the title of this site to the header for this section has been shamelessly pilfered. Jack Schaedler’s site helped me tremendously as a graduate student and I continually refer people and students interested in signal processing there. I think the world could use a few more visual “compact primers” on different topics.

Although the layout and visual design of the website is stolen, the underlying code is entirely bespoke and mostly hand-rolled without the use of more than a few mathematical libraries. The underlying code for the playground is almost entirely written in Rust and then compiled to WebAssembly. If SEEING CIRCLES, SINES, AND SIGNALS is an exploration of the D3.js library, this site is an exploration of WebAssembly. More information about the creation of this site can be found in the Code page.

[1] Dahl, D.; Manura, D. “SIMION (R) Version 8.0/8.1 User Manual”, Scientific Instrument Services., Ringoes, NJ. 2011.
[2] Dahl, D. “SIMION for the personal computer in reflection”, International Journal of Mass Spectrometry. 200 (1-3) 2000. 3–25.