stko.ConstructedMoleculeTorsionCalculator

class stko.ConstructedMoleculeTorsionCalculator[source]

Bases: object

Uses rdkit to extract all torsions in a molecule.

Note that the rdkit [2] function we use only outputs one torsion for each rotatable bond. We use the TorsionFingerprints.CalculateTorsionLists method.

Examples

import stk
import stko

# Create a molecule whose energy we want to know.
bb1 = stk.BuildingBlock('NCCNCCN', [stk.PrimaryAminoFactory()])
bb2 = stk.BuildingBlock('O=CCCC=O', [stk.AldehydeFactory()])
polymer = stk.ConstructedMolecule(
    stk.polymer.Linear(
        building_blocks=(bb1, bb2),
        repeating_unit="AB",
        orientations=[0, 0],
        num_repeating_units=1
    )
)

# Create the calculator.
tc = stko.ConstructedMoleculeTorsionCalculator()

# Extract the torsions.
tc_results = tc.get_results(polymer)

# Get information about torsions in building blocks and in the
# ConstructedMolecule.
for torsion in tc_results.get_torsion_infos():
    # Extract properties to map from constructed to building block.
    torsion_constructed = torsion.get_torsion()
    torsion_bb = torsion.get_building_block()
    torsion_bb_id = torsion.get_building_block_id()
    torsion_bb_torsion = torsion.get_building_block_torsion()

References

Methods

calculate

get_results

Calculate the torsions of mol.

calculate(mol)[source]
Parameters:

mol (ConstructedMolecule)

Return type:

Generator

get_results(mol)[source]

Calculate the torsions of mol.

Parameters:

mol (ConstructedMolecule) – The molecule whose torsions are to be calculated.

Returns:

The torsions of the molecule.

Return type:

ConstructedMoleculeTorsionResults