-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample_peo_solution.py
More file actions
60 lines (48 loc) · 1.74 KB
/
Copy pathexample_peo_solution.py
File metadata and controls
60 lines (48 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
#!/usr/bin/env python3
"""
Example: PEO Chains in Explicit Water — a Polymer Solution
===========================================================
Demonstrates mixing the Polymer and Molecule classes in a single system:
poly(ethylene oxide) chains solvated in explicit water. PEO/water is a
classic biocompatible polymer solution (hydrogels, drug delivery,
battery electrolytes).
- Polymer: complement SMILES with [*] wildcards, chain_num + sequence
- Molecule: regular SMILES, Count
- Both are passed together as generate(system, name, [polymer, solvent])
Force field: GAFF covers both components; Gasteiger charges are assigned
automatically. For production runs consider AM1-BCC/RESP charges and a
water-specific model if quantitative aqueous properties matter.
Requires: pip install -e . (from the AutoPoly repo root)
"""
from AutoPoly import System, Molecule, Polymer, generate
# Complement SMILES for PEO (methyl-terminated, matching the other examples)
PEO_FIRST = "CCO[*]"
PEO_MIDDLE = "[*]CCO[*]"
PEO_LAST = "[*]CCO"
DOP = 20
sequence = [PEO_FIRST] + [PEO_MIDDLE] * (DOP - 2) + [PEO_LAST]
system = System(out="peo_solution")
peo = Polymer(
chain_num=5,
sequence=sequence,
topology="linear",
tacticity="atactic",
)
water = Molecule(
Count=200,
Smiles="O",
Name="water",
)
generate(
system,
"peo_water",
[peo, water], # polymer + solvent in one box
force_field="gaff",
)
print()
print("Done! LAMMPS input files written to peo_solution/peo_water/")
print(f"System: 5 PEO chains (DOP={DOP}) + 200 water molecules")
print()
print("Note: the box is built at a low density to allow overlap-free")
print("placement. Equilibrate with NPT compression to reach the target")
print("density before production runs.")