60th example file, to illustrate the stochastic scattering option


Available for use with the stochastic version of the programs.


For a faster simulation, change the subdivision numbers '50', '500 4' and '50' to '5', '50 4' and '5' and decrease the number of trajectories from 1000 to 50.


For detailed information see 

(1) F H Read and N J Bowring, Accurate Monte-Carlo calculation of Boersch energy and angle spreading, Rev Sci Inst, 74, 2280-2287 (2003).

(2) F H Read and N J Bowring, Monte Carlo calculation of Boersch energy spreading, Nucl Instrum and Meth, accepted June 2003.

(3) Notes in sct3coul.cpp and sct3boer.cpp.


The geometry is that of xmpl3d07.  The rays start at z = -500, in a field-free region.


There are 1000 rays, all starting from a disc of effective radius 1E4 at z = -100E4, and all directed towards a pupil of radius 1.0 at z = 0.  The beam half-angle is therefore 0.01. The energy of the electrons is 10keV.


The total current in the beam is 2.675E-2mA.  Using the parameters defined by H Rose and R Spehr, Adv. in Electronics and Electron Physics, Supplement 13C, 475-530 (1983), the 'normalised current, kappa' is therefore 1.E-3.


The rays start with a random spatial distribution across the starting disc.

The 'mesh' method of ray tracing is used.  The mesh spacing and the requested trajectory inaccuracy are large because the region is almost field-free. 

The 'trajectory charge-tube' method of assigning the space-charges of the trajectories is used.


Three 'advanced' options (which were created for the present application) are used to vary:

 (1) the lengths of the trajectory steps (which are also the lengths of the space-charge tubes),

 (2) the radii of the space-charge tubes, and

 (3) the averaging radius for calculating the space-charge density.

The initial values of these three distances are defined for the total range of z, namely -500 to +500, but they all are halved in the region from z = -300 to +300, and are further halved in the region from z = -100 to +100.  These reductions approximately follow the radius of the beam and are designed to give the highest accuracy for a given computing time.


The test planes are spaced by 50.


The file scatter3.dll is automatically 'dynamically-linked' to the main program, to carry out the electron-electron scattering calculations.

scatter3.dll is compiled from scatter3.cpp, which is copied from sct3coul.cpp.

Therefore there are 2 methods of making scatter3.dll:

(1) Simply copy sct3coul.dll to scatter3.dll

(2) If you want to modify the electron-electron scattering code then copy sct3coul.cpp to scatter3.cpp, modify scatter3.cpp  and then create scatter3.dll (following the procedure described in Help).


The linked file scatter3.dll calls a data file that is named in the present data file.  In the present example it has the name sct3coul.dat.


Please see the footnotes of the data file for the contents of sct3coul.dat and for further information.