def get_pd_atom() -> stk.BuildingBlock: return stk.BuildingBlock( smiles='[Pd+2]', functional_groups=(stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4)), position_matrix=([0, 0, 0], ), )
from ....case_data import CaseData _copper_atom = stk.BuildingBlock( smiles='[Cu+2]', functional_groups=( stk.SingleAtom(stk.Cu(0, charge=2)) for i in range(4) ), position_matrix=([0, 0, 0], ), ) _palladium_atom = stk.BuildingBlock( smiles='[Pd+2]', functional_groups=( stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4) ), position_matrix=([0, 0, 0], ), ) _bi_1 = stk.BuildingBlock( smiles='O=C(O)c1ccc(Br)cc1', functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#8]~[#1]', bonders=(1, ), deleters=(2, ), ), stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#8X1]',
import pytest import stk from ....case_data import CaseData metal_atom = stk.BuildingBlock( smiles='[Pd+2]', functional_groups=(stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4)), position_matrix=([0, 0, 0], ), ) linker = stk.BuildingBlock( smiles=('[H]C1=NC([H])=C([H])C(C2=C([H])C([H])=C([H])C(C3=C([H])C([H]' ')=NC([H])=C3[H])=C2[H])=C1[H]'), functional_groups=[ stk.SmartsFunctionalGroupFactory( smarts='[#6]~[#7X2]~[#6]', bonders=(1, ), deleters=(), ), ]) @pytest.fixture( params=(CaseData( molecule=stk.ConstructedMolecule( stk.cage.M4L8( building_blocks={ metal_atom: range(4), linker: range(4, 12) }, reaction_factory=stk.DativeReactionFactory(
def build_cage_isomers(name, ligand): """ Build all four cage isomers. Parameters ---------- name : :class:`str` Cage identifier. ligand : :class:`stk.BuildingBlock` Ligand building block. Returns ------- cage_isomers : :class:`dict` of :class:`stk.ConstructedMolecule` Constructed cage isomers. """ cage_isomers = {} v_alignments = { 'A': { 2: 0, 3: 0, 4: 0, 5: 0 }, 'B': { 2: 1, 3: 0, 4: 0, 5: 0 }, 'C': { 2: 1, 3: 1, 4: 0, 5: 0 }, 'D': { 2: 1, 3: 0, 4: 1, 5: 0 }, } complex = stk.BuildingBlock( smiles='[Pd+2]', functional_groups=(stk.SingleAtom(stk.Pd(0, charge=2)) for i in range(4)), position_matrix=np.array([[0, 0, 0]]), ) for v_a in v_alignments: v_align = v_alignments[v_a] name_ = f'{name}_{v_a}' opt_file = f'{name_}_optc.mol' # Build cage. cage = stk.ConstructedMolecule( stk.cage.M2L4Lantern( building_blocks={ complex: (0, 1), ligand: (2, 3, 4, 5) }, vertex_alignments=v_align, reaction_factory=stk.DativeReactionFactory( stk.GenericReactionFactory( bond_orders={ frozenset({AromaticCNC, stk.SingleAtom}): 9, frozenset({AromaticCNN, stk.SingleAtom}): 9, })))) if exists(opt_file): cage = cage.with_structure_from_file(opt_file) else: print(f'optimizing {name_}') cage.write(f'{name_}_unopt.mol') cage = optimize_cage(cage, name_) cage_isomers[v_a] = cage return cage_isomers