Exemple #1
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=(),
        ),
    )
Exemple #2
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=(),
        ),
    )