Honeycomb

class Honeycomb(building_blocks, lattice_size, periodic=False, vertex_alignments=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk.molecular.topology_graphs.topology_graph.optimizers.null.NullOptimizer object>)[source]

Bases: stk.molecular.topology_graphs.cof.cof.Cof

Represents a honeycomb COF topology graph.

Unoptimized construction

Collapser(scale_steps=False) optimized construction

Building blocks with three and two functional groups are required for this topology graph.

When using a dict for the building_blocks parameter, as in Examples: Multi-Building Block COF Construction, a BuildingBlock, with the following number of functional groups, needs to be assigned to each of the following vertex ids:

3-functional groups: 0 to 1
2-functional groups: 2 to 4

See Cof 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__(building_blocks, lattice_size, periodic=False, vertex_alignments=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk.molecular.topology_graphs.topology_graph.optimizers.null.NullOptimizer object>)

Initialize a Cof instance.

Parameters
  • building_blocks (tuple or dict) –

    Can be a tuple of BuildingBlock instances, which should be placed on the topology graph.

    Can also be a dict which maps the BuildingBlock instances to the ids of the vertices it should be placed on. A dict is required when there are multiple building blocks with the same number of functional groups, because in this case the desired placement is ambiguous.

  • lattice_size (tuple of int) – The size of the lattice in the x, y and z directions.

  • periodic (bool, optional) – Toggle the construction of a periodic molecule. If True, periodic bonds will be made across the edges of the lattice.

  • 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.

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 COF topology graph does not have a building block placed on it.

  • OverlyOccupiedVertexError – If a vertex of the COF topology graph has more than one building block placed on it.

clone()

Return a clone.

Returns

The clone. Has the same type as the original topology graph.

Return type

TopologyGraph

construct()

Construct a ConstructedMolecule.

Returns

The data describing the ConstructedMolecule.

Return type

PeriodicConstructionResult

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

BuildingBlock – A building block of the topology graph.

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

int

with_building_blocks(building_block_map)

Return a clone holding different building blocks.

Parameters

building_block_map (dict) – 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. Has the same type as the original topology graph.

Return type

TopologyGraph