Skip to content

Commit

Permalink
Add example and output.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtarzia committed Oct 28, 2024
1 parent 942f00d commit f8c8434
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 0 deletions.
49 changes: 49 additions & 0 deletions examples/optwrite_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ruff: noqa: T201

import logging
from pathlib import Path

import stk

import stko


def main() -> None:
"""Run the example."""
bb1 = stk.BuildingBlock("NCCN", [stk.PrimaryAminoFactory()])
bb2 = stk.BuildingBlock("O=CCCC=O", [stk.AldehydeFactory()])
polymer = stk.ConstructedMolecule(
topology_graph=stk.polymer.Linear(
building_blocks=(bb1, bb2),
repeating_unit="AB",
num_repeating_units=3,
optimizer=stk.Collapser(scale_steps=False),
),
)

output_directory = Path("optwrite_output")
output_directory.mkdir(exist_ok=True, parents=True)

optimiser = stko.OptWriterSequence(
optimizers={
"etkdg": stko.ETKDG(),
"uff": stko.UFF(),
"mmff": stko.MMFF(),
},
writer=stk.MolWriter(),
output_directory=output_directory,
)

polymer = optimiser.optimize(polymer)

# Delete some, rerun.
(output_directory / "mmff_out.mol").unlink()
polymer = optimiser.optimize(polymer)


if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s | %(levelname)s | %(message)s",
)
main()
127 changes: 127 additions & 0 deletions examples/optwrite_output/etkdg_out.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@

RDKit 3D

