stko.Aligner

class stko.Aligner(initial_molecule, matching_pairs)[source]

Bases: Optimizer

Use SpinDry to align two molecules.

Parameters:
  • initial_molecule (Molecule) – Molecule to align to.

  • matching_pairs (tuple[tuple[str, str], ...]) – Pairs of atom types to use in alignment.

Examples

import stk
import stko
import numpy as np


# For this example, we have produced rotated molecules.
mol = stk.BuildingBlock('NCCNCCN')
mol2 = mol.with_rotation_about_axis(
    1.34, np.array((0, 0, 1)), np.array((0, 0, 0)),
)
aligner = stko.Aligner(mol2, (('N', 'N'), ))
mol = aligner.optimize(mol)

Methods

optimize

Optimize mol.

optimize(mol)[source]

Optimize mol.

Parameters:

mol (MoleculeT) – The molecule to be optimized.

Returns:

The optimized molecule.

Return type:

MoleculeT