Пример #1
0
def _get_case_data_1() -> CaseData:
    bb1 = stk.BuildingBlock('BrCCBr', [stk.BromoFactory()])
    graph1 = stk.polymer.Linear((bb1, ), 'A', 2)

    bb2 = stk.BuildingBlock('BrCNCBr', [stk.BromoFactory()])
    graph2 = stk.polymer.Linear((bb2, ), 'A', 2)

    return CaseData(
        mutator=stk.RandomMutator(mutators=(stk.RandomBuildingBlock(
            building_blocks=(bb2, ),
            is_replaceable=has_bromo,
        ), ), ),
        record=stk.MoleculeRecord(graph1),
        mutation_record=stk.MutationRecord(
            molecule_record=stk.MoleculeRecord(graph2),
            mutator_name='RandomBuildingBlock',
        ),
    )
Пример #2
0
from ..case_data import CaseData


def has_bromo(building_block):
    fg, = building_block.get_functional_groups(0)
    return fg.__class__ is stk.Bromo


bb1 = stk.BuildingBlock('BrCCBr', [stk.BromoFactory()])
graph1 = stk.polymer.Linear((bb1, ), 'A', 2)

bb2 = stk.BuildingBlock('BrCNCBr', [stk.BromoFactory()])
graph2 = stk.polymer.Linear((bb2, ), 'A', 2)


@pytest.fixture(
    params=(CaseData(
        mutator=stk.RandomBuildingBlock(
            building_blocks=(bb2, ),
            is_replaceable=has_bromo,
        ),
        record=stk.MoleculeRecord(graph1),
        mutation_record=stk.MutationRecord(
            molecule_record=stk.MoleculeRecord(graph2),
            mutator_name='RandomBuildingBlock',
        ),
    ), ), )
def random_building_block(request):
    return request.param
Пример #3
0
            get_eight_plus_twelve, ), ),
        record=stk.MoleculeRecord(topology_graph=stk.cage.FourPlusSix(
            building_blocks=(
                stk.BuildingBlock(
                    smiles='BrCCBr',
                    functional_groups=[stk.BromoFactory()],
                ),
                stk.BuildingBlock(
                    smiles='BrCC(CBr)CBr',
                    functional_groups=[stk.BromoFactory()],
                ),
            ), ), ),
        mutation_record=stk.MutationRecord(
            molecule_record=stk.MoleculeRecord(
                topology_graph=stk.cage.EightPlusTwelve(building_blocks=(
                    stk.BuildingBlock(
                        smiles='BrCCBr',
                        functional_groups=[stk.BromoFactory()],
                    ),
                    stk.BuildingBlock(
                        smiles='BrCC(CBr)CBr',
                        functional_groups=[stk.BromoFactory()],
                    ),
                ), ), ),
            mutator_name='RandomTopologyGraph',
        ),
    ), ),
)
def random_topology_graph(request) -> CaseData:
    return request.param()