0 0 0 0 0 0 0 0 0 0999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 57 56 0 0 0
M V30 BEGIN ATOM
M V30 1 N -8.7253 2.0615 -1.1552 0
M V30 2 C -7.3109 2.1250 -1.4520 0
M V30 3 C -6.4890 2.0630 -0.1761 0
M V30 4 N -6.7505 0.8547 0.5146 0
M V30 5 H -8.8856 1.6166 -0.2047 0
M V30 6 H -9.1721 1.5378 -1.9270 0
M V30 7 H -6.9454 1.3341 -2.1163 0
M V30 8 H -7.1406 3.1523 -1.8761 0
M V30 9 H -6.7234 2.9706 0.4474 0
M V30 10 H -5.4135 2.1215 -0.4442 0
M V30 11 N -4.1891 -1.4429 -0.4840 0
M V30 12 C -2.8634 -1.4576 -1.0534 0
M V30 13 C -1.9940 -0.6620 -0.0939 0
M V30 14 N -0.6344 -0.6123 -0.5652 0
M V30 15 H -2.8559 -0.9676 -2.0488 0
M V30 16 H -2.5085 -2.4823 -1.1273 0
M V30 17 H -2.0338 -1.0379 0.9262 0
M V30 18 H -2.3473 0.3978 -0.0461 0
M V30 19 N 2.8751 0.4023 1.0896 0
M V30 20 C 4.0931 -0.2949 1.0053 0
M V30 21 C 5.3108 0.6331 0.8635 0
M V30 22 N 6.4431 -0.2388 0.8051 0
M V30 23 H 4.1839 -1.0164 0.1690 0
M V30 24 H 4.2562 -0.8095 1.9930 0
M V30 25 H 5.1869 1.1513 -0.1260 0
M V30 26 H 5.3628 1.3645 1.7087 0
M V30 27 C -5.8126 0.1568 0.9917 0
M V30 28 C -6.1036 -1.1125 1.7152 0
M V30 29 C -6.0146 -2.2991 0.7885 0
M V30 30 C -4.6416 -2.3748 0.2325 0
M V30 31 H -4.7956 0.4669 0.8841 0
M V30 32 H -5.3463 -1.2774 2.5309 0
M V30 33 H -7.0902 -1.0273 2.2082 0
M V30 34 H -6.2520 -3.2104 1.3909 0
M V30 35 H -6.7774 -2.1877 -0.0358 0
M V30 36 H -4.0269 -3.2435 0.4518 0
M V30 37 C 0.1180 -1.6242 -0.4494 0
M V30 38 C 1.5110 -1.5759 -0.9313 0
M V30 39 C 2.0246 -0.1554 -1.0826 0
M V30 40 C 1.9516 0.5019 0.2374 0
M V30 41 H -0.2548 -2.5226 0.0036 0
M V30 42 H 1.5693 -2.0119 -1.9690 0
M V30 43 H 2.1174 -2.1678 -0.2193 0
M V30 44 H 1.4216 0.3940 -1.8365 0
M V30 45 H 3.0600 -0.1360 -1.4362 0
M V30 46 H 1.0757 1.0864 0.4798 0
M V30 47 C 7.5684 0.0618 0.3453 0
M V30 48 C 7.8257 1.4202 -0.2037 0
M V30 49 C 9.2174 1.3525 -0.8541 0
M V30 50 C 10.1465 0.9933 0.2359 0
M V30 51 O 10.2021 1.6741 1.2624 0
M V30 52 H 8.3459 -0.7025 0.3612 0
M V30 53 H 7.8212 2.1150 0.6525 0
M V30 54 H 7.0648 1.6889 -0.9762 0
M V30 55 H 9.3967 2.3261 -1.3221 0
M V30 56 H 9.1464 0.4991 -1.5694 0
M V30 57 H 10.8017 0.1278 0.1682 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 3 4
M V30 4 1 1 5
M V30 5 1 1 6
M V30 6 1 2 7
M V30 7 1 2 8
M V30 8 1 3 9
M V30 9 1 3 10
M V30 10 1 11 12
M V30 11 1 12 13
M V30 12 1 13 14
M V30 13 1 12 15
M V30 14 1 12 16
M V30 15 1 13 17
M V30 16 1 13 18
M V30 17 1 19 20
M V30 18 1 20 21
M V30 19 1 21 22
M V30 20 1 20 23
M V30 21 1 20 24
M V30 22 1 21 25
M V30 23 1 21 26
M V30 24 1 27 28
M V30 25 1 28 29
M V30 26 1 29 30
M V30 27 1 27 31
M V30 28 1 28 32
M V30 29 1 28 33
M V30 30 1 29 34
M V30 31 1 29 35
M V30 32 1 30 36
M V30 33 1 37 38
M V30 34 1 38 39
M V30 35 1 39 40
M V30 36 1 37 41
M V30 37 1 38 42
M V30 38 1 38 43
M V30 39 1 39 44
M V30 40 1 39 45
M V30 41 1 40 46
M V30 42 1 47 48
M V30 43 1 48 49
M V30 44 1 49 50
M V30 45 2 50 51
M V30 46 1 47 52
M V30 47 1 48 53
M V30 48 1 48 54
M V30 49 1 49 55
M V30 50 1 49 56
M V30 51 1 50 57
M V30 52 2 4 27
M V30 53 2 11 30
M V30 54 2 14 37
M V30 55 2 19 40
M V30 56 2 22 47
M V30 END BOND
M V30 END CTAB
M END

$$$$
127 changes: 127 additions & 0 deletions examples/optwrite_output/mmff_out.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@

RDKit 3D

