stk.polymer.Helix
- class stk.polymer.Helix(building_blocks, repeating_unit, num_repeating_units, half_rotations, mirror=False, orientations=None, random_seed=None, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk._internal.optimizers.null.NullOptimizer object>, scale_multiplier=1.0)[source]
Bases:
TopologyGraphRepresents a linear polymer topology graph with a helical geometry.
The model is developed from Polles et. al.
Examples
Construction
Much of the same functionality as the
stk.polymer.Linearpolymer graph is present. Helixes require building blocks with two functional groups.import stk bb1 = stk.BuildingBlock('Nc1cccc(N)c1', stk.PrimaryAminoFactory()) bb2 = stk.BuildingBlock('O=CC1=CC=CC=C1C=O', stk.AldehydeFactory()) polymer = stk.ConstructedMolecule( topology_graph=stk.polymer.Helix( building_blocks=[bb1, bb2], repeating_unit='AB', num_repeating_units=4, half_rotations=2, ), )
Increasing
half_rotationsresults in a tigher helix, also note the change in direction withmirror.import stk bb1 = stk.BuildingBlock('Nc1cccc(N)c1', stk.PrimaryAminoFactory()) bb2 = stk.BuildingBlock('O=CC1=CC=CC=C1C=O', stk.AldehydeFactory()) polymer = stk.ConstructedMolecule( topology_graph=stk.polymer.Helix( building_blocks=[bb1, bb2], repeating_unit='AB', num_repeating_units=4, half_rotations=4, mirror=True, ), )
Suggested Optimization
For
Helixtopologies, it is recommend to use theMCHammeroptimizer.import stk bb1 = stk.BuildingBlock('Nc1cccc(N)c1', stk.PrimaryAminoFactory()) bb2 = stk.BuildingBlock('O=CC1=CC=CC=C1C=O', stk.AldehydeFactory()) polymer = stk.ConstructedMolecule( topology_graph=stk.polymer.Helix( building_blocks=[bb1, bb2], repeating_unit='AB', num_repeating_units=4, half_rotations=2, optimizer=stk.MCHammer(), ), )
Construction with Capping Units
Building blocks with a single functional group can also be provided as capping units
import stk bb1 = stk.BuildingBlock('Nc1cccc(N)c1', stk.PrimaryAminoFactory()) bb2 = stk.BuildingBlock('O=CC1=CC=CC=C1C=O', stk.AldehydeFactory()) bb3 = stk.BuildingBlock('BrCCN', stk.PrimaryAminoFactory()) polymer = stk.ConstructedMolecule( topology_graph=stk.polymer.Helix( building_blocks=[bb1, bb2, bb3], repeating_unit='ABABC', num_repeating_units=1, half_rotations=2, ), )
- Parameters:
building_blocks (list[BuildingBlock]) – The building blocks of the polymer.
repeating_unit (str | list[int]) –
A string specifying the repeating unit of the polymer. 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 polymer.
half_rotations (int) – Number of rotations in the helix. The height of the helix is not impacted by this parameter, but comes from the size of the building blocks.
mirror (bool) –
Trueto form a - (counter-clockwise) twist, defaults toFalseor a + twist.For each character in the repeating unit, a value between
0and1(both inclusive). 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 all cases.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.If there is only one building block in the constructed polymer i.e. the repeating_unit has a length of 1 and num_repeating_units is 1, the building block will not be re-oriented, even if you provide a value to orientations.
random_seed (int | Generator | None) – The random seed to use when choosing random orientations.
reaction_factory (ReactionFactory) – The factory to use for creating reactions between functional groups of building blocks.
num_processes (int) – The number of parallel processes to create during
construct().optimizer (Optimizer) – Used to optimize the structure of the constructed molecule.
scale_multiplier (float) – Scales the positions of the vertices.
- Raises:
ValueError – If the length of orientations is not equal in length to repeating_unit or to the total number of vertices.
Methods
Return a clone.
Construct a
ConstructedMolecule.Yield the building blocks.
Get the number of times building_block is present.
Return a clone holding different building blocks.
- construct()
Construct a
ConstructedMolecule.- Returns:
The data describing the
ConstructedMolecule.- Return type:
- 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:
- 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:
- with_building_blocks(building_block_map)[source]
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.
- Returns:
The clone.
- Return type: