stk.cage.M24L48
- class stk.cage.M24L48(building_blocks, vertex_alignments=None, vertex_positions=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk._internal.optimizers.null.NullOptimizer object>, scale_multiplier=1.0)[source]
Bases:
Cage
Represents a cage topology graph.
Metal building blocks with four functional groups are required for this topology.
Ligand building blocks with two functional groups are required for this topology.
When using a
dict
for the building_blocks parameter, as in Examples: Multi-Building Block Cage Construction, aBuildingBlock
, with the following number of functional groups, needs to be assigned to each of the following vertex ids:4-functional groups: 0 to 232-functional groups: 24 to 71See
Cage
for more details and examples.- Parameters:
building_blocks (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 (dict[int, int] | None) – A mapping from the id of a
Vertex
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).vertex_positions (dict[int, ndarray] | None) – A mapping from the id of a
Vertex
to a customBuildingBlock
position. The default vertex alignment algorithm is still applied. Only vertices which need to have their default position changed need to be present in thedict
. Note that any vertices with modified positions will not be scaled like the rest of the building block positions and will not use neighbor placements in its positioning if requested by the default topology. IfNone
then the default placement algorithm is used for each vertex.reaction_factory (ReactionFactory) – The reaction factory to use for creating bonds between building blocks.
num_processes (int) – The number of parallel processes to create during
construct()
.optimizer (Optimizer) – Used to optimize the structure of the constructed molecule.
scale_multiplier (float) – Scales the positions of the vertices.
- 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.
Methods
Return a clone.
Construct a
ConstructedMolecule
.Yield the building blocks.
Get the number of times building_block is present.
Get the vertex alignments.
Return a clone holding different building blocks.
- construct()
Construct a
ConstructedMolecule
.- Returns:
The data describing the
ConstructedMolecule
.- Return type:
- 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.
- Returns:
The number of times building_block is present in the topology graph.
- Return type:
- get_vertex_alignments()
Get the vertex alignments.
- with_building_blocks(building_block_map)
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.
- Returns:
The clone.
- Return type: