Exemplo n.º 1
0
def get_palladium_cispbi_sqpl() -> stk.BuildingBlock:
    molecule = stk.ConstructedMolecule(
        topology_graph=stk.metal_complex.CisProtectedSquarePlanar(
            metals={get_pd_atom(): 0},
            ligands={get_palladium_bi_1(): 0},
            reaction_factory=stk.DativeReactionFactory(
                reaction_factory=stk.GenericReactionFactory(bond_orders={
                    frozenset({
                        stk.GenericFunctionalGroup,
                        stk.SingleAtom,
                    }):
                    9,
                }, ), ),
        ), )

    return stk.BuildingBlock.init_from_molecule(
        molecule=molecule,
        functional_groups=[
            stk.SmartsFunctionalGroupFactory(
                smarts='[Pd]~[#7]',
                bonders=(0, ),
                deleters=(),
                placers=(0, 1),
            ),
        ],
    )
Exemplo n.º 2
0
def two_two_reaction(
    periodicity,
    functional_group2,
    functional_group2_2,
    bond_order,
):
    bond_order_key = frozenset({
        type(functional_group2),
        type(functional_group2_2),
    })
    position_matrix = get_position_matrix(
        functional_group1=functional_group2,
        functional_group2=functional_group2_2,
    )
    edge = MockEdge(0, periodicity)
    return CaseData(
        factory=stk.GenericReactionFactory(
            bond_orders={
                bond_order_key: bond_order,
            },
        ),
        construction_state=MockConstructionState(
            edges=(edge, ),
            edge_functional_groups={
                0: (
                    functional_group2,
                    functional_group2_2,
                ),
            },
            position_matrix=position_matrix,
        ),
        edge_group=stk.EdgeGroup(
            edges=(edge, ),
        ),
        reaction_result=ReactionResult(
            new_atoms=(),
            new_bonds=get_new_bonds(
                functional_group1=functional_group2,
                functional_group2=functional_group2_2,
                order=bond_order,
                periodicity=periodicity,
            ),
            deleted_atoms=it.chain(
                functional_group2.get_deleters(),
                functional_group2_2.get_deleters(),
            ),
            deleted_bonds=(),
        ),
    )
Exemplo n.º 3
0
def get_iron_complex() -> stk.BuildingBlock:
    iron_complex = stk.ConstructedMolecule(
        topology_graph=stk.metal_complex.OctahedralDelta(
            metals={get_fe_atom(): 0},
            ligands={get_complex_ligand(): (0, 1, 2)},
            reaction_factory=stk.DativeReactionFactory(
                reaction_factory=stk.GenericReactionFactory(bond_orders={
                    frozenset({
                        stk.GenericFunctionalGroup,
                        stk.SingleAtom,
                    }):
                    9,
                }))))
    return stk.BuildingBlock.init_from_molecule(
        molecule=iron_complex, functional_groups=[stk.BromoFactory()])
Exemplo n.º 4
0
def dative_reaction(
    functional_group1,
    functional_group1_2,
    periodicity,
    bond_order,
):
    bond_order_key = frozenset({
        type(functional_group1),
        type(functional_group1_2),
    })
    edge = MockEdge(0, periodicity)
    return CaseData(
        factory=stk.DativeReactionFactory(
            stk.GenericReactionFactory(
                bond_orders={
                    bond_order_key: bond_order,
                },
            )
        ),
        construction_state=MockConstructionState(
            edges=(edge, ),
            edge_functional_groups={
                0: (
                    functional_group1,
                    functional_group1_2,
                )
            }
        ),
        edge_group=stk.EdgeGroup(
            edges=(edge, )
        ),
        reaction_result=ReactionResult(
            new_atoms=(),
            new_bonds=get_new_bonds(
                functional_group1=functional_group1,
                functional_group2=functional_group1_2,
                order=bond_order,
                periodicity=periodicity,
            ),
            deleted_atoms=it.chain(
                functional_group1.get_deleters(),
                functional_group1_2.get_deleters(),
            ),
            deleted_bonds=(),
        ),
    )
Exemplo n.º 5
0
        CaseData(
            molecule=stk.ConstructedMolecule(
                stk.metal_complex.Paddlewheel(
                    metals={
                        _copper_atom: (0, ),
                        _palladium_atom: (1, )
                    },
                    ligands={
                        _bi_1: (2, 3),
                        _bi_2: (0, 1),
                    },
                    reaction_factory=stk.DativeReactionFactory(
                        stk.GenericReactionFactory(
                            bond_orders={
                                frozenset({
                                    stk.GenericFunctionalGroup,
                                    stk.SingleAtom
                                }): 9
                            }
                        )
                    )
                )
            ),
            smiles=(
                '[H]C1=C([H])C(C2=O->[Pd+2]34<-O=C(C5=C([H])C([H])=C('
                'Br)C([H])=C5[H])O->[Cu+2](<-O2)(<-OC(C2=C([H])C([H])'
                '=C(N([H])[H])C([H])=C2[H])=O->3)<-OC(C2=C([H])C([H])'
                '=C(N([H])[H])C([H])=C2[H])=O->4)=C([H])C([H])=C1Br'
            ),
        ),

        CaseData(
Exemplo n.º 6
0
            deleters=(),
        ),
    ])


@pytest.fixture(
    params=(CaseData(
        molecule=stk.ConstructedMolecule(
            stk.cage.M4L4Square(
                corners=palladium_cispbi_sqpl,
                linkers=linker,
                reaction_factory=stk.DativeReactionFactory(
                    stk.GenericReactionFactory(
                        bond_orders={
                            frozenset({
                                stk.GenericFunctionalGroup, stk.GenericFunctionalGroup
                            }):
                            9
                        })))),
        smiles=('[H]C1=C2C([H])=C([H])N(->[Pd+2]3(<-N4=C([H])C([H])=C'
                '(C([H])=C4[H])C4=C([H])C([H])=N(->[Pd+2]5(<-N6=C([H]'
                ')C([H])=C(C([H])=C6[H])C6=C([H])C([H])=N(->[Pd+2]7(<'
                '-N8=C([H])C([H])=C(C([H])=C8[H])C8=C([H])C([H])=N(->'
                '[Pd+2]9(<-N%10=C([H])C([H])=C2C([H])=C%10[H])<-N([H]'
                ')([H])C([H])([H])C([H])([H])N->9([H])[H])C([H])=C8[H'
                '])<-N([H])([H])C([H])([H])C([H])([H])N->7([H])[H])C('
                '[H])=C6[H])<-N([H])([H])C([H])([H])C([H])([H])N->5(['
                'H])[H])C([H])=C4[H])<-N([H])([H])C([H])([H])C([H])(['
                'H])N->3([H])[H])=C1[H]'),
    ), ), )
def metal_cage_m4l4_square(request):
Exemplo n.º 7
0
from ....case_data import CaseData


@pytest.fixture(
    scope='session',
    params=(lambda name: CaseData(
        molecule=stk.ConstructedMolecule(topology_graph=stk.cage.M3L6(
            building_blocks={
                get_pd_atom(): range(3),
                get_linker(): range(3, 9),
            },
            reaction_factory=stk.DativeReactionFactory(
                reaction_factory=stk.GenericReactionFactory(bond_orders={
                    frozenset({
                        stk.GenericFunctionalGroup,
                        stk.SingleAtom,
                    }):
                    9,
                }, ), ),
        ), ),
        smiles=('[H]C1=C([H])C2=C([H])C(=C1[H])C1=C([H])C([H])=N(->['
                'Pd+2]34<-N5=C([H])C([H])=C(C([H])=C5[H])C5=C([H])C('
                '[H])=C([H])C(=C5[H])C5=C([H])C([H])=N(->[Pd+2]6(<-N'
                '7=C([H])C([H])=C(C([H])=C7[H])C7=C([H])C([H])=C([H]'
                ')C(=C7[H])C7=C([H])C([H])=N(->[Pd+2](<-N8=C([H])C(['
                'H])=C(C([H])=C8[H])C8=C([H])C(=C([H])C([H])=C8[H])C'
                '8=C([H])C([H])=N->3C([H])=C8[H])(<-N3=C([H])C([H])='
                'C(C([H])=C3[H])C3=C([H])C(=C([H])C([H])=C3[H])C3=C('
                '[H])C([H])=N->4C([H])=C3[H])<-N3=C([H])C([H])=C(C(['
                'H])=C3[H])C3=C([H])C(=C([H])C([H])=C3[H])C3=C([H])C'
                '([H])=N->6C([H])=C3[H])C([H])=C7[H])<-N3=C([H])C([H'
Exemplo n.º 8
0
        ],
    )


@pytest.fixture(
    scope='session',
    params=(
        lambda name: CaseData(
            molecule=stk.ConstructedMolecule(
                stk.cage.M4L4Square(corners=_get_palladium_cispbi_sqpl(),
                                    linkers=get_other_linker(),
                                    reaction_factory=stk.DativeReactionFactory(
                                        stk.GenericReactionFactory(
                                            bond_orders={
                                                frozenset({
                                                    stk.GenericFunctionalGroup,
                                                    stk.GenericFunctionalGroup,
                                                }):
                                                9,
                                            })))),
            smiles=('[H]C1=C2C([H])=C([H])N(->[Pd+2]3(<-N4=C([H])C([H])=C'
                    '(C([H])=C4[H])C4=C([H])C([H])=N(->[Pd+2]5(<-N6=C([H]'
                    ')C([H])=C(C([H])=C6[H])C6=C([H])C([H])=N(->[Pd+2]7(<'
                    '-N8=C([H])C([H])=C(C([H])=C8[H])C8=C([H])C([H])=N(->'
                    '[Pd+2]9(<-N%10=C([H])C([H])=C2C([H])=C%10[H])<-N([H]'
                    ')([H])C([H])([H])C([H])([H])N->9([H])[H])C([H])=C8[H'
                    '])<-N([H])([H])C([H])([H])C([H])([H])N->7([H])[H])C('
                    '[H])=C6[H])<-N([H])([H])C([H])([H])C([H])([H])N->5(['
                    'H])[H])C([H])=C4[H])<-N([H])([H])C([H])([H])C([H])(['
                    'H])N->3([H])[H])=C1[H]'),
            name=name,
        ),
Exemplo n.º 9
0
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