Organic Cage¶
For usage examples see Cage
.
-
class
Cage
(vertex_alignments=None, num_processes=1)¶ Bases:
stk.molecular.topology_graphs.topology_graph.TopologyGraph
Represents a cage topology graph.
Cage topologies are added by creating a subclass which defines the
vertex_data
andedge_data
class attributes.A
Cage
subclass will add the attributesnum_windows
andnum_window_types
to eachConstructedMolecule
.-
vertex_data
¶ A class attribute. Holds the data of the vertices which make up the topology graph.
- Type
tuple
ofVertexData
-
edge_data
¶ A class attribute. Holds the data of the edges which make up the topology graph.
- Type
tuple
ofEdgeData
Examples
Cage
instances can be made without supplying additional arguments (usingFourPlusSix
as an example)import stk bb1 = stk.BuildingBlock('NCCN', ['amine']) bb2 = stk.BuildingBlock('O=CC(C=O)C=O', ['aldehyde']) cage1 = stk.ConstructedMolecule( building_blocks=[bb1, bb2], topology_graph=stk.cage.FourPlusSix() )
Different structural isomers of cages can be made by using the vertex_alignments optional parameter
tetrahedron = stk.cage.FourPlusSix( vertex_alignments={0: 1, 1: 1, 2: 2} ) cage2 = stk.ConstructedMolecule( building_blocks=[bb1, bb2], topology_graph=tetrahedron )
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 to0
,1
or2
.By changing which edge each vertex is aligned with, a different structural isomer of the cage can be formed.
You can also build cages with multiple building blocks, but you have to assign each building block to a vertex with building_block_vertices.
bb1 = stk.BuildingBlock(‘O=CC(C=O)C=O’, [‘aldehyde’]) bb2 = stk.BuildingBlock(‘O=CC(Cl)(C=O)C=O’, [‘aldehyde’]) bb3 = stk.BuildingBlock(‘NCCN’, [‘amine’]) bb4 = stk.BuildingBlock(‘NCC(Cl)N’, [‘amine’]) bb5 = stk.BuildingBlock(‘NCCCCN’, [‘amine’])
tetrahedron = stk.cage.FourPlusSix() cage = stk.ConstructedMolecule(
building_blocks=[bb1, bb2, bb3, bb4, bb5], topology_graph=tetrahedron, building_block_vertices={
bb1: tetrahedron.vertices[:2], bb2: tetrahedron.vertices[2:4], bb3: tetrahedron.vertices[4:5], bb4: tetrahedron.vertices[5:6], bb5: tetrahedron.vertices[6:]
}
)
Methods
assign_building_blocks_to_vertices
(self, …)Assign building_blocks to
vertices
.construct
(self, mol)Construct a
ConstructedMolecule
.-
__init__
(self, vertex_alignments=None, num_processes=1)¶ Initialize a
Cage
.- Parameters
vertex_alignments (
dict
, optional) – A mapping from theVertex.id
of aVertex
vertices
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 refered to by a number between0
(inclusive) and the number of edges the vertex is connected to (exclusive).num_processes (
int
, optional) – The number of parallel processes to create duringconstruct()
.
-
assign_building_blocks_to_vertices
(self, building_blocks)¶ Assign building_blocks to
vertices
.- Parameters
building_blocks (
list
ofMolecule
) – TheBuildingBlock
andConstructedMolecule
instances which represent the building block molecules used for construction. Only one instance is present per building block molecule, even if multiples of that building block join up to form theConstructedMolecule
.- Returns
Maps the building_blocks, to the
Vertex
objects invertices
they are placed on during construction. Thedict
has the formbuilding_block_vertices = { BuildingBlock(...): [Vertex(...), Vertex(...)], BuildingBlock(...): [ Vertex(...), Vertex(...), Vertex(...), ] ConstructedMolecule(...): [Vertex(...)] }
- Return type
dict
- Raises
ValueError – If there is more than one building with a given number of functional groups.
-
construct
(self, mol)¶ Construct a
ConstructedMolecule
.- Parameters
mol (
ConstructedMolecule
) – TheConstructedMolecule
instance which needs to be constructed.- Returns
None
- Return type
NoneType
-