M4L4 Square

class M4L4Square(corners, linkers, vertex_alignments=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk.molecular.topology_graphs.topology_graph.optimizers.null.NullOptimizer object>)[source]

Bases: Cage

Represents a cage topology graph.

Unoptimized construction

MCHammer optimized construction

Both corner and linker vertices require building blocks with two functional groups for this topology. This class replaces the building_blocks parameter with the corner and linker parameters.

See Cage for more details and examples.

Methods

clone()

Return a clone.

construct()

Construct a ConstructedMolecule.

get_building_blocks()

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__(corners, linkers, vertex_alignments=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk.molecular.topology_graphs.topology_graph.optimizers.null.NullOptimizer object>)[source]

Initialize a M4L4Square.

Parameters:
  • corners (dict or BuildingBlock) –

    Can be a dict which maps the BuildingBlock instances to the ids of the vertices it should be placed on.

    Can also be a BuildingBlock instance, which should be placed on all corner vertices on the topology graph.

  • linkers (dict or BuildingBlock) –

    Can be a dict which maps the BuildingBlock instances to the ids of the vertices it should be placed on.

    Can also be a BuildingBlock instance, which should be placed on all linker vertices on the topology graph.

  • vertex_alignments (dict, optional) – A mapping from the id of a Vertex to an Edge connected to it. The Edge is used to align the first FunctionalGroup of a BuildingBlock placed on that vertex. Only vertices which need to have their default edge changed need to be present in the dict. If None then the default edge is used for each vertex. Changing which Edge is used will mean that the topology graph represents different structural isomers. The edge is referred to by a number between 0 (inclusive) and the number of edges the vertex is connected to (exclusive).

  • reaction_factory (ReactionFactory, optional) – The reaction factory to use for creating bonds between building blocks.

  • num_processes (int, optional) – The number of parallel processes to create during construct().

  • optimizer (Optimizer, optional) – Used to optimize the structure of the constructed molecule.

clone()

Return a clone.

Return type:

Cage

Returns:

The clone.

construct()

Construct a ConstructedMolecule.

Return type:

ConstructionResult

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:

Iterator[BuildingBlock]

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:

int

Returns:

The number of times building_block is present in the topology graph.

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.

Return type:

Cage

Returns:

The clone.