0 0 0 0 0 0 0 0 0 0999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 57 56 0 0 0
M V30 BEGIN ATOM
M V30 1 N -9.7205 2.4412 0.1748 0
M V30 2 C -8.7253 2.4626 -0.9019 0
M V30 3 C -7.3480 2.0064 -0.3925 0
M V30 4 N -7.4721 0.6414 0.1529 0
M V30 5 H -9.5476 1.5811 0.7050 0
M V30 6 H -10.6481 2.3394 -0.2334 0
M V30 7 H -9.0544 1.7874 -1.7020 0
M V30 8 H -8.6598 3.4738 -1.3157 0
M V30 9 H -6.9984 2.6846 0.3963 0
M V30 10 H -6.6338 2.0454 -1.2248 0
M V30 11 N -4.0588 -1.7774 -1.5924 0
M V30 12 C -2.6349 -2.1017 -1.7749 0
M V30 13 C -1.7761 -1.1799 -0.9066 0
M V30 14 N -0.3638 -1.5630 -1.0477 0
M V30 15 H -2.3809 -1.9596 -2.8321 0
M V30 16 H -2.4140 -3.1534 -1.5498 0
M V30 17 H -2.1004 -1.2636 0.1386 0
M V30 18 H -1.9166 -0.1384 -1.2228 0
M V30 19 N 3.4392 1.2184 1.2207 0
M V30 20 C 4.4653 0.2500 1.6078 0
M V30 21 C 5.8574 0.8571 1.4063 0
M V30 22 N 6.8602 -0.1458 1.7652 0
M V30 23 H 4.3981 -0.7054 1.0795 0
M V30 24 H 4.3247 0.0100 2.6690 0
M V30 25 H 5.9681 1.1602 0.3587 0
M V30 26 H 5.9553 1.7465 2.0397 0
M V30 27 C -6.3566 -0.0024 0.1728 0
M V30 28 C -6.3116 -1.4242 0.6676 0
M V30 29 C -6.1455 -2.3668 -0.5146 0
M V30 30 C -4.6835 -2.5767 -0.8000 0
M V30 31 H -5.4061 0.4323 -0.1865 0
M V30 32 H -5.4914 -1.5116 1.3871 0
M V30 33 H -7.2532 -1.6426 1.1833 0
M V30 34 H -6.5682 -3.3481 -0.2750 0
M V30 35 H -6.6418 -1.9875 -1.4135 0
M V30 36 H -4.1867 -3.4033 -0.2611 0
M V30 37 C 0.3940 -1.0382 -0.1495 0
M V30 38 C 1.8708 -1.3283 -0.1335 0
M V30 39 C 2.6570 -0.1667 -0.7246 0
M V30 40 C 2.6713 1.0148 0.2098 0
M V30 41 H 0.0132 -0.3478 0.6267 0
M V30 42 H 2.0560 -2.2309 -0.7262 0
M V30 43 H 2.1592 -1.5306 0.9038 0
M V30 44 H 2.2135 0.1642 -1.6709 0
M V30 45 H 3.6851 -0.4728 -0.9383 0
M V30 46 H 1.8979 1.7782 0.0148 0
M V30 47 C 8.1102 0.1239 1.6053 0
M V30 48 C 8.7065 1.3870 1.0329 0
M V30 49 C 8.9214 1.2341 -0.4679 0
M V30 50 C 10.0908 0.3423 -0.8074 0
M V30 51 O 10.7997 -0.2131 0.0260 0
M V30 52 H 8.8332 -0.6678 1.8728 0
M V30 53 H 9.6511 1.5798 1.5538 0
M V30 54 H 8.0486 2.2374 1.2276 0
M V30 55 H 9.1343 2.2139 -0.9091 0
M V30 56 H 8.0328 0.8222 -0.9576 0
M V30 57 H 10.2830 0.2121 -1.8853 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 3 4
M V30 4 1 1 5
M V30 5 1 1 6
M V30 6 1 2 7
M V30 7 1 2 8
M V30 8 1 3 9
M V30 9 1 3 10
M V30 10 1 11 12
M V30 11 1 12 13
M V30 12 1 13 14
M V30 13 1 12 15
M V30 14 1 12 16
M V30 15 1 13 17
M V30 16 1 13 18
M V30 17 1 19 20
M V30 18 1 20 21
M V30 19 1 21 22
M V30 20 1 20 23
M V30 21 1 20 24
M V30 22 1 21 25
M V30 23 1 21 26
M V30 24 1 27 28
M V30 25 1 28 29
M V30 26 1 29 30
M V30 27 1 27 31
M V30 28 1 28 32
M V30 29 1 28 33
M V30 30 1 29 34
M V30 31 1 29 35
M V30 32 1 30 36
M V30 33 1 37 38
M V30 34 1 38 39
M V30 35 1 39 40
M V30 36 1 37 41
M V30 37 1 38 42
M V30 38 1 38 43
M V30 39 1 39 44
M V30 40 1 39 45
M V30 41 1 40 46
M V30 42 1 47 48
M V30 43 1 48 49
M V30 44 1 49 50
M V30 45 2 50 51
M V30 46 1 47 52
M V30 47 1 48 53
M V30 48 1 48 54
M V30 49 1 49 55
M V30 50 1 49 56
M V30 51 1 50 57
M V30 52 2 4 27
M V30 53 2 11 30
M V30 54 2 14 37
M V30 55 2 19 40
M V30 56 2 22 47
M V30 END BOND
M V30 END CTAB
M END

$$$$
Loading

0 comments on commit f8c8434

Please sign in to comment.