pub struct Transport<G = Stack> { /* private fields */ }Expand description
The electron transport engine: a stack, the tables of each layer, their band parameters (optional) and a configuration.
Implementations§
Source§impl Transport<Stack>
impl Transport<Stack>
Sourcepub fn new(
stack: Stack,
tables: Vec<LayerTables>,
config: TransportConfig,
) -> Result<Self, TransportError>
pub fn new( stack: Stack, tables: Vec<LayerTables>, config: TransportConfig, ) -> Result<Self, TransportError>
Check and assemble, without band parameters. tables[i] belongs to
stack.layers()[i]. Fails if the configuration needs band parameters
(a SecondaryModel other than Off, or the step barrier); use
Transport::with_band_structures then.
Sourcepub fn with_band_structures(
stack: Stack,
tables: Vec<LayerTables>,
bands: Vec<BandStructure>,
config: TransportConfig,
) -> Result<Self, TransportError>
pub fn with_band_structures( stack: Stack, tables: Vec<LayerTables>, bands: Vec<BandStructure>, config: TransportConfig, ) -> Result<Self, TransportError>
Check and assemble with band parameters: bands[i] belongs to
stack.layers()[i]. They supply the Fermi energy and band gap of the
secondary model and the inner potential of the step barrier and of
CutoffReference::VacuumLevel.
Source§impl<G: Geometry> Transport<G>
impl<G: Geometry> Transport<G>
Sourcepub fn on_geometry(
geometry: G,
tables: Vec<LayerTables>,
config: TransportConfig,
) -> Result<Self, TransportError>
pub fn on_geometry( geometry: G, tables: Vec<LayerTables>, config: TransportConfig, ) -> Result<Self, TransportError>
Transport::new on any Geometry (a crate::geometry::VoxelGrid,
a mesh, a CSG solid): tables[m] belongs to material m of the
geometry (Geometry::material), whatever the regions that hold it.
Everything per material (tables, band parameters, insulator and
inner-shell channels, stopping thresholds) is indexed by material; the
electron’s ElectronState::layer is then its material index.
The primary starts at Geometry::entry_point.
Sourcepub fn on_geometry_with_band_structures(
geometry: G,
tables: Vec<LayerTables>,
bands: Vec<BandStructure>,
config: TransportConfig,
) -> Result<Self, TransportError>
pub fn on_geometry_with_band_structures( geometry: G, tables: Vec<LayerTables>, bands: Vec<BandStructure>, config: TransportConfig, ) -> Result<Self, TransportError>
Transport::with_band_structures on any Geometry; bands[m]
belongs to material m.
Sourcepub fn n_materials(&self) -> usize
pub fn n_materials(&self) -> usize
Number of materials, which is the number of table pairs.
Sourcepub fn with_insulator_channels(
self,
layer: usize,
channels: InsulatorChannels,
) -> Result<Self, TransportError>
pub fn with_insulator_channels( self, layer: usize, channels: InsulatorChannels, ) -> Result<Self, TransportError>
Switch on the insulator channels channels in layer layer (they
replace that layer’s previous choice). Every layer starts with
InsulatorChannels::none; only opt a layer in when it is a polar
insulator (never a metal). The choice is recorded in the
LayerMetadata of the run.
Sourcepub fn insulator_channels(&self) -> &[InsulatorChannels]
pub fn insulator_channels(&self) -> &[InsulatorChannels]
The insulator channels of each layer.
Sourcepub fn with_inner_shells(
self,
layer: usize,
shells: Vec<ShellChannelTable>,
) -> Result<Self, TransportError>
pub fn with_inner_shells( self, layer: usize, shells: Vec<ShellChannelTable>, ) -> Result<Self, TransportError>
Add the inner-shell ionisation channels shells to layer layer
(they replace that layer’s previous shells; an empty list removes
them). Every layer starts with none, which is the valence-only
transport of before. The layer’s inelastic table is then its
valence channel: it must not already contain these shells (build
both with
crate::electron::inelastic::table::build_shell_channel_tables).
The channels are sampled in the given order (module docs, “Inner-shell
channels”) and recorded in the LayerMetadata of the run.
Fails, leaving nothing changed, if layer is out of range, if a
shell’s table names a different material from the layer’s inelastic
table (tables built for another target), if a (Z, subshell) repeats,
or, with band parameters, if a binding energy does not exceed the
layer’s Fermi energy (an inner shell lies below the Fermi level).
Sourcepub fn inner_shells(&self) -> &[Vec<ShellChannelTable>]
pub fn inner_shells(&self) -> &[Vec<ShellChannelTable>]
The inner-shell channel tables of each layer.
Sourcepub fn config(&self) -> &TransportConfig
pub fn config(&self) -> &TransportConfig
The configuration.
Sourcepub fn layer_tables(&self) -> &[LayerTables]
pub fn layer_tables(&self) -> &[LayerTables]
The tables of each layer.
Sourcepub fn band_structures(&self) -> Option<&[BandStructure]>
pub fn band_structures(&self) -> Option<&[BandStructure]>
The band parameters per layer, if given.
Sourcepub fn stopping_thresholds_ev(&self) -> &[f64]
pub fn stopping_thresholds_ev(&self) -> &[f64]
The stopping threshold of each layer, eV: the cutoff under
CutoffReference::BandBottom, U + cutoff under
CutoffReference::VacuumLevel (module docs). An electron reported
by ElectronTally::stopped with less energy than its layer’s
threshold fell below it (Fate::Stopped); one with at least that
energy is Fate::Trapped.
Sourcepub fn metadata(
&self,
seed: u64,
n_histories: u64,
chunk_size: u64,
primary: &Primary,
) -> RunMetadata
pub fn metadata( &self, seed: u64, n_histories: u64, chunk_size: u64, primary: &Primary, ) -> RunMetadata
The metadata of a run with these arguments.
Sourcepub fn run<T, N>(
&self,
seed: u64,
n_histories: u64,
chunk_size: u64,
primary: &Primary,
new_tally: N,
) -> Result<TransportRun<T>, TransportError>
pub fn run<T, N>( &self, seed: u64, n_histories: u64, chunk_size: u64, primary: &Primary, new_tally: N, ) -> Result<TransportRun<T>, TransportError>
Run n_histories primaries in parallel (on the current rayon pool),
bit-identically at any thread count. new_tally makes an empty tally;
one is made per chunk of chunk_size histories.
Sourcepub fn run_beam<T, N>(
&self,
seed: u64,
n_histories: u64,
chunk_size: u64,
primary: &Primary,
beam: &BeamSpread,
new_tally: N,
) -> Result<TransportRun<T>, TransportError>
pub fn run_beam<T, N>( &self, seed: u64, n_histories: u64, chunk_size: u64, primary: &Primary, beam: &BeamSpread, new_tally: N, ) -> Result<TransportRun<T>, TransportError>
Self::run with a finite beam: each history starts at a position
and direction drawn from beam (BeamSpread).
Sourcepub fn history<T, R>(
&self,
tally: &mut T,
rng: &mut R,
index: u64,
primary: &Primary,
) -> Result<Fate, TransportError>where
T: ElectronTally,
R: Rng,
pub fn history<T, R>(
&self,
tally: &mut T,
rng: &mut R,
index: u64,
primary: &Primary,
) -> Result<Fate, TransportError>where
T: ElectronTally,
R: Rng,
Simulate one primary, and every secondary it leads to, with the given random stream. Returns the primary’s fate.
Sourcepub fn history_beam<T, R>(
&self,
tally: &mut T,
rng: &mut R,
index: u64,
primary: &Primary,
beam: &BeamSpread,
) -> Result<Fate, TransportError>where
T: ElectronTally,
R: Rng,
pub fn history_beam<T, R>(
&self,
tally: &mut T,
rng: &mut R,
index: u64,
primary: &Primary,
beam: &BeamSpread,
) -> Result<Fate, TransportError>where
T: ElectronTally,
R: Rng,
Self::history for a finite beam: the start position, then the
direction, are drawn from rng before the transport (no draws for the
default BeamSpread).
Trait Implementations§
Auto Trait Implementations§
impl<G> Freeze for Transport<G>where
G: Freeze,
impl<G> RefUnwindSafe for Transport<G>where
G: RefUnwindSafe,
impl<G> Send for Transport<G>where
G: Send,
impl<G> Sync for Transport<G>where
G: Sync,
impl<G> Unpin for Transport<G>where
G: Unpin,
impl<G> UnsafeUnpin for Transport<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for Transport<G>where
G: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more