-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbasic_example.py
More file actions
37 lines (29 loc) · 964 Bytes
/
basic_example.py
File metadata and controls
37 lines (29 loc) · 964 Bytes
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
from pathlib import Path
import stk
import stko
def main() -> None:
"""Run the example."""
bb1 = stk.BuildingBlock("NCCNCCN", [stk.PrimaryAminoFactory()])
bb2 = stk.BuildingBlock("O=CCCC=O", [stk.AldehydeFactory()])
polymer = stk.ConstructedMolecule(
stk.polymer.Linear(
building_blocks=(bb1, bb2),
repeating_unit="AB",
orientations=(0, 0),
num_repeating_units=1,
)
)
examples_output = Path("output_directory")
examples_output.mkdir(parents=True, exist_ok=True)
# Run optimisations.
uff = stko.UFF()
polymer = uff.optimize(polymer)
polymer.write(examples_output / "poly_uff.mol")
mmff = stko.MMFF()
polymer = mmff.optimize(polymer)
polymer.write(examples_output / "poly_mmff.mol")
etkdg = stko.ETKDG()
polymer = etkdg.optimize(polymer)
polymer.write(examples_output / "poly_etkdg.mol")
if __name__ == "__main__":
main()