Setting up a photocathode
In xmpl3d45 a thermionic cathode is used but the electrons are given the constant energy 0.5eV and a lambertian spread of directions by entering the thermal energy as -0.5eV.
Here are some recommended precautions, taken from the footnotes of the above file:
(1) The photocathode should be divided into the largest practical large number of segments.
(2) The direct method of ray tracing should be used (because with the mesh method the mesh points might extend behind the cathode, giving rise to inaccurate interpolated fields near the cathode).
(3) The initial step length should be small.
(4) The ray tracing inaccuracy should be the smallest allowed value.
(5) The starting distance of the rays from the photocathode should be as small as the program will allow.
(6) The 'zero total charge' option should be disabled, to avoid the potentials near the photocathode being affected by existence of the large anode potential.
A 2D example is given by xmpl2d41. Here it is recommended that the ray starting points should be opposite the mid-point of a photocathode segment. This is achieved by using program 17 to produce the ray initial conditions.
To help with point (5) the inscribing correction is disabled to give more control over the positions of the photocathode segments.