Macrocycle¶
-
class
Macrocycle(repeating_unit, num_repeating_units, orientations=None, random_seed=None, num_processes=1)¶ Bases:
stk.molecular.topology_graphs.topology_graph.TopologyGraphRepresents a macrocycle topology graph.
The macrocycle can be represented as a linear polymer with the two end groups bonded to close the loop.
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) )
Macrocycleshares many parameters withLinear, 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
Macrocycleinstance.- Parameters
repeating_unit (
strortupleofint) –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 (
tupleoffloat, optional) –For each character in the repeating unit, a value between
0and1(both inclusive) must be given in atuple. It indicates the probability that each monomer will have its orientation along the chain flipped. If0then the monomer is guaranteed not to flip. If1it 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 between0and1is chosen. IfNonethen0is 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 duringconstruct().
-
assign_building_blocks_to_vertices(self, building_blocks)¶ Assign building_blocks to
vertices.- Parameters
building_blocks (
listofMolecule) – TheBuildingBlockandConstructedMoleculeinstances 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 theConstructedMolecule.- Returns
Maps the building_blocks, to the
Vertexobjects inverticesthey are placed on during construction. Thedicthas the formbuilding_block_vertices = { BuildingBlock(...): [Vertex(...), Vertex(...)], BuildingBlock(...): [ Vertex(...), Vertex(...), Vertex(...), ] ConstructedMolecule(...): [Vertex(...)] }
- Return type
dict
-
construct(self, mol)¶ Construct a
ConstructedMolecule.- Parameters
mol (
ConstructedMolecule) – TheConstructedMoleculeinstance which needs to be constructed.- Returns
None
- Return type
NoneType
-