Rotaxane

  1. NRotaxane

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

Bases: stk.molecular.topology_graphs.topology_graph.TopologyGraph

Represents [n]rotaxane topology graphs.

This class assumes one axle with (n-1) macrocycles threaded on it. The macrocycles are spaced evenly along the thread in repeating patterns. The threaded macrocycles can be described analagously to monomers in linear polymers, in terms of a repeating unit, except that no bonds are formed between them.

The axle must be provided first to the building_blocks in ConstructedMolecule.__init__.

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

cycle = stk.ConstructedMolecule(
    building_blocks=[
        stk.BuildingBlock('[Br]CC[Br]', ['bromine'])
    ],
    topology_graph=stk.macrocycle.Macrocycle('A', 5)
)
axle = stk.ConstructedMolecule(
    building_blocks=[
        stk.BuildingBlock('NCCN', ['amine']),
        stk.BuildingBlock('O=CCC=O', ['aldehyde'])
    ],
    topology_graph=stk.polymer.Linear('AB', 7)
)
rotaxane = stk.ConstructedMolecule(
    building_blocks=[axle, cycle],
    topology_graph=stk.rotaxane.NRotaxane('A', 3)
)

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

# r1 and r2 are different ways to write the same thing.
r1 = stk.ConstructedMolecule(
    building_blocks=[axle, cycle, cycle2, cycle3],
    topology_graph=stk.rotaxane.NRotaxane('ACB', 3)
)
r2 = stk.ConstructedMolecule(
    building_blocks=[axle, cycle, cycle2, cycle3],
    topology_graph=stk.rotaxane.NRotaxane((1, 3, 2), 3)
)

NRotaxane 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 NRotaxane instance.

Parameters
  • repeating_unit (str or tuple of int) –

    A string specifying the repeating unit of the macrocycles. For example, 'AB' or 'ABB'. The first macrocycle 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 (1, 2, 2).

  • num_repeating_units (int) – The number of repeating units threaded along the axle.

  • 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 macrocycle will have its orientation along the axle flipped. If 0 then the macrocycle 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 defaults to 0 in every case.

    It is also possible to supply an orientation for every cycle 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