stk.Spinner

class stk.Spinner(step_size=1.5, rotation_step_size=5.0, num_conformers=50, max_attempts=1000, nonbond_epsilon=5.0, beta=2.0, random_seed=1000)[source]

Bases: Optimizer

Performs Monte Carlo optimisation of host-guest complexes.

Examples

Structure Optimization

Using Spinner will lead to ConstructedMolecule structures with better host-guest structures. Especially useful for multiple-guest systems and removing overlap.

import stk

bb1 = stk.BuildingBlock(
    smiles='NCCN',
    functional_groups=[stk.PrimaryAminoFactory()],
)
bb2 = stk.BuildingBlock(
    smiles='O=CC(C=O)C=O',
    functional_groups=[stk.AldehydeFactory()],
)
guest1 = stk.host_guest.Guest(
    building_block=stk.BuildingBlock('c1ccccc1'),
)
guest2 = stk.host_guest.Guest(
    building_block=stk.BuildingBlock('C1CCCCC1'),
)
cage = stk.ConstructedMolecule(
    topology_graph=stk.cage.FourPlusSix(
        building_blocks=(bb1, bb2),
        optimizer=stk.MCHammer(),
    ),
)

complex = stk.ConstructedMolecule(
    topology_graph=stk.host_guest.Complex(
        host=stk.BuildingBlock.init_from_molecule(cage),
        guests=(guest1, guest2),
        optimizer=stk.Spinner(),
    ),
)

Optimisation with stk simply collects the final position matrix. The optimisation’s trajectory can be output using the SpinDry implementation if required by the user [1]. This code is entirely nonphysical and is, therefore, completely general to any chemistry.

References

Initialize an instance of Spinner.

Parameters:
  • step_size (float) – The relative size of the step to take during step.

  • rotation_step_size (float) – The relative size of the rotation to take during step.

  • num_conformers (int) – Number of conformers to extract.

  • max_attempts (int) – Maximum number of MC moves to try to generate conformers.

  • nonbond_epsilon (float) – Value of epsilon used in the nonbonded potential in MC moves. Determines strength of the nonbonded potential.

  • beta (float) – Value of beta used in the in MC moves. Beta takes the place of the inverse boltzmann temperature.

  • random_seed (int) – Random seed to use for MC algorithm.

Methods

optimize

Optimize the structure of a molecule under construction.

optimize(state)[source]

Optimize the structure of a molecule under construction.

Parameters:

state (ConstructionState) – The molecule being constructed.

Returns:

The optimized construction state.

Return type:

ConstructionState