-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from andrewtarzia/main
Implement unreacted graph and example.
- Loading branch information
Showing
29 changed files
with
1,314 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ dependencies: | |
- pip | ||
- rdkit==2024.3.4 | ||
- espaloma_charge | ||
- mdanalysis | ||
- openbabel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,67 @@ | ||
Molecular | ||
========= | ||
|
||
Atoms, Functional Groups and Molecules | ||
-------------------------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
PositionedAtom <_autosummary/stko.PositionedAtom> | ||
dummy atom (Du) <_autosummary/stko.Du> | ||
MDAnalysis <_autosummary/stko.MDAnalysis> | ||
ZMatrix <_autosummary/stko.ZMatrix> | ||
MoleculeSplitter <_autosummary/stko.MoleculeSplitter> | ||
MoleculeTransformer <_autosummary/stko.MoleculeTransformer> | ||
Network <_autosummary/stko.Network> | ||
Dummy atom (Du) <_autosummary/stko.Du> | ||
UnitCell <_autosummary/stko.UnitCell> | ||
TopologyExtractor <_autosummary/stko.TopologyExtractor> | ||
TopologyInfo <_autosummary/stko.TopologyInfo> | ||
Torsion <_autosummary/stko.Torsion> | ||
TorsionInfo <_autosummary/stko.TorsionInfo> | ||
ThreeSiteFG <_autosummary/stko.functional_groups.ThreeSiteFG> | ||
ThreeSiteFactory <_autosummary/stko.functional_groups.ThreeSiteFactory> | ||
|
||
|
||
Molecular Analysis | ||
------------------ | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
MoleculeSplitter <_autosummary/stko.MoleculeSplitter> | ||
MoleculeTransformer <_autosummary/stko.MoleculeTransformer> | ||
DecomposeMOC <_autosummary/stko.molecule_analysis.DecomposeMOC> | ||
DitopicThreeSiteAnalyser <_autosummary/stko.molecule_analysis.DitopicThreeSiteAnalyser> | ||
ConstructedAnalyser <_autosummary/stko.molecule_analysis.ConstructedAnalyser> | ||
|
||
|
||
Subgroup Analysis | ||
----------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
Subgroup <_autosummary/stko.molecule_analysis.Subgroup> | ||
SubgroupAnalyser <_autosummary/stko.molecule_analysis.SubgroupAnalyser> | ||
AlkyneAngle <_autosummary/stko.molecule_analysis.AlkyneAngle> | ||
X5Planarity <_autosummary/stko.molecule_analysis.X5Planarity> | ||
C5N1Planarity <_autosummary/stko.molecule_analysis.C5N1Planarity> | ||
C6Planarity <_autosummary/stko.molecule_analysis.C6Planarity> | ||
Subgroup <_autosummary/stko.molecule_analysis.Subgroup> | ||
SubgroupAnalyser <_autosummary/stko.molecule_analysis.SubgroupAnalyser> | ||
|
||
|
||
Manipulating Topology Graphs | ||
---------------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
TopologyExtractor <_autosummary/stko.TopologyExtractor> | ||
TopologyInfo <_autosummary/stko.TopologyInfo> | ||
UnreactedToplogyGraph <_autosummary/stko.topology_functions.UnreactedTopologyGraph> | ||
NamedIntermediate <_autosummary/stko.topology_functions.NamedIntermediate> | ||
IntermediatePool <_autosummary/stko.topology_functions.IntermediatePool> | ||
|
||
|
||
Conversion | ||
---------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
MDAnalysis <_autosummary/stko.MDAnalysis> | ||
ZMatrix <_autosummary/stko.ZMatrix> | ||
Network <_autosummary/stko.Network> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import logging | ||
from pathlib import Path | ||
|
||
import stk | ||
|
||
import stko | ||
|
||
|
||
def main() -> None: | ||
"""Run the example.""" | ||
# Two building blocks you want to react to form a topology graph. | ||
bb1 = stk.BuildingBlock( | ||
smiles="NCCN", functional_groups=(stk.PrimaryAminoFactory(),) | ||
) | ||
bb2 = stk.BuildingBlock( | ||
smiles="O=CC(C=O)C=O", functional_groups=(stk.AldehydeFactory(),) | ||
) | ||
|
||
examples_output = Path("out_intermediates") | ||
examples_output.mkdir(parents=True, exist_ok=True) | ||
|
||
# Produce a `TopologyGraph` without doing any reactions. | ||
cage_graphs = stko.topology_functions.UnreactedTopologyGraph( | ||
stk.cage.FourPlusSix((bb1, bb2)) | ||
) | ||
logging.info( | ||
"there are %s possible reactions", | ||
len(cage_graphs.get_available_reactions()), | ||
) | ||
|
||
# With up to N reactions performed. | ||
intermediate_pool = cage_graphs.get_named_intermediates(n=4) | ||
logging.info( | ||
"there are %s structures with n=%s", len(intermediate_pool), 4 | ||
) | ||
for named_intermediate in intermediate_pool.intermediates: | ||
named_intermediate.molecule.write( | ||
examples_output / f"{named_intermediate.intermediate_name}.mol" | ||
) | ||
|
||
# Now iterate over all possible reactions with varying amounts of | ||
# completeness and get their smiles. | ||
all_possible_smiles = cage_graphs.get_reacted_smiles() | ||
logging.info("there are %s unique smiles", len(all_possible_smiles)) | ||
|
||
|
||
if __name__ == "__main__": | ||
logging.basicConfig( | ||
level=logging.INFO, | ||
format="%(asctime)s | %(levelname)s | %(message)s", | ||
) | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
RDKit 3D | ||
|
||
0 0 0 0 0 0 0 0 0 0999 V3000 | ||
M V30 BEGIN CTAB | ||
M V30 COUNTS 45 44 0 0 0 | ||
M V30 BEGIN ATOM | ||
M V30 1 C -1.2134 -0.7006 7.6921 0 | ||
M V30 2 C 0.0024 0.0195 8.1532 0 | ||
M V30 3 C 1.2289 -0.7128 7.6921 0 | ||
M V30 4 C -0.0155 1.4134 7.6921 0 | ||
M V30 5 O -0.9554 1.8112 7.0270 0 | ||
M V30 6 H -1.4106 -0.8660 6.6467 0 | ||
M V30 7 H 0.0228 0.0328 9.2640 0 | ||
M V30 8 H 1.3779 -0.8508 6.6158 0 | ||
M V30 9 H 0.7696 2.1271 7.9093 0 | ||
M V30 10 C -6.6851 -3.8596 -1.2430 0 | ||
M V30 11 C -6.6459 -3.8550 -2.7289 0 | ||
M V30 12 C -6.6921 -2.4414 -3.2314 0 | ||
M V30 13 O -7.5962 -2.0548 -3.9611 0 | ||
M V30 14 C -5.4646 -4.5773 -3.2177 0 | ||
M V30 15 O -4.6918 -5.0716 -2.4160 0 | ||
M V30 16 H -5.9270 -3.3704 -0.6555 0 | ||
M V30 17 H -7.5451 -4.3758 -3.1221 0 | ||
M V30 18 H -5.8930 -1.7560 -2.9293 0 | ||
M V30 19 H -5.2299 -4.7022 -4.2675 0 | ||
M V30 20 C 6.6851 -3.8596 -1.2430 0 | ||
M V30 21 C 6.6615 -3.8280 -2.7289 0 | ||
M V30 22 C 5.4604 -4.5748 -3.2314 0 | ||
M V30 23 O 5.5776 -5.5511 -3.9611 0 | ||
M V30 24 C 6.6963 -2.4438 -3.2177 0 | ||
M V30 25 O 6.7381 -1.5274 -2.4160 0 | ||
M V30 26 H 5.8824 -3.4478 -0.6555 0 | ||
M V30 27 H 7.5621 -4.3463 -3.1221 0 | ||
M V30 28 H 4.4673 -4.2255 -2.9293 0 | ||
M V30 29 H 6.6872 -2.1781 -4.2675 0 | ||
M V30 30 N -3.2178 -1.8578 4.4191 0 | ||
M V30 31 C -4.6051 -2.2313 4.4421 0 | ||
M V30 32 C -4.9290 -3.2079 3.3152 0 | ||
M V30 33 N -4.6808 -2.7024 2.0300 0 | ||
M V30 34 H -5.2477 -1.3300 4.3651 0 | ||
M V30 35 H -4.7784 -2.7831 5.3911 0 | ||
M V30 36 H -4.2388 -4.0831 3.4884 0 | ||
M V30 37 H -5.9702 -3.5517 3.4212 0 | ||
M V30 38 N 3.2255 -1.8639 4.4191 0 | ||
M V30 39 C 4.2425 -2.8787 4.4421 0 | ||
M V30 40 C 5.2503 -2.6710 3.3153 0 | ||
M V30 41 N 4.6885 -2.7085 2.0300 0 | ||
M V30 42 H 3.7830 -3.8858 4.3649 0 | ||
M V30 43 H 4.8069 -2.7532 5.3911 0 | ||
M V30 44 H 5.6634 -1.6358 3.4886 0 | ||
M V30 45 H 6.0684 -3.4011 3.4212 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 2 4 | ||
M V30 4 2 4 5 | ||
M V30 5 1 1 6 | ||
M V30 6 1 2 7 | ||
M V30 7 1 3 8 | ||
M V30 8 1 4 9 | ||
M V30 9 1 10 11 | ||
M V30 10 1 11 12 | ||
M V30 11 2 12 13 | ||
M V30 12 1 11 14 | ||
M V30 13 2 14 15 | ||
M V30 14 1 10 16 | ||
M V30 15 1 11 17 | ||
M V30 16 1 12 18 | ||
M V30 17 1 14 19 | ||
M V30 18 1 20 21 | ||
M V30 19 1 21 22 | ||
M V30 20 2 22 23 | ||
M V30 21 1 21 24 | ||
M V30 22 2 24 25 | ||
M V30 23 1 20 26 | ||
M V30 24 1 21 27 | ||
M V30 25 1 22 28 | ||
M V30 26 1 24 29 | ||
M V30 27 1 30 31 | ||
M V30 28 1 31 32 | ||
M V30 29 1 32 33 | ||
M V30 30 1 31 34 | ||
M V30 31 1 31 35 | ||
M V30 32 1 32 36 | ||
M V30 33 1 32 37 | ||
M V30 34 1 38 39 | ||
M V30 35 1 39 40 | ||
M V30 36 1 40 41 | ||
M V30 37 1 39 42 | ||
M V30 38 1 39 43 | ||
M V30 39 1 40 44 | ||
M V30 40 1 40 45 | ||
M V30 41 2 1 30 | ||
M V30 42 2 10 33 | ||
M V30 43 2 3 38 | ||
M V30 44 2 20 41 | ||
M V30 END BOND | ||
M V30 END CTAB | ||
M END | ||
|
||
$$$$ |
Oops, something went wrong.