Skip to content

My tools to efficiently use SIMION for electron and ion spectrometer design (VMI, 3D momentum, TOF)

License

Notifications You must be signed in to change notification settings

erik-mansson/electrostatic-simulation-tools

Repository files navigation

electrostatic-simulation-tools

Some tools to efficiently use SIMION for electron and ion spectrometer design (VMI, 3D momentum, TOF)

These scripts and helper functions are released under the Mozilla Public License 2.0, summarized here. They are however not of much use without the commercial software packages SIMION (© Scientific Instrument Services, Inc.) and MATLAB (© The MathWorks, Inc.) which this project has no involvement in. Altohugh much source code in the Matlab language can be run by GNU Octave (https://en.wikipedia.org/wiki/GNU_Octave), sometimes after minor changes, the compatibility of this project has not been examined.

I have developed these tools over several years (starting around 2010 as a Ph.D. student) and they are provided as-is, even if the intended usage is not always obvious or completely documented, so that I will be able to refer to them publicly. If you use them in your academic (or commercial) work, you're welcome to contact me to discuss or share improvements and to cite this github repository or one of my articles (e.g. https://aip.scitation.org/doi/full/10.1063/1.4904372 for some generic 2D–3D theory and design, or https://www.epj-conferences.org/articles/epjconf/pdf/2019/10/epjconf_up2019_03007.pdf which is just a conference abstract so far).

Purpose and intended use

SIMION is a commercial software for simulationg particle trajectories in the electric field between several metallic electrodes. It has a graphical user interface and allows user-defined code to be provided in a script in the Lua language (https://en.wikipedia.org/wiki/Lua_(programming_language)). The file script to copy and name as each model.lua with Lua source code is at the heart of this project's helper-tools. If a copy of this file is named like your SIMION-model of your spectrometer, and located in the same directory, it will be run when you fly particles in the SIMION GUI as well as when launching such a run from the command line.

The Lua script introduces GUI-adjustable variables, as well as some command-line-only variables, which can control various aspects of how particle trajectories are initialized and then analyzed to print a summary with statisticas that attempts to let a user judge the "resolution" (of velocity map imaging spectrometers, 3D-momentum spectrometers/reaction microscopes as well as the time of flight aspect for mass- or energy spectroscopy). By keeping an eye on some values in the resolution summary, an interactive optimization/tuning can be made of the electrostatic potentials (voltages) by changing them (or changing something like start-position). The voltages can be controlled either by the standard SIMION GUI ("Fast Adjust Voltages..."), via GUI-variables of the Lua-script (can be simpler for a design with resistor chains), via the SIMION command line and variables of the Lua-script (to quickly paste an array of electric potentials), or at a higher level by letting MATLAB run automatic optimizations of an objective function that launches SIMION and assigns a score to the simulation results. For invocation by runsim3.m in MATLAB, you also need to have the record3.rec file in the same directory as the model.

The beginning of the .lua file contains model-dependent constants that should be edited for each model, e.g. related to the number of electrodes, resistor chains, size of the simulation volume and the detector location(s). Even without editing the constants, some modes of operation are useable (voltages can be obtained from an array in _G.U instead of by GUI-adjustable variables for resistor chains; SIMION can record details about each trajectory to a log file even when the Lua script is not able to group the trajectories for printing a meaningful statistics & resolution summary).

Examples and documentation

For now, the best documentation of GUI-adjustable and command line varibles is the header of the .lua file, or as a fallback searching in that file for where specific variables are used. To see the GUI-adjustable variables in action, open example model/example.iob in SIMION. An example of defining voltages on the SIMION command line (bottom of window when showing the model) is to paste or type something like
_G.U={-4000,-4000*0.7,-50}; _G.U[0]=0; U=_G.U; adjustable DoNotSetPotentials=-1; in the case of a model with three electrodes (like the example). By pressing the arrow-up key while the text cursor is in the command line box, you can easily return to the recently used commands and make small changes or swap between a few variants.

For high-level usage by Matlab, see the help-texts for parameters in runsim3.m and readsim3.m. Non-trivial examples of usage and visualiation in Matlab can be found in the script_VMI_sim_and_calib.m. After ensuring the MATLAB-library directory is on your Matlab path (to find functions defined there) and possibly editing some paths in runsim3.m to make it find your SIMION installation and model files, script_VMI_sim_and_calib.m should be runnable as it is. It contains a rather large amout of commented-out variants of usage, e.g. using electrons or cations, different lists of energies, different sizes and offsets of the distribution of particle starts (ionization volume), as well as loops to iterate over lists of settings.

About

My tools to efficiently use SIMION for electron and ion spectrometer design (VMI, 3D momentum, TOF)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages