stko.CollapserMC

class stko.CollapserMC(output_dir, step_size, target_bond_length, num_steps, bond_epsilon=50, nonbond_epsilon=20, nonbond_sigma=1.2, nonbond_mu=3, beta=2, random_seed=None)[source]

Bases: Collapser

Collapse molecule to decrease enlarged bonds using MC algorithm.

It is recommended to use the MCHammer version of this code with MCHammer [1], where a much cleaner version is written. The utilities get_long_bond_ids will help generate sub units.

Smarter optimisation than Collapser using simple Monte Carlo algorithm to perform rigid translations of building blocks.

Parameters:
  • output_dir (Path | str) – The name of the directory into which files generated during the calculation are written.

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

  • target_bond_length (float) – Target equilibrium bond length for long bonds to minimize to.

  • num_steps (int) – Number of MC moves to perform.

  • bond_epsilon (float) – Value of epsilon used in the bond potential in MC moves. Determines strength of the bond potential. Defaults to 50.

  • nonbond_epsilon (float) – Value of epsilon used in the nonbond potential in MC moves. Determines strength of the nonbond potential. Defaults to 20.

  • nonbond_sigma (float) – Value of sigma used in the nonbond potential in MC moves. Defaults to 1.2.

  • nonbond_mu (float) – Value of mu used in the nonbond potential in MC moves. Determines the steepness of the nonbond potential. Defaults to 3.

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

  • random_seed (int | None) – Random seed to use for MC algorithm. Should only be set if exactly reproducible results are required, otherwise a system-based random seed should be used for proper sampling.

References

Methods

optimize

p_optimize

Optimize mol.

optimize(mol)[source]
Parameters:

mol (ConstructedMoleculeT)

Return type:

ConstructedMoleculeT

p_optimize(mol, unit_cell)

Optimize mol.

Parameters:
  • mol (Molecule) – The molecule to be optimized.

  • unit_cell (UnitCell) – The cell to be optimized.

Returns:

The optimized molecule and the optimized cell.

Return type:

tuple[Molecule, UnitCell]