smores.combine#

smores.combine(cores, substituents, join_atom='Br', optimize=True)[source]#

Yield a set of molecules by combining cores with substituents.

This function combines core and substituent molecules by creating a bond where the join_atom is specified. For example, if the join atom is Br, the operation is:

CCBr + BrCCN -> CCCCN

The function produces every possible pairwise combination of cores and substituents.

Examples

Compare the steric parameters of various substituents

import smores
import rdkit.Chem.AllChem as rdkit

cores=[
    smores.rdkit_from_smiles("NCBr"),
]
substituents=[
    smores.rdkit_from_smiles("CCBr"),
    smores.rdkit_from_smiles("CCCCBr"),
]
for combo in smores.combine(cores, substituents):
    molecule = smores.Molecule.from_combination(combo)
    params = molecule.get_steric_parameters()
    print(
        f"Combination of {rdkit.MolToSmiles(rdkit.RemoveHs(combo.core))} and "
        f"{rdkit.MolToSmiles(rdkit.RemoveHs(combo.substituent))} "
        f"has SMORES parameters of {params}."
    )
Combination of NCBr and CCBr has SMORES parameters of StericParameters(L=4.768506137873876, B1=1.7742858563716175, B5=3.430948246451143).
Combination of NCBr and CCCCBr has SMORES parameters of StericParameters(L=6.713047422661813, B1=1.7856585950046786, B5=3.5556262756974535).
Parameters:
  • cores (list[Mol]) – The core molecules.

  • substituents (list[Mol]) – The substituent molecules.

  • join_atom (Literal['F', 'Cl', 'Br']) – The atom in cores and substituents which specifies the location where they are joined.

  • optimize (bool) – If True, the generated molecules will have an optimized structure generated with ETKDG.

Yields:

A combination of a core and substituent molecule.

Return type:

Iterator[Combination]