Processes

A series of classes for processing ensembles to get a particular conformer property.

Example:

One example is to make a building block more planar based on a plane-of-best-fit through desired atoms.

import stk
import bbprepared

bb = stk.BuildingBlock(
    smiles=(
        "C1=CC=C2C=C(C=CC2=C1)C3=CC(=CC=C3)C4=CC=CC5=CC=CC=C54"
    ),
)

The desired atoms are set by the user, using a selector (here, all atoms!), and the best is chosen from an ensemble built with the ETKDG algorithm. The gists have other ways of generating ensembles.

selector = bbprepared.selectors.AllSelector()
# This is not the cheapest approach, but works well in this case!
generator = bbprepared.generators.TorsionScanner(
    target_torsions=bbprepared.generators.TorsionRange(
        smarts="[#6][#6]-!@[#6][#6]",
        expected_num_atoms=4,
        scanned_ids=(0, 1, 2, 3),
        scanned_range=range(0, 362, 60),
    ),
)
ensemble = generator.generate_conformers(bb)
process = bbprepared.Planarfy(ensemble=ensemble, selector=selector)

# Get the minimum bbprepared.Conformer.
min_molecule = process.get_minimum()

# Can access the stk molecule using:
# min_molecule.molecule, and the score as:
min_score = process.calculate_score(
    min_molecule, process.get_minimum_id()
)