Automatic iteration to focus a beam.

 

For a brief description see notes on focussing.

 

Associated notes are: 

Test planes.

Beam section.

Multiple crossing of planes.

Stepping a voltage.

Estimating phase space.

 

There are many different ways in which the size of a focus can be defined and in which it can be optimized, and so the program allows many different options. Several different forms of constraint are also available.

 

Examples of the use of this option are given in files xmpl2d07, xmpl2d15, xmpl3d06, xmpl3d12, xmpl3d18 and xmpl3d76.

 

This note deals with:

The 'focus'.

Voltage information.

Centre of the focus (including a free focus).

Choice of beam.

Number of rays.

Stopping the iteration.

Randomization issues.

Minimisation technique.

Safety numbers.

Constraints.

Controlling the amount of output information.

Iteration of the kinetic energy.

Colours of the rays.

 

The 'focus':

This is the set of crossing points at the beam section, which is the first test plane, or in the case of cathodes the secondtest plane.

The program will adjust up to 20 voltages to minimise the size of focus.

The requirements of users vary greatly, and so several different types of focus are available, as described below.

Alternatively, the voltages can be adjusted to maximise the current that falls inside a specified circle, see xmpl3d96.

The 4 options for the size of focus are:.

(1) Maximum distance of any of the rays from the centre of the focus

(2) Mean of the distances from the centre (that is, the mean of the magnitudes of the distances)

(3) Root-mean-square of the distances.

(4) Another option for the quality of the focus is:

Maximise the current that falls within a given circle.

The circle lies in the test plane and its centre and radius are specified by the user.

Absolute values of the current are used.

Discontinuities in the maximisation routine can easily occur -for example when a small change in a voltage causes a ray to jump from being just inside the circle to being just outside.  To avoid this a second larger radius can be specified and the program uses a linearly graded weighting for rays that lie between the two radii.  Rays that lie outside the second radius are of course given a zero weighting.

 

Voltage information:

The user is asked to specify the number N (maximum 20) of voltages that are to be adjusted, and for each one has to specify the number of the voltage (not its starting value) and the approximate amount by which it should be varied (but this should not be made too large).

The scale factor of the magnetic field (if it exists) can be included for variation. It is treated as a ‘quasi-voltage’ that has the voltage number nvolts+1 where nvolts is the total number of real voltages -see xmpl3d76.

If the voltages are related to each other then the variable voltages must all be ‘source voltages’.

 

Centre of the focus (including a free focus):

There is a choice of 4 options:

(1) The coordinates of the centre of a fixed focus can be specified.

(2) The single ‘free’ focus centre can be requested (and of course there is then no need to specify any coordinates).

The program will put the focus point somewhere on the first test plane, to give the smallest focal spot. This is a powerful option that can be used, for example, to minimise the size of an off-axis image when the magnification of a lens is not known.

Be careful when using the free centre option in the presence of planes of reflection symmetry. In 2D cylindrical symmetry the free focus can be off-axis -that is, it can be a ring (but then the reflection of the rays in the radial direction should be disabled).

(3) More than one fixed focus can be specified (eg each representing rays of different energies). Each focus corresponds to a different set of rays. An example is given in xmpl3d18. All the foci must lie on the first test plane.

(4) More than one free focus can be specified (eg each representing rays of different energies). Each focus corresponds to a different set of rays. All the focal points will lie on the first test plane. This is a very powerful option that can be used, for example, to minimise the sizes of a series of focal spots at the exit of an energy analyser for a series of different input energies.


Choice of beam:

The choice of the type of beam can be important because many choices result in the rays being distributed as a set of rings.  For example, to avoid this the choice of beam used in xmpl2d07 and xmpl3d06 is the 'cylidrical beam' option with 'completely  random disc and pupil', which gives a point source with rays radiating in random directions.  In the 'randomization parameters' box the 'same' option is selected, as advised in the 'randomization' paragraph below. 

  

Number of rays to be included in the minimization:

Some rays might fail to cross the test plane, for various reasons, and so it is necessary to specify the total number of rays that will be considered. For example, there might be 10 rays being traced, and you might specify that only 8 of these are to be considered. This therefore allows 2 to be disregarded. But what happens if more than 8 cross the test plane? If the centre of the focus has been specified, then the BEST 8 are considered (that is, best in terms of the distance from the specified centre). But if the centre of focus has not been specified, the FIRST 8 to cross the test plane are considered (and this set is then used to define the centre of focus).

  

Stopping the iteration:

One way to control when the iteration should stop is for the user to specify an acceptable value, called the 'tolerance level', of the fractional change in the quantity being minimised at each iteration.  Another way is to specify the maximum number of iterations. 

If the routine reaches the maximum number of iterations before it reaches the tolerance level, then the previous best set of voltages is saved.

If the maximum number of iterations. is entered as 0 then only the original voltages will be used to find the size of the focus.


