Cage
Organic
- One Plus One
OnePlusOne
OnePlusOneVertex
OnePlusOneVertex.__init__()
OnePlusOneVertex.clone()
OnePlusOneVertex.get_aligner_edge()
OnePlusOneVertex.get_cell()
OnePlusOneVertex.get_id()
OnePlusOneVertex.get_position()
OnePlusOneVertex.init_at_center()
OnePlusOneVertex.map_functional_groups_to_edges()
OnePlusOneVertex.place_building_block()
OnePlusOneVertex.use_neighbor_placement()
OnePlusOneVertex.with_aligner_edge()
OnePlusOneVertex.with_position()
OnePlusOneVertex.with_scale()
- Two Plus Two
TwoPlusTwo
- Two Plus Three
TwoPlusThree
- Two Plus Four
TwoPlusFour
- Three Plus Six
ThreePlusSix
- Four Plus Four
FourPlusFour
- Four Plus Six
FourPlusSix
- Four Plus Six 2
FourPlusSix2
- Four Plus Eight
FourPlusEight
- Five Plus Ten
FivePlusTen
- Six Plus Eight
SixPlusEight
- Six Plus Nine
SixPlusNine
- Six Plus Twelve
SixPlusTwelve
- Eight Plus Twelve
EightPlusTwelve
- Eight Plus Sixteen
EightPlusSixteen
- Ten Plus Twenty
TenPlusTwenty
- Twelve Plus Thirty
TwelvePlusThirty
- Twenty Plus Thirty
TwentyPlusThirty
Metal-Organic
- M2L4 Lantern
M2L4Lantern
- M3L3 Triangle
M3L3Triangle
- M3L6
M3L6
- M4L4 Square
M4L4Square
- M4L4 Tetrahedron
M4L4Tetrahedron
- M4L6 Tetrahedron with Spacer
M4L6TetrahedronSpacer
- M4L6 Tetrahedron
M4L6Tetrahedron
- M4L8
M4L8
- M6L2L3 Prism
M6L2L3Prism
- M6L12 Cube
M6L12Cube
- M8L6 Cube
M8L6Cube
- M12L24
M12L24
- M24L48
M24L48
- class Cage(building_blocks, vertex_alignments=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk.molecular.topology_graphs.topology_graph.optimizers.null.NullOptimizer object>)[source]
Bases:
TopologyGraph
Represents a cage topology graph.
Notes
Cage topologies are added by creating a subclass, which defines the
_vertex_prototypes
and_edge_prototypes
class attributes.Examples
Subclass Implementation
The source code of the subclasses, listed in
cage
, can serve as good examples.Basic Construction
Cage
instances can be made by providing the building block molecules only (usingFourPlusSix
as an example)import stk bb1 = stk.BuildingBlock( smiles='NCCN', functional_groups=[stk.PrimaryAminoFactory()], ) bb2 = stk.BuildingBlock( smiles='O=CC(C=O)C=O', functional_groups=[stk.AldehydeFactory()], ) cage = stk.ConstructedMolecule( topology_graph=stk.cage.FourPlusSix((bb1, bb2)), )
Suggested Optimization
For
Cage
topologies, it is recommend to use theMCHammer
optimizer. However, for cages formed from highly unsymmetrical building blocks, it is recommend to use the simplifiedCollapser
optimizer.import stk bb1 = stk.BuildingBlock( smiles='NCCN', functional_groups=[stk.PrimaryAminoFactory()], ) bb2 = stk.BuildingBlock( smiles='O=CC(C=O)C=O', functional_groups=[stk.AldehydeFactory()], ) cage = stk.ConstructedMolecule( topology_graph=stk.cage.FourPlusSix( building_blocks=(bb1, bb2), optimizer=stk.MCHammer(), ), )
Structural Isomer Construction
Different structural isomers of cages can be made by using the vertex_alignments optional parameter
import stk bb1 = stk.BuildingBlock( smiles='NCCN', functional_groups=[stk.PrimaryAminoFactory()], ) bb2 = stk.BuildingBlock( smiles='O=CC(C=O)C=O', functional_groups=[stk.AldehydeFactory()], ) cage = stk.ConstructedMolecule( topology_graph=stk.cage.FourPlusSix( building_blocks=(bb1, bb2), vertex_alignments={0: 1, 1: 1, 2: 2}, ), )
The parameter maps the id of a vertex to a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive). So a vertex connected to three edges can be mapped to
0
,1
or2
.By changing which edge each vertex is aligned with, a different structural isomer of the cage can be formed.
Multi-Building Block Cage Construction
You can also build cages with multiple building blocks, but, if you have multiple building blocks with the same number of functional groups, you have to assign each building block to the vertex you want to place it on
import stk bb1 = stk.BuildingBlock( smiles='O=CC(C=O)C=O', functional_groups=[stk.AldehydeFactory()], ) bb2 = stk.BuildingBlock( smiles='O=CC(Cl)(C=O)C=O', functional_groups=[stk.AldehydeFactory()], ) bb3 = stk.BuildingBlock( smiles='NCCN', functional_groups=[stk.PrimaryAminoFactory()], ) bb4 = stk.BuildingBlock( smiles='NCC(Cl)N', functional_groups=[stk.PrimaryAminoFactory()], ) bb5 = stk.BuildingBlock( smiles='NCCCCN', functional_groups=[stk.PrimaryAminoFactory()], ) cage1 = stk.ConstructedMolecule( topology_graph=stk.cage.FourPlusSix( building_blocks={ bb1: range(2), bb2: (2, 3), bb3: 4, bb4: 5, bb5: range(6, 10), }, ), )
You can combine this with the vertex_alignments parameter
cage2 = stk.ConstructedMolecule( topology_graph=stk.cage.FourPlusSix( building_blocks={ bb1: range(2), bb2: (2, 3), bb3: 4, bb4: 5, bb5: range(6, 10), }, vertex_alignments={5: 1}, ), )
Metal-Organic Cage Construction
A series of common metal-organic cage topologies are provided and can be constructed in the same way as other
Cage
instances using metal atoms andDativeReactionFactory
instances to produce metal-ligand bonds. Each metal topology has specific vertices reserved for the metal atoms or complexes, which are listed in their documentation.import stk # Produce a Pd+2 atom with 4 functional groups. palladium_atom = stk.BuildingBlock( smiles='[Pd+2]', functional_groups=( stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4) ), position_matrix=[[0., 0., 0.]], ) # Build a building block with two functional groups using # the SmartsFunctionalGroupFactory. bb1 = stk.BuildingBlock( smiles=( 'C1=NC=CC(C2=CC=CC(C3=C' 'C=NC=C3)=C2)=C1' ), functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#7X2]~[#6]', bonders=(1, ), deleters=(), ), ], ) cage1 = stk.ConstructedMolecule( stk.cage.M2L4Lantern( building_blocks=(palladium_atom, bb1), # Ensure that bonds between the # GenericFunctionalGroups of the ligand and the # SingleAtom functional groups of the metal are # dative. reaction_factory=stk.DativeReactionFactory( stk.GenericReactionFactory( bond_orders={ frozenset({ stk.GenericFunctionalGroup, stk.SingleAtom, }): 9, }, ), ), ), )
Controlling Metal-Complex Stereochemistry
When building metal-organic cages from octahedral metals, i.e. Fe(II), the stereochemistry of the metal centre can be important. Maintaining that stereochemistry around specific metal centres during
Cage
construction is difficult, so an alternative route to these types of structures can be taken. Firstly, you would construct aMetalComplex
instance with the appropriate stereochemistry and dummy reactive groups (bromine in the following example)import stk # Produce a Fe+2 atom with 6 functional groups. iron_atom = stk.BuildingBlock( smiles='[Fe+2]', functional_groups=( stk.SingleAtom(stk.Fe(0, charge=2)) for i in range(6) ), position_matrix=[[0, 0, 0]], ) # Define coordinating ligand with dummy bromine groups and # metal coordinating functional groups. bb2 = stk.BuildingBlock( smiles='C1=NC(C=NBr)=CC=C1', functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#7X2]~[#35]', bonders=(1, ), deleters=(), ), stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#7X2]~[#6]', bonders=(1, ), deleters=(), ), ], ) # Build iron complex with delta stereochemistry. iron_oct_delta = stk.ConstructedMolecule( topology_graph=stk.metal_complex.OctahedralDelta( metals=iron_atom, ligands=bb2, ), )
Then the metal complexes can be placed on the appropriate
Cage
topology to produce a structure with the desired stereochemistry at all metal centres.# Assign Bromo functional groups to the metal complex. iron_oct_delta = stk.BuildingBlock.init_from_molecule( molecule=iron_oct_delta, functional_groups=[stk.BromoFactory()], ) # Define spacer building block. bb3 = stk.BuildingBlock( smiles=( 'C1=CC(C2=CC=C(Br)C=C2)=C' 'C=C1Br' ), functional_groups=[stk.BromoFactory()], ) # Build an M4L6 Tetrahedron with a spacer. cage2 = stk.ConstructedMolecule( topology_graph=stk.cage.M4L6TetrahedronSpacer( building_blocks=( iron_oct_delta, bb3, ), ), )
Aligning Metal Complex Building Blocks
When building metal-organic cages from metal complex building blocks, it is common that the metal complex
BuildingBlock
will have multiple functional groups, but that those functional groups are overlapping. This means that some of its atoms appear in multiple functional groups. A difficulty arises when the atom shared between the functional groups is a placer atom.Placer atoms are used to align building blocks, so that they have an appropriate orientation in the final topology. If there is only one placer atom, no alignment can be made, as no vector running between placer atoms can be defined, and used for the alignment of the
BuildingBlock
.By default,
stk
may create overlapping functional groups, which may lead to a lack of an appropriate number of placer atoms, leading to aBuildingBlock
being unaligned. However, the user can manually set the placer atoms of functional groups, so that not all of the placer atoms appear in multiple functional groups, which leads to proper alignment.First we build a metal complex
import stk metal_atom = stk.BuildingBlock( smiles='[Pd+2]', functional_groups=( stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4) ), position_matrix=[[0., 0., 0.]], ) ligand = stk.BuildingBlock( smiles='NCCN', functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[#7]~[#6]', bonders=(0, ), deleters=(), ), ], ) metal_complex = stk.ConstructedMolecule( topology_graph=stk.metal_complex.CisProtectedSquarePlanar( metals=metal_atom, ligands=ligand, ), )
Next, we convert the metal complex into a
BuildingBlock
, taking care to define functional groups which do not have overlapping placer atomsmetal_complex = stk.BuildingBlock.init_from_molecule( molecule=metal_complex, functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[Pd]~[#7]', bonders=(0, ), deleters=(), # The nitrogen atom will be different # for each functional group. placers=(0, 1), ), ], )
We load in the organic linker of the cage as normal
linker = stk.BuildingBlock( smiles='C1=NC=CC(C2=CC=NC=C2)=C1', functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#7X2]~[#6]', bonders=(1, ), deleters=(), ), ], )
And finally, we build the cage with a
DativeReactionFactory
instance to produce dative bonds.cage = stk.ConstructedMolecule( topology_graph=stk.cage.M4L4Square( corners=metal_complex, linkers=linker, reaction_factory=stk.DativeReactionFactory( stk.GenericReactionFactory( bond_orders={ frozenset({ stk.GenericFunctionalGroup, stk.GenericFunctionalGroup, }): 9, }, ), ), ), )
Methods
clone
()Return a clone.
Construct a
ConstructedMolecule
.Yield the building blocks.
get_num_building_block
(building_block)Get the number of times building_block is present.
with_building_blocks
(building_block_map)Return a clone holding different building blocks.
- __init__(building_blocks, vertex_alignments=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk.molecular.topology_graphs.topology_graph.optimizers.null.NullOptimizer object>)[source]
Initialize a
Cage
.- Parameters:
building_blocks (
Union
[Iterable
[BuildingBlock
],dict
[BuildingBlock
,tuple
[int
,...
]]]) –Can be a
iterable
ofBuildingBlock
instances, which should be placed on the topology graph.Can also be a
dict
which maps theBuildingBlock
instances to the ids of the vertices it should be placed on. Adict
is required when there are multiple building blocks with the same number of functional groups, because in this case the desired placement is ambiguous.vertex_alignments (
Optional
[dict
[int
,int
]]) – A mapping from the id of aVertex
to anEdge
connected to it. TheEdge
is used to align the firstFunctionalGroup
of aBuildingBlock
placed on that vertex. Only vertices which need to have their default edge changed need to be present in thedict
. IfNone
then the default edge is used for each vertex. Changing whichEdge
is used will mean that the topology graph represents different structural isomers. The edge is referred to by a number between0
(inclusive) and the number of edges the vertex is connected to (exclusive).reaction_factory (
ReactionFactory
) – The reaction factory to use for creating bonds between building blocks.num_processes (
int
) – The number of parallel processes to create duringconstruct()
.optimizer (
Optimizer
) – Used to optimize the structure of the constructed molecule.
- Raises:
AssertionError – If the any building block does not have a valid number of functional groups.
ValueError – If the there are multiple building blocks with the same number of functional_groups in building_blocks, and they are not explicitly assigned to vertices. The desired placement of building blocks is ambiguous in this case.
UnoccupiedVertexError – If a vertex of the cage topology graph does not have a building block placed on it.
OverlyOccupiedVertexError – If a vertex of the cage topology graph has more than one building block placed on it.
- construct()
Construct a
ConstructedMolecule
.- Return type:
- Returns:
The data describing the
ConstructedMolecule
.
- get_building_blocks()
Yield the building blocks.
Building blocks are yielded in an order based on their position in the topology graph. For two equivalent topology graphs, but with different building blocks, equivalently positioned building blocks will be yielded at the same time.
- Yields:
A building block of the topology graph.
- Return type:
- get_num_building_block(building_block)
Get the number of times building_block is present.
- Parameters:
building_block (
BuildingBlock
) – The building block whose frequency in the topology graph is desired.- Return type:
- Returns:
The number of times building_block is present in the topology graph.
- with_building_blocks(building_block_map)[source]
Return a clone holding different building blocks.
- Parameters:
building_block_map (
dict
[BuildingBlock
,BuildingBlock
]) – Maps a building block in the current topology graph to the building block which should replace it in the clone. If a building block should be not replaced in the clone, it can be omitted from the map.- Return type:
- Returns:
The clone.