# Sampling of energy and angular distribution

Each particle hitting a surface can be recorded within an energy or angular histogram vector. This functionality is applicable for “walls” as well as for “membranes”.

All histograms are taken per physical surface. Important: For membranes, the histogram is only taken for particles hitting the side, where the normal vector points out. This is useful if e. g. multiple histograms shall be taken for a large physical surface at different areas: In this case it is possible to use several transparent membranes placed close to the surface at the desired locations. Since particles hitting the surface can be diffusely reflected, it would be misleading if the reflected particles are also sampled by the membranes.

The involved commands for generating histograms must be written within the wall description blocks (see wall reaction model) and are listed in the following.

### Energy histogram

add_energy_histogram("species", E0, E1, nE);

Parameters are:

• species: The gas species which shall be recorded
• E0, E1: Energy interval of interest
• nE: Number of histogram points within [E0, E1]

### Angular histogram

add_angular_histogram("species", nTheta, nPhi, vx, vy, vz);

Parameters are:

• species: The gas species which shall be recorded
• nTheta: The number of polar angle intervals (θ∈[0,90])
• nPhi: The number of azimuth angle intervals (φ∈[0,360])
• vx, vy, vz: A vector defining the direction where the azimuthal angle φ shall be defined as zero1)

### Combined histogram

Since energy and angular distribution are generally correlated, it is also possible to generate a combined energy and angular distribution:

add_histogram("species", nTheta, nPhi, E0, E1, nE, vx, vy, vz);

The parameters have the same meaning as in the single functions described above. In fact, this function is always internally called (also by add_energy_histogram and add_angular_histogram with a reduced parameter set). For a combined histogram please take care of the total number of histogram points (nTheta*nPhi*nE): If that number is very large, a very long time averaging interval will be needed to obtain useful statistics.

The resulting files in the output directory have the filenames histogram_<number>_<Surface>_<Species>_<Timestamp>.txt, e. g. histogram_1_Substrate_Ti_60.00ms.txt2).

The output format is just four columns with numbers:

• Energy [eV]
• Theta [°]
• Phi [°]
• Sampled histogram intensity

When making polar contour plots of the angular distribution, remember to adjust the intensity:

Intensity / sin(θ*π/180)

The reason for this is the integration in spherical coordinates, where the differential element is: sin(θ)dθdϕ.

### Histogram array

It is possible to divide a physical surface into an array of histograms. This only works for single plane surfaces by using the following command:

add_histogram_array("species", nTheta, nPhi, E0, E1, nE, nX, nY, x1, y1, z1, x2, y2, z2, x3, y3, z3);

Parameters are:

• species: The gas species which shall be recorded
• nTheta: The number of polar angle intervals (θ∈[0,90])
• nPhi: The number of azimuth angle intervals (φ∈[0,360])
• E0, E1: Energy interval of interest
• nE: Number of histogram points within [E0, E1]
• nX, nY: Number of histograms in x- and y-direction
• x1, y1, z1: First anchor point P1 of the histogram plane
• x2, y2, z2: Seconds anchor point P2, defines together with P1 the x-direction
• x3, y3, z3: Third anchor point P3, defines together with P1 the y-direction

The point coordinates should be given in mesh units. In the resulting file instead of a single intensity column, there are columns with the order . If are the indices of the X and Y partition and is the column number, the conversion rules are

Warning: Please take care not to use too many histogram slots / histogram segments as this could easily lead to memory overflow. If a simulation run with large histogram arrays is crashing on startup, please check the memory consumption on the compute nodes and consider using a fewer number of slots / histogram segments.

Besides the general function, there are also an energy (add_energy_histogram_array) and angular (add_angular_histogram_array) only function. Their parameters are a subsection of the more general command above, the syntax is as follows:

add_energy_histogram_array(species, E0, E1, nE, nx, ny, x1, y1, z1, x2, y2, z2, x3, y3, z3);
add_angular_histogram_array(species, nTheta, nPhi, nx, ny, x1, y1, z1, x2, y2, z2, x3, y3, z3);
1)
This is mandatory, since otherwise the tangential vectors needed to compute the azimuthal angle are undefined
2)
The 'number' is required since different histogram types are possible for the same species and surface, which would lead to the same filename otherwise