stk.small.NCore

class stk.small.NCore(core_building_block, arm_building_blocks, repeating_unit, reaction_factory=GenericReactionFactory(), num_processes=1, optimizer=<stk._internal.optimizers.null.NullOptimizer object>, scale_multiplier=1.0)[source]

Bases: TopologyGraph

Represents a core reacting with N arms topology graph.

The core building block, with N functional groups, defines the behaviour of this topology graph. The arm building blocks, which must have only one functional group, are oriented in a circle around the core based on N and the repeating units. The core is oriented into the XY plane.

Examples

Construction

The number of functional groups in the core building block define the topology graph

import stk

core1 = stk.BuildingBlock(
    smiles="C(Br)1C(Br)C1Br",
    functional_groups=stk.BromoFactory(),
)
arm = stk.BuildingBlock(
    smiles="BrC",
    functional_groups=stk.BromoFactory(),
)

ncore = stk.ConstructedMolecule(stk.small.NCore(
    core_building_block=core1,
    arm_building_blocks=arm,
    repeating_unit="A",  # 'AAA' would work too.
))
import stk

core2 = stk.BuildingBlock(
    smiles="C(Br)1C(Br)C(Br)C(Br)C(Br)C(Br)C1Br",
    functional_groups=stk.BromoFactory(),
)
arm = stk.BuildingBlock(
    smiles="BrC",
    functional_groups=stk.BromoFactory(),
)

ncore = stk.ConstructedMolecule(stk.small.NCore(
    core_building_block=core2,
    arm_building_blocks=arm,
    repeating_unit="A",  # 'AAAAAAA' would work too.
))

Suggested Optimization

For NCore topologies, it is recommend to use the MCHammer optimizer.

import stk

arm = stk.BuildingBlock(
    smiles="BrC",
    functional_groups=stk.BromoFactory(),
)
core2 = stk.BuildingBlock(
    smiles="C(Br)1C(Br)C(Br)C(Br)C(Br)C(Br)C1Br",
    functional_groups=stk.BromoFactory(),
)

ncore = stk.ConstructedMolecule(
    stk.small.NCore(
        core_building_block=core2,
        arm_building_blocks=arm,
        repeating_unit="A",
        optimizer=stk.MCHammer(),
    )
)

Construction with Distinct Arms

Any combination of arm building blocks can be provided.

import stk

core = stk.BuildingBlock(
    smiles="C(Br)1C(Br)C(Br)C(Br)C(Br)C(Br)C1Br",
    functional_groups=stk.BromoFactory(),
)
arm1 = stk.BuildingBlock(
    smiles="BrC",
    functional_groups=stk.BromoFactory(),
)
arm2 = stk.BuildingBlock(
    smiles="BrCN",
    functional_groups=stk.BromoFactory(),
)

ncore = stk.ConstructedMolecule(
    stk.small.NCore(
        core_building_block=core,
        arm_building_blocks=[arm1, arm2],
        repeating_unit="ABABABA",
    )
)

Just be cautious of the repeating unit term, which must match the available functional groups in the core. Units that are a subset of available functional groups will be repeated.

import stk

core = stk.BuildingBlock(
    smiles="C(Br)1C(Br)C(Br)C(Br)C(Br)C1Br",
    functional_groups=stk.BromoFactory(),
)
arm1 = stk.BuildingBlock(
    smiles="BrC",
    functional_groups=stk.BromoFactory(),
)
arm2 = stk.BuildingBlock(
    smiles="BrCN",
    functional_groups=stk.BromoFactory(),
)

ncore = stk.ConstructedMolecule(
    stk.small.NCore(
        core_building_block=core,
        arm_building_blocks=[arm1, arm2],
        repeating_unit="ABA",  # Same as 'ABAABA'.
    )
)
Parameters:
  • core_building_block (BuildingBlock) – The central building block.

  • arm_building_blocks (BuildingBlock | list[BuildingBlock]) – The building blocks to react with the core.

  • repeating_unit (str | list[int]) –

    A string specifying the repeating unit of the arms. For example, 'AB' or 'ABB'. The first building block passed to arm_building_blocks is 'A' and so on. The repeating unit must fit evenly onto the core_building_block, defined by the number of functional groups the core has.

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

  • 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

clone

Return a clone.

construct

Construct a ConstructedMolecule.

get_building_blocks

Yield the building blocks.

get_num_building_block

Get the number of times building_block is present.

with_building_blocks

Return a clone holding different building blocks.

clone()[source]

Return a clone.

Returns:

The clone.

Return type:

Self

construct()

Construct a ConstructedMolecule.

Returns:

The data describing the ConstructedMolecule.

Return type:

ConstructionResult

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:

Iterator[BuildingBlock]

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)[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:

Self