Periodic Collapser

class PeriodicCollapser(step_size=0.1, distance_threshold=1.5, scale_steps=False)[source]

Bases: Optimizer

Performs rigid-body collapse of molecules [1].

This Optimizer will also update the .PeriodicInfo.


Structure Optimization

Using PeriodicCollapser will lead to ConstructedMolecule structures without long bonds and match the unit-cell to the new structure.

import stk

bb1 = stk.BuildingBlock('BrCCBr', [stk.BromoFactory()])
bb2 = stk.BuildingBlock('BrCC(CBr)CBr', [stk.BromoFactory()])

topology_graph = stk.cof.PeriodicHoneycomb(
    building_blocks=(bb1, bb2),
    lattice_size=(1, 2, 3),
cof = stk.ConstructedMolecule(topology_graph)

Optimisation with stk simply collects the final position matrix and periodic info. 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.




Optimize the structure of a molecule under construction.

__init__(step_size=0.1, distance_threshold=1.5, scale_steps=False)[source]

Initialize an instance of PeriodicCollapser.

  • 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.


Optimize the structure of a molecule under construction.


state (ConstructionState) – The molecule being constructed.


The optimized construction state.

Return type: