stk.Collapser

class stk.Collapser(step_size=0.1, distance_threshold=1.5, scale_steps=True)[source]

Bases: Optimizer

Performs rigid-body collapse of molecules.

Examples

Structure Optimization

Using Collapser will lead to ConstructedMolecule structures without long bonds.

import stk

bb1 = stk.BuildingBlock('NCCN', [stk.PrimaryAminoFactory()])
bb2 = stk.BuildingBlock('O=CCC=O', [stk.AldehydeFactory()])

polymer = stk.ConstructedMolecule(
    topology_graph=stk.polymer.Linear(
        building_blocks=(bb1, bb2),
        repeating_unit='AB',
        num_repeating_units=2,
        optimizer=stk.Collapser(),
    ),
)

Optimisation with stk simply collects the final position matrix. The optimisation’s trajectory can be output using the MCHammer implementation if required by the user [1].

The open-source optimization code MCHammer specializes in the collapsing of molecules with long bonds like those constructed by stk. This code is entirely nonphysical and is, therefore, completely general to any chemistry.

References

Initialize an instance of Collapser.

Parameters:
  • step_size (float, optional) – The relative size of the step to take during collapse in Angstrom.

  • distance_threshold (float, optional) – Distance between distinct building blocks to use as threshold for halting collapse in Angstrom.

  • scale_steps (bool, optional) – Whether to scale the step of each distinct building block by its relative distance from the molecules centroid.

Methods

optimize

Optimize the structure of a molecule under construction.

optimize(state)[source]

Optimize the structure of a molecule under construction.

Parameters:

state – The molecule being constructed.

Returns:

The optimized construction state.