SIMION®
The field and particle trajectory simulator
Industry standard charged particle optics software
Refine your design: model > simulate > view > analyze > program > optimize it.
SIMION v8.1.3.0-TEST posted.
About | Documentation | Community/Support | Downloads | Ordering

simion.pas

SYNOPSIS

-- load array and examine all points.
local pa = simion.pas:open(
    'c:/Program Files/SIMION-8.1/examples/quad/quad.pa#')
pa:save'quad.pa#' -- save locally to a folder we have write permission to
for zi=0,pa.nz-1 do
for yi=0,pa.ny-1 do
for xi=0,pa.nx-1 do
  local potential, is_electrode = pa:point(xi,yi,zi)
  print(potential, is_electrode)
end end end

-- modify it
pa:point(38,0,0, 3,true)  -- x,y,z, potential,is_electrode

-- refine it
pa:refine()

-- fast adjust it
pa:fast_adjust{[3] = 100}

-- pa:close() -- optionally close it

DESCRIPTION

Compatibility Warning: The features in this module are only available in the SIMION 8.1.0 and above.

This module enables programmatic access and manipulation of SIMION potential arrays (PA’s). This includes creating, reading, manipulating, and refining PAs from Lua. The arrays are loaded into the memory of the SIMION process (in contrast to the earlier SL Libraries).

The list of existing arrays in memory can be accessed from the simion.pas array. For example, to print the names of all open arrays, execute this from the SIMION command bar:

for i=1,#simion.pas do print(i, simion.pas[i].filename) end

New arrays can be loaded from a file:

pa1 = simion.pas:open('quad.pa#')

or a blank array can be created in memory:

pa2 = simion.pas:open()
pa2.symmetry = '2dplanar'
pa2:size(100,100,100)

A common application is to iterate over all points to read or modify them:

-- Create a spherical electrode in the PA.
for zi=0,pa2.nz-1 do
for yi=0,pa2.ny-1 do
for xi=0,pa2.nx-1 do
  if xi^2 + yi^2 + zi^2 < 50^2 then
    pa2:point(xi,yi,zi, 1,true) -- 1V,electrode
  end
end end end

Some functions differ only in the coordinates used:

potential = pa:potential(1,3,5)
potential = pa:potential_vc(1.1,-3.2,5.9)

The first type takes non-negative integer coordinates. These represent grid points in the original array (as seen in Modify) before application of symmetry, mirroring, and interpolation between grid points.

The second type takes real number coordinates. These are also in units of grid units but represent physical coordinates (as seen in View) after application of symmetry, mirroring, and interpolation between grid points.

Further functionality is described in the below API.

Note

This page is abridged from the full SIMION 8.1.1 “Supplemental Documentation” (Help file). The following additional sections can be found in the full version of this page accessible via the “Help > Supplemental Documentation” menu in SIMION 8.1.1:
  • INTERFACE

Examples

** Mirror contents of first PA in memory (reverse in X direction).**

pa = simion.pas[1]
for x=0,math.floor((pa.nx-1)/2) do
for y=0,pa.ny-1 do
for z=0,pa.nz-1 do
  local xr = pa.nx-1-x
  local v1,e1 = pa:point(x,y,z)
  local v2,e2 = pa:point(xr,y,z)
  -- swap points
  pa:point(x ,y,z, v2,e2)
  pa:point(xr,y,z, v1,e1)
end end end

See Also

To locate the PA object for PA instance number n on a workbench, use simion.wb.instances[n].pa. See simion.wb.

Compatibility

SOURCE

(c) 2007-2012 Scientific Instrument Services, Inc. Licensed under the terms of SIMION 8.1. www.simion.com. D.Manura-2007.

Any comments on this web page? (will be sent to SIS SIMION Support)
[Optional] Your name: email: phone/fax: