MoleculeTransformer

class MoleculeTransformer(base_molecule, bond_modifiers, atom_connectivity=None, bonds_to_transform=None, alignment_atoms=None)[source]

Bases: object

A class for transforming molecular structures by modifying bond lengths.

This class generates variants of a base molecule by adjusting bond lengths according to specified modifiers. The modification mode is detected automatically.

Variables:
  • base_molecule – The reference molecule used as a template for generating variants.

  • bond_modifiers – A list of values used to adjust bond lengths. The class will generate one new molecule for each modifier in this list. The modification mode is detected automatically: - Scale mode: If all values are positive, they are used as scaling factors (e.g., 1.1 for a 10% increase). - Delta mode: If any value is zero or negative, all values are treated as additive changes to the bond length, in Ångstroms.

  • atom_connectivity – A sequence of atom index pairs specifying the bonds in the molecule. If not provided, a chain structure will be assumed e.g.: [(0, 1), (1, 2), (2, 3), …].

  • bonds_to_transform – A subset of atom_connectivity that specifies the bonds to modify. If None, all bonds will be transformed.

  • alignment_atoms – Indices of atoms onto which to align the orientation of the resulting variants of the molecule. Only useful for visualization and debugging. If None, no alignment is carried out.

Attributes Summary

Methods Summary

Attributes Documentation

alignment_atoms: Sequence[int] | None = None
atom_connectivity: Sequence[tuple[int, int]] | None = None
base_molecule: Molecule = <dataclasses._MISSING_TYPE object>
bond_modifiers: Sequence[float] = <dataclasses._MISSING_TYPE object>
bonds_to_transform: Sequence[tuple[int, int]] | None = None

Methods Documentation

generate()[source]
Return type:

dict[float, Molecule]