polysim_core/builder/branched.rs
1use bigsmiles::BigSmiles;
2
3use crate::{error::PolySimError, polymer::PolymerChain};
4
5use super::strategy::BuildStrategy;
6
7/// Builder for non-linear polymer architectures (branched, graft, macromonomer).
8///
9/// Unlike [`LinearBuilder`](super::linear::LinearBuilder), this builder takes
10/// two BigSMILES strings: one for the **backbone** and one for the **branch**.
11// Fields are stored for future use once the builder methods are implemented.
12#[allow(dead_code)]
13pub struct BranchedBuilder {
14 /// BigSMILES of the backbone chain.
15 backbone: BigSmiles,
16 /// BigSMILES of the branch / side chain.
17 branch: BigSmiles,
18 /// Strategy that controls backbone chain length.
19 strategy: BuildStrategy,
20}
21
22impl BranchedBuilder {
23 /// Creates a new builder from backbone and branch BigSMILES strings plus a
24 /// build strategy that governs the backbone length.
25 pub fn new(backbone: BigSmiles, branch: BigSmiles, strategy: BuildStrategy) -> Self {
26 Self {
27 backbone,
28 branch,
29 strategy,
30 }
31 }
32
33 /// Generates a comb (regularly branched) polymer.
34 ///
35 /// `branch_every` — attach one branch every N backbone repeat units.
36 pub fn comb_polymer(&self, _branch_every: usize) -> Result<PolymerChain, PolySimError> {
37 todo!("implement comb/branched polymer generation")
38 }
39
40 /// Generates a graft copolymer (random branch-point placement).
41 ///
42 /// `graft_fraction` — fraction of backbone repeat units that carry a branch
43 /// (0.0 = no grafting, 1.0 = every backbone unit is grafted).
44 pub fn graft_copolymer(&self, _graft_fraction: f64) -> Result<PolymerChain, PolySimError> {
45 todo!("implement graft copolymer generation")
46 }
47
48 /// Generates a macromonomer: a single branch/side chain with a
49 /// polymerisable end group.
50 pub fn macromonomer(&self) -> Result<PolymerChain, PolySimError> {
51 todo!("implement macromonomer generation")
52 }
53}