Skip to main content

Transport

Struct Transport 

Source
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>

Source

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.

Source

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

pub fn stack(&self) -> &Stack

The target.

Source§

impl<G: Geometry> Transport<G>

Source

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.

Source

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.

Source

pub fn geometry(&self) -> &G

The target geometry.

Source

pub fn n_materials(&self) -> usize

Number of materials, which is the number of table pairs.

Source

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.

Source

pub fn insulator_channels(&self) -> &[InsulatorChannels]

The insulator channels of each layer.

Source

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).

Source

pub fn inner_shells(&self) -> &[Vec<ShellChannelTable>]

The inner-shell channel tables of each layer.

Source

pub fn config(&self) -> &TransportConfig

The configuration.

Source

pub fn layer_tables(&self) -> &[LayerTables]

The tables of each layer.

Source

pub fn band_structures(&self) -> Option<&[BandStructure]>

The band parameters per layer, if given.

Source

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.

Source

pub fn metadata( &self, seed: u64, n_histories: u64, chunk_size: u64, primary: &Primary, ) -> RunMetadata

The metadata of a run with these arguments.

Source

pub fn run<T, N>( &self, seed: u64, n_histories: u64, chunk_size: u64, primary: &Primary, new_tally: N, ) -> Result<TransportRun<T>, TransportError>
where T: ElectronTally, N: Fn() -> T + Sync,

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.

Source

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>
where T: ElectronTally, N: Fn() -> T + Sync,

Self::run with a finite beam: each history starts at a position and direction drawn from beam (BeamSpread).

Source

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.

Source

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§

Source§

impl<G: Clone> Clone for Transport<G>

Source§

fn clone(&self) -> Transport<G>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<G: Debug> Debug for Transport<G>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V