Skip to main content

BranchedBuilder

Struct BranchedBuilder 

Source
pub struct BranchedBuilder { /* private fields */ }
Expand description

Builder for non-linear polymer architectures (comb, graft, star, dendrimer).

Unlike LinearBuilder, this builder takes two BigSMILES strings: one for the backbone and one for the branch.

Implementations§

Source§

impl BranchedBuilder

Source

pub fn new( backbone: BigSmiles, branch: BigSmiles, strategy: BuildStrategy, ) -> Self

Creates a new builder from backbone and branch BigSMILES strings plus a build strategy that governs the backbone length.

Source

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

Set a random seed for reproducible generation.

Source

pub fn comb_polymer( &self, branch_every: usize, ) -> Result<PolymerChain, PolySimError>

Generates a comb (regularly branched) polymer.

branch_every – attach one branch every N backbone repeat units.

Source

pub fn graft_copolymer( &self, graft_fraction: f64, seed: Option<u64>, ) -> Result<PolymerChain, PolySimError>

Generates a graft copolymer (random branch-point placement).

graft_fraction – fraction of backbone repeat units that carry a branch (0.0 = no grafting, 1.0 = every backbone unit is grafted).

seed – optional random seed for reproducibility (overrides builder seed).

Source

pub fn star_polymer(&self, arms: usize) -> Result<PolymerChain, PolySimError>

Generates a star polymer with arms arms radiating from a central atom.

Each arm is a homopolymer of the backbone BigSMILES repeat unit. The arm length is determined by the build strategy.

Supports 3 to 12 arms.

Source

pub fn dendrimer( &self, generation: usize, branching_factor: usize, ) -> Result<PolymerChain, PolySimError>

Generates a dendrimer of the given generation with branching_factor sub-branches per node.

  • generation: 1..=6
  • branching_factor: number of sub-branches per terminal node (typically 2)

Auto Trait Implementations§

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