Randomization issues:

There are several ways of specifying the initial beam, some of which use randomization.  It is important to use a type of randomization that gives the same set of initial conditions for the rays at each iteration, otherwise the minimization technique cannot work well.  So the option chosen should be 'same' or 'fixed seed value'.  It might not be possible to do this if the simulation involves other randomizations, as in space-charge simulations.

 

 Minimization technique:

The simplex technique is chosen for the minimization process because we have found it to be the most dependable for simulations in charged particle optics.

If the approximate position of the minimum is known in advance, then start from this position and make the initial step sizes of the voltages small (the simplex routine will automatically make them larger if necessary).

Note that the simplex technique is efficient at finding a minimum that is in the region of the initial variables, but if there is a deeper minimum that is further away the simplex technique might fail to find it. So if you suspect that there a local minimum has been mistaken for the true minimum, then use larger initial step sizes and a series of different starting positions, always keeping a careful record of the values of the minimum 'focus size' obtained.

If the number of variables is larger than about 4 then try to split them into 2 or more groups. Vary each group separately and iterate between the groups. For example if there are 5 variables, 2 of which are concerned primarily with one aspect and the other 3 with a different aspect, then vary numbers 1 and 2, then 3, 4 and 5, then go back to 1 and 2, etc).

It also helps sometimes to restart the minimization a few times, using the most recently optimised parameters each time.

 

Safety numbers:

The user is asked to specify two numbers, a 'maximum distance' and a 'penalty factor', to prevent answers being distorted by rays that are very much out-of-focus. If you do not want to use this facility simply make the 'maximum distance' very large and make the 'penalty factor' 1.0.

If you do want to use the facility then the 'maximum distance' would usually be the radius of an aperture or screen. The minimization technique would run into difficulties if such rays are completely excluded as soon the maximum distance is reached, and so a 'penalty factor' is applied instead. The penalty is graded. For any ray that has a distance d from the centre that is in the range m_d to 5*m_d, where m_d is the maximum distance, d is multiplied by the penalty factor p_f. For d > m_d, the penalised distance is 5*m_d*p_f.

  

Constraints:

Two kinds of constraint are available, for voltages and angles respectively.

The user specifies the number of voltage constraints (in the range 0 to 7) and the number of angle constraints (0 or 1).

(1) Voltage constraints:

Without this type of constraint the voltages might change so much that too many rays fail to reach the focus, causing the iterations to stop.

For each voltage constraint the user states whether it is 'lower' or 'upper' -that is, whether the voltage is to be inhibited from going below or above some limit. The user then specifies the number of the voltage and the limit to its value. Finally the user specifies a 'penalty factor', which gives the user some extra control, and which should be given the value 1 if this control is not needed. The penalty factor has the dimensions 'mm per volt'. If the numbered voltage goes outside the specified limit, the excess is multiplied by the penalty factor, and this quantity is added in the minimization routine to the distance of the ray from the centre of the focus.

A given voltage can be specified more than once, if the user wants to impose increasing levels of constraint on the voltage.

(2) Angle constraints:

An angle constraint is defined by 4 or 5 numbers in CPO2D or CPO3D respectively. The first 2 or 3 of these are the direction cosines (or numbers proportional to them) of the required central direction of the beam at the focus (also see below). The next is a conversion factor 'f' that has the dimension 'mm per radian'. Then comes the limit 'l' in the angle 'u' between the defined direction and the direction of a ray.

The program deals with the angle constraint in the following way. For each ray the angle difference u is calculated. If u is greater than l then the excess (du = u - l) is multiplied by the conversion factor f to convert it to a distance (before June 2007 du was not allowed to be greater than 5l). Finally this distance is added in the minimization routine to the distance of the ray from the centre of the focus.

Further note on angle constraints: In CPO3D the three ‘direction cosines’ represent x/r, y/r and z/r, where r = sqrt(x*x + y*y + z*z), x = xf - xi etc and the specified direction is that of the vector from (xi,yi,zi) to (xf,yf,zf). These ‘direction cosines’ are therefore signed quantities.

These angle constraints are useful for making a beam as parallel as possible -by using a large value of the conversion factor 'f'.

 

 Controlling the amount of output information:

When the number of iterations is large the user might want to severely limit the information given in the information box on the screen and in the output data file. To limit this information to the barest minimum, the values of the variable voltages and the size of the focus, put the letter 'z' (for 'zero') for the printing level (see note on printing levels).

 

Including kinetic energy in the iteration:

If the kinetic energy of a particle needs to be one of the adjustable parameters, use a total energy and adjust the voltage of an electrode near the ray starting position.


Colours of the rays:

During an iterative calculation the previous rays are redrawn (for comparison) in green (colour number 2), so this colour should be avoided for the new rays.  These colours can be changed by using the 'palette'.

(The green rays are redrawn without using the interpolation points.)