← Back to the simulator
Beta · help and methods

Simulator help

An in-browser simulator for electrostatic and magnetic charged-particle optics: draw electrodes on a two-dimensional planar or cylindrically symmetric grid, solve for the potential, and trace ions and electrons through lenses, mirrors, energy analyzers, time-of-flight spectrometers and RF devices.

Beta, in review. The validation suite below compares the simulator with published and exact values, but its results have not yet been reviewed. Use the simulator for exploration, and check numbers that matter against an independent calculation.

Quick start

  1. Start from a preset. The Einzel lens loads on a first visit, solves and runs by itself. Presets in the top bar opens ten more devices, each with a short note and a suggestion to try.
  2. Change voltages. Every electrode in the Electrodes tab has a voltage box and a slider. With Live on, the trajectories run again while you drag. A voltage may be a number, a parameter name or an expression, and units can be typed (2 kV).
  3. Edit the geometry. Pick an electrode (or Void) in the view bar and draw boxes, tubes, plates, discs, circles, annuli, polygons, lines and quadrics on the canvas, or type exact numbers in the inspector. A geometry change marks the fields stale; small grids are solved again automatically, larger ones when you press Solve.
  4. Define particles and detectors. The Particles tab sets each source's species, positions, directions, energies and start times, or takes an explicit list of particles; the Recording tab adds planes and spheres. A plane that stops particles is a detector.
  5. Read the results. The dock below the canvas has Summary (counts, transmission, waist, spot size, energy diagnostics), Hits, Planes (detector images, phase space, emittance), TOF, Lens (focal properties), Profile (potential and field along a line), Charges & multipoles, Scan & tune, Compare (pinned runs side by side), Benchmarks and Log. Every table and plot exports to CSV.
  6. Save or share. Work is saved automatically in this browser. Project saves and opens files (.ionopt.json); Share copies a link that contains the whole project.

Units and conventions

QuantityUnitQuantityUnit
LengthmmPotentialV
TimeµsElectric fieldV/mm
Velocitymm/µs (= km/s)Magnetic flux densityT
Massu (unified atomic mass unit)FrequencyMHz
Chargee, signed (an electron is −1)Angles you typedegrees
Kinetic energyeV (total, not per charge)CurrentA

Constants are the CODATA 2022 values; derived ones (for example the acceleration constant e/u) are computed from them. Particles are relativistic by default; switch that off in the tracer settings to compare with nonrelativistic formulas.

Coordinates. The canvas shows x to the right and y up; particles always move in three dimensions (x, y, z).

  • Planar: the electrodes extend without limit along z, so the potential depends on x and y only and particles move freely along z (the RF quadrupole preset uses this for ions traveling along the rods).
  • Cylindrical: everything is a body of revolution about the x axis. The vertical axis is the radius r = √(y² + z²), and the canvas draws the lower half as a mirror image. A box becomes a ring or a disc, a circle a torus (or a sphere when it is centered on the axis), a line a cone or a flat annulus.
  • Mirror planes halve or quarter the work for symmetric devices: the solved region ends on the mirror plane, and the other half is its reflection.
  • Anti-mirror planes do the same for devices whose other half carries the opposite voltages, such as a deflector with plates at +V and −V or a hexapole: the potential is odd across the plane, φ(−x, y) = −φ(x, y), so the plane itself is at 0 V (it must lie on a grounded domain edge at x = 0 or y = 0). The canvas draws the other half with the opposite potential, and a particle that hits the image of an electrode is reported under that electrode. A charge density is mirrored with the opposite sign too (the image half carries −ρ), so a beam centered on the plane needs the full domain or a mirror plane. In the Charges & multipoles tab such a model gives the multipoles of its potential, but not charges, the capacitance matrix or induced signals (those need the full domain). A plane can be a mirror or an anti-mirror, not both.

Parameters and expressions. Any number can be an expression of parameters: + − * / ^, parentheses, sqrt abs sin cos tan (degrees), asin acos atan atan2 (returning degrees), exp ln log10 min max pow floor ceil round hypot and pi. Precedence is the usual one: ^ binds tighter than a leading minus, so -x^2 means -(x^2) and exp(-r^2/w^2) is a Gaussian (write (-x)^2 for the square of -x); a sign after ^ belongs to the exponent, so 2^-1 is 0.5. The Einzel preset, for example, draws its tubes from a parameter D, and the hemispherical analyzer sets its voltages from the pass energy Ep. Expressions are parsed and evaluated by the simulator; they are never run as program code.

