Polymer¶
AutoPoly.models.polymer
¶
Polymer Definition Module
This module provides the Polymer class for defining polymer properties, sequences, and structural characteristics for molecular dynamics simulations.
The Polymer class handles: - Polymer chain definitions with various topologies (linear, ring) - Tacticity control (atactic, isotactic, syndiotactic) - Monomer sequence management - Chain generation with proper bonding patterns
Created on Fri Dec 21 12:19:08 2018 @author: zwu
Classes:
| Name | Description |
|---|---|
Polymer |
Polymer class for defining polymer structures and properties. |
Polymer
¶
Polymer class for defining polymer structures and properties.
This class manages polymer chain definitions including topology, tacticity, monomer sequences, and chain generation for molecular dynamics simulations.
Attributes:
| Name | Type | Description |
|---|---|---|
chain_num |
int
|
Number of polymer chains to generate |
sequence |
list
|
Explicit monomer sequence (pSMILES strings) |
dop |
int
|
Degree of polymerization (derived from sequence length) |
topology |
str
|
Polymer topology ('linear' or 'ring') |
tacticity |
str
|
Polymer tacticity ('atactic', 'isotactic', 'syndiotactic') |
sequenceSet |
list
|
List of monomer identifiers for each chain (includes _T1 markers) |
sequenceName |
list
|
List of monomer names for each chain |
tacticity_set |
list
|
List of tacticity choices (bool) for each position in each chain |
mer_set |
list
|
Unique set of monomers used |
Methods:
| Name | Description |
|---|---|
set_merSet |
Set the unique set of monomers used in the polymer. |
set_dop |
Set the degree of polymerization. |
set_Sequence |
Generate monomer identifier sequences using explicit sequence (no cycling). |
get_tacticity_for_chain |
Get tacticity choices for a specific chain. |
get_sequenceSet |
Get the sequence set for all chains. |
get_sequenceNames |
Get the sequence names for all chains. |
get_mer_set |
Get the unique set of monomers used. |
get_chain_info |
Get comprehensive information about the polymer. |
Source code in AutoPoly/models/polymer.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
set_merSet(merSet: Union[List[str], str]) -> None
¶
Set the unique set of monomers used in the polymer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
merSet
|
Union[List[str], str]
|
List of monomers or single monomer |
required |
Source code in AutoPoly/models/polymer.py
set_dop(dop: int) -> None
¶
Set the degree of polymerization.
Note: This method is kept for backward compatibility but should not be used in new code. DOP is automatically derived from sequence length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dop
|
int
|
Degree of polymerization |
required |
Source code in AutoPoly/models/polymer.py
set_Sequence() -> None
¶
Generate monomer identifier sequences using explicit sequence (no cycling).
This method generates identifier sequences for each chain. Each identifier consists of the base SMILES and a tacticity marker (_T1) if applicable.
The identifiers are NOT pure SMILES - they are strings used by the workflow to determine which variant files to use: - Base identifier: exact SMILES from the sequence at each position - Tacticity marker: "_T1" suffix indicates use of T1 chirality variant
Key changes from old API: - NO CYCLING: Each position in the sequence is used exactly once - DOP is len(sequence), not independently specified - Use explicit sequences for block copolymers and arbitrary patterns
Handles: - Linear vs ring topology - Atactic, isotactic, and syndiotactic tacticity - Block copolymers and arbitrary sequences
Raises:
| Type | Description |
|---|---|
ValidationError
|
If chain_num is 0 (no chains specified) |
Source code in AutoPoly/models/polymer.py
get_tacticity_for_chain(chain_idx: int) -> List[bool]
¶
Get tacticity choices for a specific chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chain_idx
|
int
|
Index of the chain (0-based) |
required |
Returns:
| Type | Description |
|---|---|
List[bool]
|
List[bool]: List of T1 choices for each position in the chain |
Source code in AutoPoly/models/polymer.py
get_sequenceSet() -> List[List[str]]
¶
Get the sequence set for all chains.
Returns:
| Type | Description |
|---|---|
List[List[str]]
|
List[List[str]]: List of monomer identifiers for each chain |
get_sequenceNames() -> List[List[str]]
¶
Get the sequence names for all chains.
Returns:
| Type | Description |
|---|---|
List[List[str]]
|
List[List[str]]: List of monomer names for each chain |
get_mer_set() -> List[str]
¶
Get the unique set of monomers used.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Unique list of monomers |
get_chain_info() -> dict
¶
Get comprehensive information about the polymer.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary containing polymer properties with Pythonic naming |