Skip to main content

EnsembleBuilder

Struct EnsembleBuilder 

Source
pub struct EnsembleBuilder<D: ChainLengthDistribution> { /* private fields */ }
Expand description

Builder that generates a polydisperse ensemble of polymer chains.

Implementations§

Source§

impl<D: ChainLengthDistribution> EnsembleBuilder<D>

Source

pub fn new(bigsmiles: BigSmiles, distribution: D, mn: f64, pdi: f64) -> Self

Creates a new ensemble builder.

  • bigsmiles — parsed BigSMILES describing the polymer.
  • distribution — chain length distribution model.
  • mn — target number-average molecular weight (g/mol).
  • pdi — target polydispersity index (Mw/Mn).
Source

pub fn num_chains(self, n: usize) -> Self

Override the number of chains to generate (default: 100).

Source

pub fn seed(self, seed: u64) -> Self

Set a seed for reproducible sampling.

Source

pub fn homopolymer_ensemble(&self) -> Result<PolymerEnsemble, PolySimError>

Build a polydisperse ensemble of homopolymer chains.

§Errors
Source

pub fn random_copolymer_ensemble( &self, fractions: &[f64], ) -> Result<PolymerEnsemble, PolySimError>

Build a polydisperse ensemble of random copolymer chains.

fractions — weight fraction of each repeat unit (must sum to 1.0).

Source

pub fn alternating_copolymer_ensemble( &self, ) -> Result<PolymerEnsemble, PolySimError>

Build a polydisperse ensemble of alternating copolymer chains.

Source

pub fn block_copolymer_ensemble( &self, block_ratios: &[f64], ) -> Result<PolymerEnsemble, PolySimError>

Build a polydisperse ensemble of block copolymer chains.

block_ratios — relative proportion of each block (must sum to 1.0). Each chain has a different total n, distributed according to the ratios.

Source

pub fn gradient_copolymer_ensemble( &self, profile: &GradientProfile, ) -> Result<PolymerEnsemble, PolySimError>

Build a polydisperse ensemble of gradient copolymer chains.

Each chain has composition that varies from f_start to f_end according to profile. The BigSMILES must contain exactly 2 repeat units.

Auto Trait Implementations§

§

impl<D> Freeze for EnsembleBuilder<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for EnsembleBuilder<D>
where D: RefUnwindSafe,

§

impl<D> Send for EnsembleBuilder<D>
where D: Send,

§

impl<D> Sync for EnsembleBuilder<D>
where D: Sync,

§

impl<D> Unpin for EnsembleBuilder<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for EnsembleBuilder<D>
where D: UnsafeUnpin,

§

impl<D> UnwindSafe for EnsembleBuilder<D>
where D: 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
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, 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.
Source§

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

Source§

fn vzip(self) -> V