@@ -9,7 +9,7 @@ Polymer structure generator and physical property simulator written in Rust.
99
1010Given a [ BigSMILES] ( https://olsenlabmit.github.io/BigSMILES/docs/line_notation.html ) string,
1111polysim generates concrete polymer chains (as SMILES) and computes physical/chemical properties
12- such as glass transition temperature, crystallisation tendency, molecular weight, and more.
12+ such as glass transition temperature, molecular weight, and more.
1313
1414---
1515
@@ -21,11 +21,13 @@ such as glass transition temperature, crystallisation tendency, molecular weight
2121| 🔜 | Random / alternating / block copolymers |
2222| 🔜 | Branched polymers, graft copolymers, macromonomers |
2323| ✅ | Chain length by repeat count |
24- | 🔜 | Chain length by target Mn or exact mass |
24+ | ✅ | Chain length by target Mn (` ByTargetMn ` ) |
25+ | ✅ | Chain length by monoisotopic mass (` ByExactMass ` ) |
26+ | ✅ | Average molecular weight (IUPAC standard atomic weights) |
27+ | ✅ | Monoisotopic mass (most abundant isotope per element) |
2528| ✅ | Tg estimation — Fox equation |
2629| 🔜 | Tg estimation — Van Krevelen group contributions |
2730| 🔜 | Crystallisation tendency |
28- | 🔜 | Monoisotopic mass & average molecular weight |
2931| 🔜 | Hildebrand solubility parameter |
3032| 🔜 | Melting temperature Tm |
3133
@@ -39,51 +41,98 @@ such as glass transition temperature, crystallisation tendency, molecular weight
3941polysim-core = " 0.1"
4042```
4143
44+ ### Build a chain and read its molecular weight
45+
46+ ``` rust
47+ use polysim_core :: {parse, builder :: {linear :: LinearBuilder , BuildStrategy }};
48+
49+ // Polyéthylène — 100 unités répétées
50+ let bs = parse (" {[]CC[]}" ). unwrap ();
51+ let chain = LinearBuilder :: new (bs , BuildStrategy :: ByRepeatCount (100 ))
52+ . homopolymer ()
53+ . unwrap ();
54+
55+ println! (" Repeat units : {}" , chain . repeat_count); // 100
56+ println! (" Mn : {:.1} g/mol" , chain . mn); // 1410.7 g/mol
57+ println! (" SMILES : {}…" , & chain . smiles[.. 20 ]);
58+ ```
59+
60+ ### Target a specific Mn
61+
4262``` rust
4363use polysim_core :: {parse, builder :: {linear :: LinearBuilder , BuildStrategy }};
4464
45- // Generate a polystyrene chain with 50 repeat units
46- let bs = parse (" {[]CC(c1ccccc1)[]}" ). unwrap ();
47- let chain = LinearBuilder :: new (bs , BuildStrategy :: ByRepeatCount (50 ))
65+ // Polypropylène — viser Mn ≈ 10 000 g/mol
66+ let bs = parse (" {[]CC(C)[]}" ). unwrap ();
67+ let chain = LinearBuilder :: new (bs , BuildStrategy :: ByTargetMn (10_000.0 ))
68+ . homopolymer ()
69+ . unwrap ();
70+
71+ println! (" Repeat units : {}" , chain . repeat_count); // ≈ 237
72+ println! (" Mn réel : {:.1} g/mol" , chain . mn); // ≈ 9 996 g/mol
73+ ```
74+
75+ ### Compute masses independently
76+
77+ ``` rust
78+ use polysim_core :: {parse, builder :: {linear :: LinearBuilder , BuildStrategy },
79+ properties :: molecular_weight :: {average_mass, monoisotopic_mass}};
80+
81+ let bs = parse (" {[]CC(c1ccccc1)[]}" ). unwrap (); // polystyrène
82+ let chain = LinearBuilder :: new (bs , BuildStrategy :: ByRepeatCount (10 ))
4883 . homopolymer ()
4984 . unwrap ();
5085
51- println! (" {} " , chain . smiles); // full SMILES string
52- println! (" {} " , chain . repeat_count); // 50
86+ println! (" Masse moyenne : {:.2} g/mol " , average_mass ( & chain ));
87+ println! (" Masse monoisotopique: {:.2} g/mol " , monoisotopic_mass ( & chain ));
5388```
5489
90+ ### Glass transition temperature
91+
5592``` rust
5693use polysim_core :: properties :: thermal :: tg_fox;
5794
58- // Tg of a 70/30 PS/PMMA blend (PS: 373 K, PMMA: 378 K)
95+ // Tg d'un mélange 70/30 PS/PMMA (PS : 373 K, PMMA : 378 K)
5996let tg = tg_fox (& [(0.70 , 373.0 ), (0.30 , 378.0 )]);
6097println! (" Tg ≈ {tg:.1} K" );
6198```
6299
63100---
64101
65- ## Polymer architectures
66-
67- | Architecture | Builder | Key parameters |
68- | ---| ---| ---|
69- | Homopolymer | ` LinearBuilder::homopolymer ` | repeat count or target Mn |
70- | Random copolymer | ` LinearBuilder::random_copolymer ` | weight fraction per monomer |
71- | Alternating copolymer | ` LinearBuilder::alternating_copolymer ` | exactly 2 repeat units |
72- | Block copolymer | ` LinearBuilder::block_copolymer ` | length of each block |
73- | Comb / branched | ` BranchedBuilder::comb_polymer ` | branch frequency |
74- | Graft copolymer | ` BranchedBuilder::graft_copolymer ` | graft fraction |
75- | Macromonomer | ` BranchedBuilder::macromonomer ` | side chain + end group |
76-
77- ### Build strategies
102+ ## Build strategies
78103
79104``` rust
80105pub enum BuildStrategy {
81- ByRepeatCount (usize ), // exact number of repeat units
82- ByTargetMn (f64 ), // target number-average Mn in g/mol (🔜)
83- ByExactMass (f64 ), // target monoisotopic mass in g/mol (🔜)
106+ /// Nombre exact d'unités répétées.
107+ ByRepeatCount (usize ),
108+
109+ /// Mn cible (masse moléculaire moyenne, g/mol).
110+ /// Le nombre de répétitions est déduit par extrapolation linéaire.
111+ ByTargetMn (f64 ),
112+
113+ /// Masse monoisotopique cible (g/mol).
114+ /// Même logique que ByTargetMn mais avec les masses monoisotopiques.
115+ ByExactMass (f64 ),
84116}
85117```
86118
119+ Après construction, ` chain.mn ` contient toujours la masse moléculaire moyenne calculée,
120+ quelle que soit la stratégie utilisée.
121+
122+ ---
123+
124+ ## Polymer architectures
125+
126+ | Architecture | Builder | Statut |
127+ | ---| ---| ---|
128+ | Homopolymer | ` LinearBuilder::homopolymer ` | ✅ |
129+ | Random copolymer | ` LinearBuilder::random_copolymer ` | 🔜 |
130+ | Alternating copolymer | ` LinearBuilder::alternating_copolymer ` | 🔜 |
131+ | Block copolymer | ` LinearBuilder::block_copolymer ` | 🔜 |
132+ | Comb / branched | ` BranchedBuilder::comb_polymer ` | 🔜 |
133+ | Graft copolymer | ` BranchedBuilder::graft_copolymer ` | 🔜 |
134+ | Macromonomer | ` BranchedBuilder::macromonomer ` | 🔜 |
135+
87136---
88137
89138## Workspace layout
@@ -97,8 +146,6 @@ polysim/
97146│ │ ├── polymer/ # PolymerChain type
98147│ │ └── properties/ # Tg, MW, …
99148│ └── polysim-cli/ # command-line tool (not yet published)
100- └── tests/
101- └── integration.rs
102149```
103150
104151---
0 commit comments