pub trait ElectronTally: Send {
Show 19 methods
// Required method
fn merge(&mut self, other: Self)
where Self: Sized;
// Provided methods
fn begin_history(&mut self, _index: u64, _start: &ElectronState) { ... }
fn step(&mut self, _from: [f64; 3], _end: &ElectronState, _length_m: f64) { ... }
fn table_lookup(
&mut self,
_at: &ElectronState,
_channel: TableChannel,
_coverage: GridCoverage,
) { ... }
fn elastic(&mut self, _after: &ElectronState, _theta: f64) { ... }
fn inelastic(&mut self, _after: &ElectronState, _w_ev: f64) { ... }
fn inner_shell(
&mut self,
_after: &ElectronState,
_shell: &InnerShell,
_w_ev: f64,
) { ... }
fn secondary(
&mut self,
_primary: &ElectronState,
_event: &SecondaryEvent,
_created: Option<&ElectronState>,
) { ... }
fn phonon(
&mut self,
_after: &ElectronState,
_kind: PhononEvent,
_hbar_omega_ev: f64,
_theta: f64,
) { ... }
fn polaron_trapped(&mut self, _at: &ElectronState) { ... }
fn interface(
&mut self,
_at: &ElectronState,
_from_layer: usize,
_to_layer: usize,
) { ... }
fn barrier(
&mut self,
_at: &ElectronState,
_boundary: Boundary,
_delta_u_ev: f64,
) { ... }
fn reflected(&mut self, _at: &ElectronState, _boundary: Boundary) { ... }
fn begin_secondary(&mut self, _start: &ElectronState, _generation: u32) { ... }
fn end_secondary(&mut self, _fate: Fate) { ... }
fn stopped(&mut self, _at: &ElectronState) { ... }
fn escaped(&mut self, _at: &ElectronState, _face: Face) { ... }
fn absorbed(&mut self, _at: &ElectronState) { ... }
fn end_history(&mut self, _index: u64, _fate: Fate) { ... }
}Expand description
Event hooks called by Transport. All default to no-ops except merge.
The ElectronState passed is the state after the event.
Required Methods§
Provided Methods§
Sourcefn begin_history(&mut self, _index: u64, _start: &ElectronState)
fn begin_history(&mut self, _index: u64, _start: &ElectronState)
A primary history starts. With BoundaryModel::StepBarrier, start
is the primary in vacuum, before it meets the front face.
Sourcefn step(&mut self, _from: [f64; 3], _end: &ElectronState, _length_m: f64)
fn step(&mut self, _from: [f64; 3], _end: &ElectronState, _length_m: f64)
A flight segment of length_m ended at end.pos (at a collision, a
layer face or the target face). It started at from with energy
end.energy_ev (the energy does not change in flight).
Sourcefn table_lookup(
&mut self,
_at: &ElectronState,
_channel: TableChannel,
_coverage: GridCoverage,
)
fn table_lookup( &mut self, _at: &ElectronState, _channel: TableChannel, _coverage: GridCoverage, )
The rate of channel’s table in layer at.layer was evaluated at
at.energy_ev, which lies coverage against that table’s grid.
Called twice (elastic, then inelastic) at the start of every pass of
the transport loop that evaluates the rates, before the free path is
drawn: for every flight, whether it ends at a collision, at a layer
face (the path is then discarded and the rates are evaluated again in
the next pass) or nowhere (zero total rate, Fate::Trapped); after
a face reflection; and for a channel whose rate is zero. It is not
called for the primary’s entry through the front face (no table is
read), nor once an electron has reached the event cap, nor for the
tables of inner-shell channels. The inverse CDF
sampled at a collision uses the grid position of the same evaluation
and is not reported again. So these are rate evaluations, not
collisions: their number exceeds the number of collisions by the
number of boundary-limited and rate-less flights.
Sourcefn elastic(&mut self, _after: &ElectronState, _theta: f64)
fn elastic(&mut self, _after: &ElectronState, _theta: f64)
An elastic collision deflected the electron by theta rad.
Sourcefn inelastic(&mut self, _after: &ElectronState, _w_ev: f64)
fn inelastic(&mut self, _after: &ElectronState, _w_ev: f64)
An inelastic collision took w_ev from the electron. after carries
the new direction if the secondary model deflected it.
Sourcefn inner_shell(
&mut self,
_after: &ElectronState,
_shell: &InnerShell,
_w_ev: f64,
)
fn inner_shell( &mut self, _after: &ElectronState, _shell: &InnerShell, _w_ev: f64, )
Called right after ElectronTally::inelastic for every inelastic
event drawn from an inner-shell channel
(Transport::with_inner_shells), with or without a secondary
model: the shell (its element, subshell and binding energy) and the
loss w_ev (the same as passed to ElectronTally::inelastic). Not
called for valence events. Comes before ElectronTally::secondary.
Sourcefn secondary(
&mut self,
_primary: &ElectronState,
_event: &SecondaryEvent,
_created: Option<&ElectronState>,
)
fn secondary( &mut self, _primary: &ElectronState, _event: &SecondaryEvent, _created: Option<&ElectronState>, )
Called right after ElectronTally::inelastic (and
ElectronTally::inner_shell, for a shell event) for every inelastic
event when a SecondaryModel is on: the event’s energy bookkeeping,
and the secondary that was created (None if none was). The
secondary is transported later, between
ElectronTally::begin_secondary and
ElectronTally::end_secondary.
Sourcefn phonon(
&mut self,
_after: &ElectronState,
_kind: PhononEvent,
_hbar_omega_ev: f64,
_theta: f64,
)
fn phonon( &mut self, _after: &ElectronState, _kind: PhononEvent, _hbar_omega_ev: f64, _theta: f64, )
A Fröhlich LO-phonon event changed the energy by -ħω (emission) or
+ħω (absorption), hbar_omega_ev given, and deflected the electron by
theta rad. after is the state after the event.
Sourcefn polaron_trapped(&mut self, _at: &ElectronState)
fn polaron_trapped(&mut self, _at: &ElectronState)
The electron was trapped as a polaron at at and deposits its whole
remaining energy at.energy_ev there. The history (or the secondary)
then ends with Fate::PolaronTrapped (no ElectronTally::stopped
call).
Sourcefn interface(
&mut self,
_at: &ElectronState,
_from_layer: usize,
_to_layer: usize,
)
fn interface( &mut self, _at: &ElectronState, _from_layer: usize, _to_layer: usize, )
The electron crossed from layer from_layer into to_layer; at is
its state on the face, inside the new layer (after refraction, with
BoundaryModel::StepBarrier).
Sourcefn barrier(
&mut self,
_at: &ElectronState,
_boundary: Boundary,
_delta_u_ev: f64,
)
fn barrier( &mut self, _at: &ElectronState, _boundary: Boundary, _delta_u_ev: f64, )
With BoundaryModel::StepBarrier: the electron got through the face
boundary, and its kinetic energy changed by delta_u_ev (the step
U' - U). at is its state just past the face (in vacuum, for a
surface). Comes before ElectronTally::interface or
ElectronTally::escaped.
Sourcefn reflected(&mut self, _at: &ElectronState, _boundary: Boundary)
fn reflected(&mut self, _at: &ElectronState, _boundary: Boundary)
With BoundaryModel::StepBarrier: the electron was reflected at the
face boundary; at is its state after the reflection. At the
primary’s entry this is followed by ElectronTally::escaped.
Sourcefn begin_secondary(&mut self, _start: &ElectronState, _generation: u32)
fn begin_secondary(&mut self, _start: &ElectronState, _generation: u32)
A secondary of the given generation (1 for a secondary of the
primary, 2 for one of a secondary, …) starts at start.
Sourcefn end_secondary(&mut self, _fate: Fate)
fn end_secondary(&mut self, _fate: Fate)
The current secondary ended with fate.
Sourcefn stopped(&mut self, _at: &ElectronState)
fn stopped(&mut self, _at: &ElectronState)
The electron fell below the stopping threshold (or was trapped) at
at. A stop has at.energy_ev below the threshold of at.layer, a
trapped electron at least that energy
(Transport::stopping_thresholds_ev).
Sourcefn escaped(&mut self, _at: &ElectronState, _face: Face)
fn escaped(&mut self, _at: &ElectronState, _face: Face)
The electron left the target through face; at.energy_ev is the
energy it leaves with (its vacuum energy, with the step barrier).
Sourcefn absorbed(&mut self, _at: &ElectronState)
fn absorbed(&mut self, _at: &ElectronState)
The electron was absorbed at the back face (EscapeRule::FrontOnly).
Sourcefn end_history(&mut self, _index: u64, _fate: Fate)
fn end_history(&mut self, _index: u64, _fate: Fate)
The history ended (its last secondary included); fate is the
primary’s.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".