Macrocycle

  1. Macrocycle

class Macrocycle(repeating_unit, num_repeating_units, orientations=None, random_seed=None, num_processes=1)

Bases: stk.molecular.topology_graphs.topology_graph.TopologyGraph

Represents a macrocycle topology graph.

The macrocycle can be represented as a linear polymer with the two end groups bonded to close the loop.

vertices

The vertices which make up the topology graph.

Type

tuple of Vertex

edges

The edges which make up the topology graph.

Type

tuple of Edge

Examples

import stk

macrocycle = stk.ConstructedMolecule(
    building_blocks=[
        stk.BuildingBlock('NCCN', ['amine']),
        stk.BuildingBlock('O=CCC=O', ['aldehyde'])
    ],
    topology_graph=stk.macrocycle.Macrocycle('AB', 5)
)

The repeating unit can also be specified through the indices of the building blocks

bb1 = stk.BuildingBlock('BrCCBr', ['bromine'])
bb2 = stk.BuildingBlock('BrCNCBr', ['bromine'])
bb3 = stk.BuildingBlock('BrCNNCBr', ['bromine'])

# c1 and c2 are different ways to write the same thing.
c1 = stk.ConstructedMolecule(
    building_blocks=[bb1, bb2, bb3],
    topology_graph=stk.macrocycle.Macrocycle('ACB', 3)
)
c2 = stk.ConstructedMolecule(
    building_blocks=[bb1, bb2, bb3],
    topology_graph=stk.macrocycle.Macrocycle((0, 2, 1), 3)
)

Macrocycle shares many parameters with Linear, and the examples described there are also valid for this class. Be sure to read them.

Methods

assign_building_blocks_to_vertices(self, …)

Assign building_blocks to vertices.

construct(self, mol)

Construct a ConstructedMolecule.

__init__(self, repeating_unit, num_repeating_units, orientations=None, random_seed=None, num_processes=1)

Initialize a Macrocycle instance.

Parameters
  • repeating_unit (str or tuple of int) –

    A string specifying the repeating unit of the macrocycle. For example, 'AB' or 'ABB'. The first building block passed to building_blocks is 'A' and so on.

    The repeating unit can also be specified by the indices of building_blocks, for example 'ABB' can be written as (0, 1, 1).

  • num_repeating_units (int) – The number of repeating units which are used to make the macrocycle.

  • orientations (tuple of float, optional) –

    For each character in the repeating unit, a value between 0 and 1 (both inclusive) must be given in a tuple. It indicates the probability that each monomer will have its orientation along the chain flipped. If 0 then the monomer is guaranteed not to flip. If 1 it is guaranteed to flip. This allows the user to create head-to-head or head-to-tail chains, as well as chain with a preference for head-to-head or head-to-tail if a number between 0 and 1 is chosen. If None then 0 is picked in every case.

    It is also possible to supply an orientation for every vertex in the final topology graph. In this case, the length of orientations must be equal to len(repeating_unit)*num_repeating_units.

  • random_seed (int, optional) – The random seed to use when choosing random orientations.

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

assign_building_blocks_to_vertices(self, building_blocks)

Assign building_blocks to vertices.

Parameters

building_blocks (list of Molecule) – The BuildingBlock and ConstructedMolecule 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 the ConstructedMolecule.

Returns

Maps the building_blocks, to the Vertex objects in vertices they are placed on during construction. The dict has the form

building_block_vertices = {
    BuildingBlock(...): [Vertex(...), Vertex(...)],
    BuildingBlock(...): [
        Vertex(...),
        Vertex(...),
        Vertex(...),
    ]
    ConstructedMolecule(...): [Vertex(...)]
}

Return type

dict

construct(self, mol)

Construct a ConstructedMolecule.

Parameters

mol (ConstructedMolecule) – The ConstructedMolecule instance which needs to be constructed.

Returns

None

Return type

NoneType