BodyDistribution

Trait BodyDistribution 

Source
pub trait BodyDistribution<Y> {
    // Required method
    fn sample<R: Rng + ?Sized>(&self, index: usize, rng: &mut R) -> Y;
}
Expand description

Sample random bodies.

The BodyDistribution trait describes a type that samples bodies randomly from a given distribution. BodyDistribution is used by QuickInsert to add new n bodies to the microstate. When sampling, QuickInsert passes the index (in $[0,n)$) of the body it is attempting to add. Implementations can use this index to e.g. place bodies with a given stoichiometry or polydispersity.

Required Methods§

Source

fn sample<R: Rng + ?Sized>(&self, index: usize, rng: &mut R) -> Y

Sample a body from the distribution with the given index.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<V, O, S, C> BodyDistribution<Body<OrientedPoint<V, O>, S>> for UniformIn<S, C>
where S: Clone, C: Distribution<V>, StandardUniform: Distribution<O>,

Randomly place oriented bodies in a given boundary.

sample chooses the body’s position randomly in the given boundary and also assigns a uniform random orientation. Sites, therefore, may be placed outside the boundary. Callers should reject insertions appropriately when add_body fails.

Source§

impl<V, S, C> BodyDistribution<Body<Point<V>, S>> for UniformIn<S, C>
where S: Clone, C: Distribution<V>,

Randomly place point bodies in a given boundary.

sample chooses the body’s position randomly in the given boundary. Sites, therefore, may be placed outside the boundary. Callers should reject insertions appropriately when add_body fails.