Geometry rules

  • Later shapes win. Shapes are painted in list order, and each one overwrites what lies under it. A shape assigned to Void carves free space out of earlier shapes (a hole, a slit, a gap). Reorder shapes by dragging them in the Shapes tab, or with [ and ].
  • Exact boundaries. Each grid line is intersected exactly with every shape, so a surface that falls between grid nodes keeps its true position: the solver uses the true distance to the surface (Shortley and Weller's method) instead of moving the surface to the nearest node. Curved electrodes are therefore accurate to second order in the cell size, and a plate thinner than a cell still blocks the field and the particles.
  • Zero-thickness lines (the Line tool) are sheets: they hold their electrode's voltage on both sides. Use them for thin apertures, deflector shields and meshes.
  • Meshes. Set an electrode's kind to mesh to make it transparent to particles. For the field a mesh is an ideal equipotential surface; a particle that reaches it passes with the probability given by the mesh transmission and is otherwise absorbed. The field is never averaged across a mesh, so the field jump at a mesh is kept sharp.
  • Domain edges are held at an electrode's voltage, have no normal field (a symmetry or open edge), are the axis (cylindrical), or follow a profile: segments of different electrodes, or a linear ramp between two voltages that acts as an ideal resistive divider, for example the walls of an ideal ion mirror.
  • Beyond the domain a particle either stops (it is recorded as having left) or drifts on in a straight line with no electric field; a magnetic field still acts there. Electrodes are not tested for hits outside the grid.
  • Warnings in the Log and on the Shapes tab point out shapes smaller than a cell, features thinner than half a cell, electrodes of different voltages that touch, shapes outside the domain or hidden by later ones, and apertures resolved by too few cells.

Voltages without new solves. Each electrode's field is solved once with that electrode at 1 V and all others at 0 V. Because Laplace's equation is linear, the field for any set of voltages is the weighted sum of these basis fields, so changing a voltage, a waveform or a parameter that only sets voltages takes a few milliseconds and needs no new solve. Time-dependent voltages (cosine, pulse or a table of values, each repeating or not) are grouped into channels and summed at every time step.

Space-charge density. The Domain tab accepts a charge density ρ in C/m³ as an expression of x, y (r in a cylindrical domain) and the parameters, for example a beam profile or a uniformly charged region. The field then obeys Poisson's equation: its particular solution, with 0 V on every electrode, is solved once as one more basis field and added to the voltage superposition, so voltage changes still need no new solve. The density is sampled at the cell centers, which is second-order accurate for smooth profiles; a sharp edge is resolved to first order, so use at least 40 cells across a step. Across an anti-mirror plane the image half carries −ρ (the simulator warns). The particles themselves do not change the field (there is no particle-in-cell loop); for forces between the particles see Physics plug-ins.

Pole pieces. A magnet of type Pole pieces describes iron poles by a magnetic scalar potential ψ in T·mm: each piece is an infinitely permeable equipotential of ψ, the gaps between pieces are solved on the domain grid, and B = −∇ψ, so a gap g between pieces at ψ1 and ψ2 carries about |ψ1 − ψ2|/g tesla, with its fringe fields. The open domain edges have either no normal B or ψ = 0; the domain's mirror and anti-mirror planes apply to ψ too (a dipole across y = 0 needs an anti-mirror plane there). The pieces are not obstacles for the particles; draw an electrode where the iron should stop them. The field is zero inside the pieces and outside the grid.

Particle sources

Sampled sources draw each particle's species, position, direction, energy and start time from the distributions set in the Particles tab, either on a regular grid or at random from a counter-based generator, so a run is the same each time.

Particle lists. A source can instead be an explicit list: one particle per line with mass (u), charge (e), position (mm), direction and kinetic energy (eV) or a velocity (mm/µs), and birth time (µs). Freeze to list turns a sampled source into the list of exactly the particles it generates, so a run can be repeated bit for bit and shared without its random seed. Import CSV and Export CSV read and write these lists at full precision; the simulator's own Hits table imports as end states. Lists of more than 2,000 particles are not shown as text; use the CSV buttons.

Source from end states. The Hits tab makes a list from where the particles shown ended, either reversed (v → −v, a reverse-flight check: with exact integration the particles return to where they started) or as they ended (a hand-off to another project). The other sources are disabled so the new one flies alone; undo reverts it.

Weights. Every source has a statistical weight (1 by default) that each of its particles carries in the weighted transmission of the Summary tab and in the histograms of the Planes and TOF tabs; the trajectories themselves do not depend on it, and the peak statistics stay unweighted.

Canvas views

  • Potential-energy surface. Layers › Potential-energy surface (3D) draws the potential energy q·φ of the particles' polarity over the cross-section as a height map, so wells read as wells; electrodes appear as plateaus in their colors, and trajectories and replay dots lie on the surface. Drag to rotate, use the wheel to zoom, and press 0 to refit; Relief scales the height, and the RF display-time slider redraws it. Drawing tools and the cursor readout pause while it is on.
  • Replay. The play button in the view bar replays the run as moving dots with short tails (speed 0.25 to 4 times; a whole run takes 8 s at normal speed). With reduced motion set in the operating system the replay steps 10 times a second and stops at the end. Only stored trajectories can be replayed.
  • Vertical stretch. Layers › Vertical stretch (y ×2 to ×16) spreads long, thin devices such as the reflectron; a badge beside the scale bar shows the factor and a length along y.
  • Edge labels. Open domain edges (no normal field, ∂φ/∂n = 0), the axis, and mirror and anti-mirror planes are labeled on the canvas, so the boundaries implied by the model are visible.
  • Pinned runs. Runs pinned in the Compare tab are drawn as dashed ghosts with a numbered tick at each waist.

Accuracy

Three things limit the accuracy of a result: the grid (how finely the electrodes and the field are resolved), the field interpolation between grid nodes, and the trajectory integration. The simulator reports on each.

  • Cells across the smallest aperture. Lens properties depend on how well the field in and near the smallest opening is resolved. For thin-walled electrodes, 20 cells across the aperture radius give focal properties good to about 1 part in 1000, 40 cells about 2 parts in 104, and 80 cells about 1 part in 104. Electrodes with sharp (re-entrant) corners converge more slowly, with an error proportional to the cell size to the power 4/3: the default Einzel lens, at 40 cells, is good to a few parts in 1000. Use the Accuracy check to measure your own geometry. Below 16 cells a warning appears. In two dimensions, halving the cell size multiplies the node count, the memory and roughly the solve time by four. The Domain tab shows the node count, the memory and the estimated solve time as you change the cell.
  • Field interpolation. Cubic (the default) builds a smooth potential from the nodal values and their derivatives, and the force is its exact gradient, so energy is conserved to the precision of the integrator: best for analyzers, mirrors and long flights. Linear interpolates the nodal field; on very coarse grids (fewer than about 16 cells per aperture radius) it can give smaller focal errors. In cells cut by an electrode both modes use the nodal field on the particle's own side of the electrode only.
  • Trajectory accuracy. The tracer settings offer four levels:
    LevelRelative toleranceLargest stepNear electrodesSteps per RF periodBoris steps per gyration
    Draft10−61 cell0.25 cell2464
    Normal (default)10−80.5 cell0.1 cell32128
    Fine10−100.25 cell0.05 cell64256
    Customyour own values (steps of at most one cell)
  • Energy diagnostics. In static fields the simulator compares each particle's total energy (kinetic plus potential) at the end with its value at the start, and adds up the difference between the change in kinetic energy and the work done by the field. The Summary tab counts the particles whose energy error exceeds 10−6 of the energy scale (10−4 with linear interpolation). Warnings usually mean that a trajectory passed through cells cut by an electrode, where the field is only first-order accurate, or crossed a mesh at a coarse tolerance; a smaller cell or a tighter tolerance removes them.
  • Accuracy check. The button in the Summary tab solves the fields again with half the cell size, runs the first 200 particles again with a 100 times tighter tolerance, and reports how much each result changed. When twice the cell size also divides the domain it solves once more with that cell, so that the observed order of convergence p can be measured, and estimates the remaining grid error by Richardson extrapolation: for the current cell size it is the change × 2p/(2p − 1), for the finer one the change/(2p − 1). The order is clamped to between 1 and 2, and taken as 1 (the cautious choice) when it cannot be measured. Smooth geometries converge with p ≈ 2; electrodes with sharp corners give p ≈ 4/3, so the error of the current result is several times the change.
  • Solver tolerance. Each basis field is solved until the estimated error is below 10−10 V per volt applied. The fields pill in the top bar shows the method used, the iterations and the estimated error.

How it works

The methods are standard ones from the open literature; the references are listed at the end of this page.

The field

The potential obeys Laplace's equation, ∇²φ = 0, or Poisson's equation, ∇²φ = −ρ/ε0, when the domain has a charge density (Griffiths, ch. 2–3). It is discretized with finite differences on a square grid. Where a grid line meets an electrode between two nodes, the difference formula uses the true, shorter distance to the surface (Shortley and Weller, 1938), which keeps the scheme second-order accurate at curved and oblique boundaries. In cylindrical symmetry the axis row uses a finite-volume form.

The equations are solved by geometric multigrid: V-cycles with two red-black Gauss–Seidel sweeps before and after each coarse-grid correction (Briggs, Henson and McCormick; Trottenberg, Oosterlee and Schüller). Every coarse grid is built from the exact geometry at its own spacing, so thin plates and meshes do not disappear on coarse levels. If multigrid stalls, the solver switches automatically to BiCGSTAB (van der Vorst, 1992) preconditioned by a multigrid cycle, and then to successive over-relaxation with Carré's adaptive choice of the over-relaxation factor (Carré, 1961; Hageman and Young). It stops when the estimated algebraic error and the scaled residual are both below the tolerance.

From the grid to a force

In cells away from electrodes the potential is interpolated by a bicubic Hermite surface built from the nodal potential and its derivatives (estimated with fourth-order differences), so both the potential and the field are continuous and the force is the exact gradient of the interpolated potential. In cells cut by an electrode or a mesh the nodal field is interpolated bilinearly, using only nodes on the particle's own side of the surface and extrapolating from them where a corner lies behind it; a field is never averaged across an electrode. Ideal analytic fields (uniform, quadrupole, coaxial, spherical) can be added on top of the solved field.

Particle motion

Particles follow the relativistic Lorentz-force equations, written for the proper velocity γv. The default integrator is the adaptive Dormand–Prince 5(4) Runge–Kutta method (Dormand and Prince, 1980) with Hairer's continuous output (Hairer, Nørsett and Wanner), which also locates events inside a step. For long flights in magnetic fields the relativistic Boris method (Boris, 1970), with the exact rotation angle (Zenitani and Umeda, 2018), conserves speed in a pure magnetic field to rounding error (Qin and coworkers, 2013). With the exact rotation angle the drift in crossed electric and magnetic fields comes out too slow by about θ²/12 (θ the rotation angle per step; θ²/12 = 2×10−4 at 128 steps per turn), so the automatic choice uses Boris only when there is no electric field; with both fields it keeps the adaptive Runge–Kutta method, which is slower for long flights but follows the drift to the set tolerance. Steps never cross a magnetic field edge or a corner of a voltage pulse.

Electrode hits are found by testing straight sub-chords of every step against the exact geometry wherever the step comes near an electrode, then bisecting to 10−9 mm. Recording planes are located by root finding on the continuous output, and the events of a step are processed in time order. Magnetic fields come from uniform fields, hard-edged field regions, circular current loops (complete elliptic integrals, after Simpson and coworkers, 2001, and Abramowitz and Stegun §17.6) and pole pieces (a magnetic scalar potential solved like the electric one; Jackson §5.9).

Random starting conditions come from a counter-based generator: particle number i of a source always gets the same numbers, so a run gives identical results however it is split among the browser's worker threads.

Physics plug-ins

The Domain tab's Physics card switches on three effects that are off by default; a project without them runs exactly as before.

  • Space charge (onset estimator). With Space charge on, every particle of a run is traced together on one worker, and the Coulomb forces between the particles (direct summation with Plummer softening ε, each traced particle standing for charge factor real ones) are added to the solved field. This estimates the onset of space-charge effects (Reiser, ch. 4; Aarseth for the direct summation); it is not a self-consistent solution: the particles do not change the electrode charges, and near a space-charge-limited emitter the result is an order of magnitude only. The pair forces are electrostatic only: the magnetic attraction between co-moving particles, which cancels a fraction β² of their repulsion, is left out, so the transverse space charge of a beam is overestimated by γ² (about 12 % for 30 keV electrons, 43 % at 100 keV). A warning appears when the time-averaged mean β² of the particles exceeds 0.01 (electrons above about 2.6 keV). At most 2,000 particles can be traced this way, and the cost grows with the square of their number. Recording planes (with their limits), time markers and stored trajectories work as in ordinary runs. Live previews trace a subset with the charge factor scaled to keep the total charge; the Lens tab and the image finder trace their rays without the pair forces. The accuracy check traces the first particles of every source, each carrying its source's whole charge, and compares with a run whose lockstep steps are shortened to 1/√10 (this integrator has no tolerance setting). Because the particles move in lockstep with fixed fourth-order Runge–Kutta steps, the energy error of a space-charge run is larger than that of an ordinary run, and the energy flag (10−6 of the energy scale) often marks particles that cross strong fields; the accuracy check shows whether shorter steps change the result. For a beam, choose the softening at about a tenth of the mean particle spacing (πR²L/N)1/3 of N traced particles in a bunch of radius R and length L, well below the beam radius, and halve it to check that the result does not change: in the beam-spread check (I2) a tenth of the spacing reproduces the laminar envelope within 0.3 %, a fifth comes out about 3 % low, and a softening equal to the spacing loses two thirds of the spread. For a few-body problem choose it far below the separation (the two-proton gate uses 10−7 mm).
  • Background gas (hard spheres). Elastic collisions with a Maxwell–Boltzmann gas of pressure p (Pa), temperature, molecular mass and diameter. When the ion diameter is not given it is estimated from the ion's mass as a sphere of density 1 g/cm³; cross-sections are the main uncertainty, 30 % or more. The collision rate is nσ⟨g⟩ with σ = π((dion + dgas)/2)²; the partner's velocity is drawn weighted by the relative speed, and the scattering is isotropic in the center-of-mass frame (Chapman and Cowling; Bird). The card also shows the low-field mobility of these rigid spheres in the first Chapman–Enskog approximation, K = (3e/16n)√(2π/(μkT))/(πd²) (Mason and McDaniel), and the drag time constant that follows from it. That approximation is exact for ions much heavier than the gas; for ions much lighter than the gas the hard-sphere collisions give up to 32/(9π) ≈ 1.13 times more (the Lorentz limit). Free paths are exactly exponential (each particle carries a collision budget) and steps are capped at a tenth of the mean free time. Energy diagnostics are off, magnetic runs use Dormand–Prince instead of Boris, and results stay independent of the workers and of how a run is split (one counter-based random stream per particle).
  • Drag. Stokes drag a = −(v − vgas)/τ with τ = Km/|q| from the mobility K in cm²/(V·s); qualitative. The card computes K from the reduced mobility, K = K0 (760 Torr/p)(T/273.15 K) (Mason and McDaniel).

Analysis

Lens properties follow DiChio, Natali and Kuyatt (1974): rays parallel to the axis are traced through the lens in both directions, the focal points and principal planes are found from their straight asymptotes, and the values are fitted in the ray height and extrapolated to the axis. Arrival-time peaks give the resolving power t/(2 FWHM); because a peak with a steep edge (common after an ion mirror) has no stable half-maximum width, the TOF tab also gives t/(2 × 2.3548 σ) from the rms width, the robust value that Scan & tune uses, and the narrowest interval holding 76.1% of the arrivals. The FWHM comes from a smoothed histogram and is marked unreliable unless its half-maximum width spans at least four bins and, over a bootstrap of 50 resamples of the arrivals, neither follows the bin width nor varies by more than 30%; a peak with a steep edge is never marked reliable. A reliable but sharply peaked (cusp-shaped) distribution is noted in the table, because its FWHM is biased high by up to about a quarter, so its resolving power reads low and the rms-based and 76% values are the ones to compare. Detector images give rms spot sizes, waists (found per species, so a mass spectrometer reports the image of each species rather than the crossing point of their lines; when the species land in separate spots, as in a mass spectrometer, no single waist is reported and the Summary lists the image of each species) and emittances. Equipotential lines are traced with marching squares, the two-dimensional form of Lorensen and Cline's method; the potential maps use a perceptually uniform map in the style of viridis (van der Walt and Smith, 2015), the color-vision-deficiency-friendly cividis map (Nuñez, Anderton and Renslow, 2018) and a blue-white-red diverging map after Moreland (2009).

Charges & multipoles. This tab applies Gauss's law on a contour drawn midway between each electrode and its neighbors to give the charge on every electrode and, from the per-electrode unit solutions, the capacitance matrix; the potential of an isolated (floating) conductor follows from C·V = Q. With a space-charge density, the charge it induces on each electrode follows from Green's reciprocity, Qρ,i = −∫ρφi dV with the electrode's unit solution φi (Jackson §1.13); it is added to C·V, a floating conductor then satisfies C·V = Q − Qρ, and the conductors together carry minus the space charge. The charges of one field add up to zero (or to minus the space charge) by construction of the contours, so that sum checks nothing; the reciprocity Cij = Cji of the computed matrix does measure the discretization error. The same unit solutions are the weighting potentials of Shockley (1938) and Ramo (1939): the charge a flying particle induces on an electrode is −q times the weighting potential at the particle, and the induced current is q times its velocity along the weighting field, so a run with time markers gives the induced current and its spectrum. The spectrum uses a Hann window, and its strongest peak is located between bins from the window's own response (Harris, 1978), which is exact for a single clean tone. On an anti-mirror model the unit solutions are odd-mode solutions (an electrode at +1 V with its image at −1 V), which are neither columns of the capacitance matrix nor weighting potentials of the full device, so the tab offers only the multipoles there; model the full domain for charges, capacitance and induced signals. The potential on a circle or a sphere is expanded in multipole coefficients (a Fourier series, or Legendre polynomials in cylindrical symmetry, sampled at Gauss–Legendre nodes from the eigenvalue method of Golub and Welsch, 1969), the usual way to quantify how far round rods or truncated electrodes depart from the ideal field (Griffiths, ch. 2–3; Jackson §1.11 and §3.3).

Compare. Pin current run keeps a copy of the project and the metrics of its run (up to eight). Pinned trajectories are drawn as dashed ghosts on the canvas with a numbered tick at each waist, but only on the geometry they were pinned from (the tab notes the pins that belong to another geometry; on a phone the pinned-runs card of the More sheet can hide the ghosts or unpin all), and the table lists the pinned runs side by side (transmission, waist position and rms radius, spot rms, mean time of flight, width and resolving power per plane, energy error) with a CSV export. Pins stay in this browser; after a reload each run is regenerated from its stored project and random seed, and the tab says if the regenerated values differ from those stored when the run was pinned.

Validation

The Benchmarks tab runs a suite of test cases in this browser and compares each result with a published value or an exact formula. There are 56 gates (all must pass before the beta can be released), 6 informational comparisons with published tables whose geometry is not fully known or with estimates that hold only within a band, and 2 planned cases for features still to come. Every case builds its own setup and runs through the same code as your projects. Run quick takes a few seconds on a desktop computer; Run full uses finer grids and takes longer. Each row shows the reference with its source, the computed value, the deviation, the tolerance and the typical deviation found when the tolerances were calibrated; Open setup loads the case as a project.

Every tolerance except the printed-digits ones is at least twice the deviation measured in calibration runs; digits checks compare with the value as printed, so their margin can be smaller, and where an exact value is available they also compare with it at a tight tolerance. Where a tolerance is written as two numbers, the first applies to the quick level and the second to the full level. "Digits" means agreement to half a unit in the last digit printed by the source.

IDCheckReferenceTolerance
K: particle kinematics in known fields
K1Transit through a uniform field, from rest and at 10 eVExact: 0.455286 µs, 43.9284 mm/µs; 0.412028 µsdigits
K21 m drift at 1000 eV for four massesExact: 2.28532, 12.04574, 22.7643, 71.98705 µsdigits
K3Gyration radius and frequency: ion, electron, relativistic electron; Boris at 128 steps per turnExact (CODATA 2022)digits; Boris 2.5×10−4
K3dIon cyclotron resonance cell: cyclotron frequency and radius at 3 T and 6 Tf = qB/(2πm) (CODATA 2022): 23.0341763 kHzrelative 10−9
K4Sense of gyration for an ion and an electron, both integratorsLorentz forceexact sign
K5180° focusing in a uniform magnetic field180.000°±0.005°
K6Imaging by hard-edged 90° and 60° magnetic sectorsBarber's rule: 100.000, 173.205 mmrelative 3×10−6
K6bSector imaging at r = 25 mm, object 25 mm before the edgeLiebl (2008), eqs. 3.7–3.8; Barber's rulerelative 2×10−4; 10−3°
K7Ions in a uniform RF fieldExact positions at 0.5 µsdigits
K8Voltage pulse with sharp cornersExact integralrelative 10−9
K9Electron with kinetic energy equal to its rest energy in 0.1 Tγ = 2, β = 0.866025, r = 29.523 mmdigits
S: the field solver
S1Coaxial cylinders: potential and fieldLogarithmic potential (exact)3×10−3 / 10−3 V
S2Concentric spheres: potential and fieldA + B/r (exact)0.04 / 0.01 V
S3Axial potential of two tubes with no gapNatali, Di Chio and Kuyatt (1972), Table 21.5×10−4 / 4×10−5
S4Axial potential of two tubes with a 0.1 D deep gapNatali, Di Chio and Kuyatt (1972)2×10−4
S5Order of convergence, einzel lens2 (second-order scheme)1.8 to 2.3
S6Quadratic harmonic potentials reproduced exactly with curved boundariesExact10−9
S7Superposition of basis fields equals a direct solveLinearity10−9 of the largest voltage
S8Multigrid, Krylov and over-relaxation solvers agreeEach other10−9 V/V
S9Thin plates on coarse multigrid levelsConvergence rate, agreement with over-relaxation≤ 0.35 per cycle; 10−9
S10Order of convergence on spheres (exact boundaries)21.8 to 2.3
S11Tilted plates: sub-grid boundaries reproduce a linear potentialExact (the staircase error is shown for information)10−9 V
S12Mesh sweep of the einzel waist: observed order and Richardson extrapolationPress and coworkers, Numerical Recipesorder 1.2 to 2.5; bracket
S13Poisson term: charged sphere in a grounded sphere; sinusoidal charge in a boxGriffiths §2.3, §3.3 (exact)2×10−3 / 4×10−4 of φ(0); |E| 3×10−3 / 10−3
T: trajectories in solved fields
T1Parallel-plate mirror behind a mesh: return points and depthExact: 34.641, 40.000, 34.641; 10.000 mmdigits
T2Energy gained through an exit mesh500 eVrelative 10−6
T3Space focus of a single-field sourceWiley and McLaren (1955)10−6
T4Energy focus of an ion mirrorMamyrin and coworkers (1973)10−6
T5Energy conservation through an einzel lens02×10−6
T6Time reversal through the same lensThe starting point10−6 of the radius
T7127° cylindrical analyzer: focusing angle and constant radiusHughes and Rojansky (1929): 127.279°±5×10−4° / ±3×10−4°
T8180° spherical analyzerPurcell (1938): 180°±0.03° / ±0.008°
T8bKepler orbits of electrons in the spherical capacitor, r0 82 to 118 mm; relativistic shiftZouros and coworkers (2007); exact8×10−3 / 2×10−3 mm (orbits nearest the electrodes, 82 and 118 mm: 10−2 / 2.5×10−3)
T9Secular frequency in a solved quadrupoleFloquet theory of Mathieu's equationrelative 10−5
T10Edge of the stability region in a solved quadrupoleMathieu stability diagramstable and unstable as predicted
T11Apex of the stability region and mass-filter voltages (ideal quadrupole)Paul (1990)as predicted; digits
T12Low-mass cut-off of a solved Paul trapPaul (1990): 107.7 um/z 120 trapped, 100 lost
T13Helmholtz pair and single current loop0.899176 mT; 4.49588 µTdigits
T14Results independent of how a run is splitIdenticalbit for bit
T15Hits on tilted, thin and zero-thickness electrodesExact intersections10−8 mm; no misses
T16Spherical test surface: 50 rays reach r = 10.5 mm at 5.25 µsExactrelative 10−9
T17Round-rod quadrupole: multipole coefficients and the stability edgeDayton, Shoemaker and Mozley (1954); Denison (1971); a2 = 1.0028664 and 1.0029450 from an independent charge-simulation solve; DLMF §28.17a2 ±10−4; |a6/a2| ≤ 3×10−3; bracket
T18Paul trap: pseudopotential well depth (adiabatic ion, qz 0.33 and 0.815)Dehmelt (1967); March (1997)brackets
T19Induced charge and current of a circling electronShockley (1938); Ramo (1939); CODATA 2022relative 10−9 (charge), 10−8 (current)
T20Orbits in a logarithmic field: circular at 10 and 15 mm, apsides of a bound orbitKingdon (1923); exact1.5×10−3 / 4×10−4 mm
L: electrostatic lenses
L1Two-tube lens with no gap, four voltage ratiosExact paraxial properties (Bessel series)relative 10−3 / 3×10−4
L2Einzel lens with no gaps, five voltage ratiosExact paraxial propertiesrelative 6×10−4 / 2×10−4
L3Two-tube lens with a 0.1 D deep gap, ratios 2 to 100DiChio, Natali and Kuyatt (1974), Table I0.35 % or 0.003 D
L4Lagrange–Helmholtz relation on the same rays01.2×10−4 / 2.5×10−5 (ratio 100: 1.5×10−4)
L5 infoEinzel lensAdams and Read (1972)band ±2 %
L6 infoTwo-aperture lensHarting and Read (1976)model runs 3.5 to 7 % above (reproduced by an independent solver)
L7Aperture of radius 1 mm between a field-free region and a uniform field81.62 mm from the exact potential of the hole (Jackson §3.13); Davisson and Calbick (1932): f = 4V/(E2 − E1) = 80 mm to first orderrelative 2×10−3
L8Newton's rule and spherical aberration of the two-tube lensDiChio, Natali and Kuyatt (1974); Heddle (2000)2×10−4 (paraxial), 2×10−3 (0.01 D)
L9Weak-lens formula for the einzel lens at V2/V1 = 1.05 and 1.10Weak-lens integral on the Bessel-series potential (Natali, Di Chio and Kuyatt, 1972)2.5 % / 3.5 %; 1.5×10−3 / 2×10−3 (solved potential)
D: drag and gas
D1Mobility drag: terminal velocity, relaxation distance, moving gasMason and McDaniel (1988)relative 10−6
D2Ion-mobility drift cell: K from K0, damping constant, drift velocityMason and McDaniel (1988); K0 = 4.31 cm²/(V·s) assumed (attributed to Gillig and coworkers, 2000; to be confirmed)digits; relative 10−6
I: devices and estimators
I1 infoOctupole ion guide with round rodsGerlich (1992)band ±1 %; A4 ±2 %
I2 infoSpace-charge beam spread of a converging electron beam (onset estimator)Laminar envelope equation (Reiser, §4.2): 1.275 mmband 1.28 mm ±25 %
I3 infoLegendre multipoles of the hyperbolic trapBarlow, Taylor and Swanson (2001)band ±0.3 % (c2)
I4 infoHard-sphere mean free path of 24 eV ions in heliumKinetic theory of rigid spheres (Chapman and Cowling): 3.14 mm5 %
P: planned and promoted
P1Space-charge-limited current (Child–Langmuir)Needs a self-consistent space-charge solverplanned
P2Two protons released 1 µm apart (space charge)Exact: 0.719982 meV each (CODATA 2022)digits; relative 10−6
P3Coaxial cylinders and spheres in three dimensionsNeeds the 3D solverplanned
P4Capacitance from the field flux: coax 80.2607 pF/m, spheres 26.7036 pFExact (CODATA 2022 ε0)relative 10−4

The presets carry their own expectations (for example the waist of the Einzel lens, the dispersion of the analyzers, the transmitted masses of the quadrupole filter), which the developer's test suite checks on every change.

Presets

Einzel lens
Three tubes focus a parallel beam; the waist lies before the near-axis focus because of spherical aberration.
Two-tube immersion lens
The deep-gap geometry of the NBS lens studies; the Lens tab reproduces the published focal properties.
Two-aperture lens
Two thin apertures focus while they accelerate the beam tenfold.
Parallel-plate mirror
A uniform retarding field behind a mesh; return points and depth match closed forms.
127° cylindrical deflector
A cylindrical energy filter: rays leaving a point refocus after 127°; the exit slit selects the pass energy.
Hemispherical analyzer
Electrons of 99, 100 and 101 eV land about 2 mm apart after a 180° turn.
Reflectron TOF
A gridded ion mirror compensates the energy spread of a single-field source and separates m/z 100 from 101.
RF quadrupole mass filter
Hyperbolic rods with RF and DC voltages pass m/z 100 and reject 90 and 110.
Paul trap
A ring and end caps with RF trap ions above the low-mass cut-off.
90° magnetic sector
A sector magnet focuses a fan of ions and separates neighboring masses by 1 mm.
Velocity-map imaging lens
Three plates in the style of Eppink and Parker (1997) image equal velocities to equal points; the dimensions are generic, not those of the paper.

Keyboard shortcuts

Shortcuts work when the keyboard focus is not in a text field; ? in the simulator shows the same list. Every canvas action also has a form in the inspector or the tabs.

S
Solve the fields
R
Run all particles
L
Live preview on or off
Esc
Cancel the current drawing, or stop a solve, a run or a live preview
V
Select and edit tool
H
Pan tool (or hold Space, or drag with the middle button)
B
Box tool
T
Tube tool
C
Circle tool
P
Polygon tool (Enter or double-click closes)
M
Measure tool
Shift+P
Probe line for the Profile tab
Delete or Backspace
Delete the selection (or the grabbed polygon vertex)
Ctrl+Z
Undo
Ctrl+Y or Ctrl+Shift+Z
Redo
Ctrl+D
Duplicate the selection
Arrows
Move the selection one cell (Shift ×10, Alt ×0.1)
[ and ]
Move the selected shape earlier or later in the painting order
0
Fit the domain in view
+ and −
Zoom in and out
Ctrl+S
Save the project to a file
?
Show this list

Limitations

  • Two dimensions. Geometries are planar (infinitely long along z) or cylindrically symmetric. Three-dimensional grids are planned.
  • Quasistatic fields. The field follows the electrode voltages instantly, which is accurate when the device is much smaller than the wavelength; the simulator warns when 2πf L/c exceeds 0.05 for the domain length L.
  • Space charge is an onset estimate. A charge density can be added to the field solve, and the particles' mutual forces can be traced directly (up to 2,000 particles), but the particles never change the field: there is no self-consistent (particle-in-cell) solution, so space-charge-limited emission and intense beams are not modeled. The pair forces are electrostatic only, which overestimates the transverse space charge of fast beams by γ²; a warning appears when the mean β² exceeds 0.01.
  • Sharp magnetic edges. Hard-edged magnetic field regions end abruptly, without fringe fields; pole pieces give fringe fields but treat the iron as infinitely permeable (no saturation). Current loops are exact.
  • Gas collisions are elastic hard-sphere collisions with estimated cross-sections; charge exchange, fragmentation and inelastic losses are not modeled.
  • Field-free drift outside the grid. Beyond the solved region the electric field is taken as zero.
  • Ideal surfaces. Electrodes absorb the particles that hit them (no secondary electrons, reflection or charging). A mesh is an ideal equipotential sheet with a transmission probability; the small lenses formed by real mesh holes are not modeled.
  • Phones open a viewer mode with smaller limits (grids up to 400,000 nodes and 20,000 particles); geometry editing needs a larger screen. On desktops grids up to 4 million nodes and a million particles per run are allowed, with a confirmation above about 5 seconds of computing.

Privacy

Everything runs in your browser; no project, result or file is uploaded. Your current project and the ten most recent ones are kept in this browser's local storage. A share link carries the whole project after the # in the address, a part that browsers do not send to the server; anyone with the link can open a copy. An optional cache of solved fields (off by default) uses the browser's own database and can be cleared at any time.

About this beta

Independent software written from the open literature. Not affiliated with any commercial ion-optics package.

This is an unlisted beta: it is not linked from the rest of the site and not indexed by search engines. Simulation engine version 0.2.2.

References

Numerical methods

  • G. H. Shortley and R. Weller, “The numerical solution of Laplace's equation,” J. Appl. Phys. 9, 334–348 (1938). doi:10.1063/1.1710426
  • B. A. Carré, “The determination of the optimum accelerating factor for successive over-relaxation,” Comput. J. 4, 73–78 (1961). doi:10.1093/comjnl/4.1.73
  • L. A. Hageman and D. M. Young, Applied Iterative Methods (Academic Press, 1981).
  • W. L. Briggs, V. E. Henson and S. F. McCormick, A Multigrid Tutorial, 2nd ed. (SIAM, 2000).
  • U. Trottenberg, C. W. Oosterlee and A. Schüller, Multigrid (Academic Press, 2001).
  • H. A. van der Vorst, “Bi-CGSTAB: a fast and smoothly converging variant of Bi-CG for the solution of nonsymmetric linear systems,” SIAM J. Sci. Stat. Comput. 13, 631–644 (1992). doi:10.1137/0913035
  • J. R. Dormand and P. J. Prince, “A family of embedded Runge–Kutta formulae,” J. Comput. Appl. Math. 6, 19–26 (1980). doi:10.1016/0771-050X(80)90013-3
  • E. Hairer, S. P. Nørsett and G. Wanner, Solving Ordinary Differential Equations I: Nonstiff Problems, 2nd ed. (Springer, 1993).
  • J. P. Boris, “Relativistic plasma simulation: optimization of a hybrid code,” Proc. Fourth Conf. Numerical Simulation of Plasmas (Naval Research Laboratory, Washington, 1970).
  • H. Qin, S. Zhang, J. Xiao, J. Liu, Y. Sun and W. M. Tang, “Why is Boris algorithm so good?,” Phys. Plasmas 20, 084503 (2013). doi:10.1063/1.4818428
  • S. Zenitani and T. Umeda, “On the Boris solver in particle-in-cell simulation,” Phys. Plasmas 25, 112110 (2018). doi:10.1063/1.5051077
  • M. Abramowitz and I. A. Stegun (eds.), Handbook of Mathematical Functions (National Bureau of Standards, 1964), §17.6.
  • G. H. Golub and J. H. Welsch, “Calculation of Gauss quadrature rules,” Math. Comp. 23, 221–230 (1969). doi:10.1090/S0025-5718-69-99647-1
  • F. J. Harris, “On the use of windows for harmonic analysis with the discrete Fourier transform,” Proc. IEEE 66, 51–83 (1978). doi:10.1109/PROC.1978.10837
  • J. C. Simpson, J. E. Lane, C. D. Immer, R. C. Youngquist and T. Steinrock, “Simple analytic expressions for the magnetic field of a circular current loop,” NASA Technical Reports Server 20010038494 (2001). ntrs.nasa.gov/citations/20010038494
  • W. E. Lorensen and H. E. Cline, “Marching cubes: a high resolution 3D surface construction algorithm,” Comput. Graph. 21, 163–169 (1987). doi:10.1145/37402.37422
  • J. R. Nuñez, C. R. Anderton and R. S. Renslow, “Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data,” PLoS ONE 13, e0199239 (2018), CC BY 4.0. doi:10.1371/journal.pone.0199239
  • K. Moreland, “Diverging color maps for scientific visualization,” in Advances in Visual Computing, Lecture Notes in Computer Science 5876, 92–103 (Springer, 2009). doi:10.1007/978-3-642-10520-3_9
  • S. van der Walt and N. Smith, “mpl colormaps”: the viridis colormap and its relatives, designed for Matplotlib and presented at SciPy 2015 (CC0). bids.github.io/colormap
  • W. H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery, Numerical Recipes, 3rd ed. (Cambridge University Press, 2007).
  • Constants: CODATA 2022 recommended values, NIST. physics.nist.gov/cuu/Constants

Fields, charges and induced currents

  • D. J. Griffiths, Introduction to Electrodynamics, 4th ed. (Pearson, 2013), ch. 2–3.
  • J. D. Jackson, Classical Electrodynamics, 3rd ed. (Wiley, 1999), §1.11, §1.13, §3.3 and §5.9.
  • W. Shockley, “Currents to conductors induced by a moving point charge,” J. Appl. Phys. 9, 635–636 (1938). doi:10.1063/1.1710367
  • S. Ramo, “Currents induced by electron motion,” Proc. IRE 27, 584–585 (1939). doi:10.1109/JRPROC.1939.228757

Space charge, gases and mobility

  • M. Reiser, Theory and Design of Charged Particle Beams, 2nd ed. (Wiley-VCH, 2008), ch. 4.
  • S. J. Aarseth, Gravitational N-Body Simulations (Cambridge University Press, 2003).
  • S. Chapman and T. G. Cowling, The Mathematical Theory of Non-uniform Gases, 3rd ed. (Cambridge University Press, 1970).
  • G. A. Bird, Molecular Gas Dynamics and the Direct Simulation of Gas Flows (Clarendon Press, 1994).
  • E. A. Mason and E. W. McDaniel, Transport Properties of Ions in Gases (Wiley, 1988).
  • K. J. Gillig, B. Ruotolo, E. G. Stone, D. H. Russell, K. Fuhrer, M. Gonin and A. J. Schultz, “Coupling high-pressure MALDI with ion mobility/orthogonal time-of-flight mass spectrometry,” Anal. Chem. 72, 3965–3971 (2000). doi:10.1021/ac0005619

Lenses and devices

  • S. Natali, D. Di Chio and C. E. Kuyatt, “Accurate calculations of properties of the two-tube electrostatic lens. I. Improved digital methods for the precise calculation of electric fields and trajectories,” J. Res. Natl. Bur. Stand. 76A, 27–35 (1972). doi:10.6028/jres.076A.003
  • D. DiChio, S. V. Natali and C. E. Kuyatt, “Focal properties of the two-tube electrostatic lens for large and near-unity voltage ratios,” Rev. Sci. Instrum. 45, 559–565 (1974). doi:10.1063/1.1686684
  • F. H. Read, A. Adams and J. R. Soto-Montiel, “Electrostatic cylinder lenses. I. Two element lenses,” J. Phys. E 4, 625–632 (1971). doi:10.1088/0022-3735/4/9/001
  • A. Adams and F. H. Read, “Electrostatic cylinder lenses II: three element einzel lenses,” J. Phys. E 5, 150–155 (1972). doi:10.1088/0022-3735/5/2/019
  • E. Harting and F. H. Read, Electrostatic Lenses (Elsevier, 1976).
  • C. J. Davisson and C. J. Calbick, “Electron lenses,” Phys. Rev. 42, 580 (1932). doi:10.1103/PhysRev.42.580
  • A. Ll. Hughes and V. Rojansky, “On the analysis of electronic velocities by electrostatic means,” Phys. Rev. 34, 284–290 (1929). doi:10.1103/PhysRev.34.284
  • E. M. Purcell, “The focusing of charged particles by a spherical condenser,” Phys. Rev. 54, 818–826 (1938). doi:10.1103/PhysRev.54.818
  • H. Wollnik, Optics of Charged Particles (Academic Press, 1987).
  • C. E. Kuyatt and J. A. Simpson, “Electron monochromator design,” Rev. Sci. Instrum. 38, 103–111 (1967). doi:10.1063/1.1720492
  • W. C. Wiley and I. H. McLaren, “Time-of-flight mass spectrometer with improved resolution,” Rev. Sci. Instrum. 26, 1150–1157 (1955). doi:10.1063/1.1715212
  • B. A. Mamyrin, V. I. Karataev, D. V. Shmikk and V. A. Zagulin, “The mass-reflectron, a new nonmagnetic time-of-flight mass spectrometer with high resolution,” Sov. Phys. JETP 37, 45 (1973). jetp.ras.ru
  • W. Paul, “Electromagnetic traps for charged and neutral particles,” Rev. Mod. Phys. 62, 531–540 (1990). doi:10.1103/RevModPhys.62.531
  • N. W. McLachlan, Theory and Application of Mathieu Functions (Clarendon Press, 1947).
  • P. H. Dawson (ed.), Quadrupole Mass Spectrometry and Its Applications (Elsevier, 1976).
  • H. Liebl, Applied Charged Particle Optics (Springer, 2008).
  • D. W. O. Heddle, Electrostatic Lens Systems, 2nd ed. (Institute of Physics Publishing, 2000).
  • T. J. M. Zouros, O. Sise, F. M. Spiegelhalder and D. J. Manura, “Investigation of the accuracy of ion optics simulations using Kepler orbits in a spherical capacitor,” Int. J. Mass Spectrom. 261, 115–133 (2007). doi:10.1016/j.ijms.2006.08.005
  • K. H. Kingdon, “A method for the neutralization of electron space charge by positive ionization at very low gas pressures,” Phys. Rev. 21, 408–418 (1923). doi:10.1103/PhysRev.21.408
  • I. E. Dayton, F. C. Shoemaker and R. F. Mozley, “The measurement of two-dimensional fields. Part II: Study of a quadrupole magnet,” Rev. Sci. Instrum. 25, 485–489 (1954). doi:10.1063/1.1771107
  • D. R. Denison, “Operating parameters of a quadrupole in a grounded cylindrical housing,” J. Vac. Sci. Technol. 8, 266–269 (1971). doi:10.1116/1.1316304
  • H. G. Dehmelt, “Radiofrequency spectroscopy of stored ions I: storage,” Adv. At. Mol. Phys. 3, 53–72 (1967). doi:10.1016/S0065-2199(08)60170-0
  • R. E. March, “An introduction to quadrupole ion trap mass spectrometry,” J. Mass Spectrom. 32, 351–369 (1997). doi:10.1002/(SICI)1096-9888(199704)32:4<351::AID-JMS512>3.0.CO;2-Y
  • S. E. Barlow, A. E. Taylor and K. Swanson, “Determination of analytic potentials from finite element computations,” Int. J. Mass Spectrom. 207, 19–29 (2001). doi:10.1016/S1387-3806(00)00452-8
  • D. Gerlich, “Inhomogeneous RF fields: a versatile tool for the study of processes with slow ions,” Adv. Chem. Phys. 82, 1–176 (1992). doi:10.1002/9780470141397.ch1
  • A. T. J. B. Eppink and D. H. Parker, “Velocity map imaging of ions and electrons using electrostatic lenses: application in photoelectron and photofragment ion imaging of molecular oxygen,” Rev. Sci. Instrum. 68, 3477–3484 (1997). doi:10.1063/1.1148310