How to use the stk.BuildingBlock function in stk

To help you get started, we’ve selected a few stk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lukasturcani / stk / tests / molecular / molecules / molecule / fixtures / cage / metal_topologies / m8l6_cube.py View on Github external
stk.metal_complex.OctahedralDelta(
        metals={metal_atom: 0},
        ligands={complex_ligand: (0, 1, 2)},
        reaction_factory=stk.DativeReactionFactory(
            stk.GenericReactionFactory(
                bond_orders={
                    frozenset({
                        stk.GenericFunctionalGroup,
                        stk.SingleAtom
                    }): 9
                }
            )
        )
    )
)
iron_complex = stk.BuildingBlock.init_from_molecule(
    molecule=iron_complex,
    functional_groups=[stk.BromoFactory()]
)


@pytest.fixture(
    params=(
        CaseData(
            molecule=stk.ConstructedMolecule(
                stk.cage.M8L6Cube(
                    building_blocks={
                        iron_complex: range(8),
                        tetratopic_linker: range(8, 14),
                    },
                )
            ),
github lukasturcani / stk / tests / fixtures / building_blocks / misc.py View on Github external
def diol2():
    return stk.BuildingBlock('Oc1cc2cc(O)c(O)nc2cc1O', ['diol'])
github lukasturcani / stk / tests / molecular / molecules / test_building_block.py View on Github external
}
    assert expected_bonds == Counter(
        frozenset({b.atom1.__class__, b.atom2.__class__})
        for b in mol0.bonds
    )

    # Test that caching is working properly.
    mol1 = stk.BuildingBlock('NCCCN', ['amine'])
    assert mol0 is not mol1

    mol2 = stk.BuildingBlock(
        smiles='NCCCN',
        functional_groups=['amine'],
        use_cache=True
    )
    mol3 = stk.BuildingBlock(
        smiles='NCCCN',
        functional_groups=['amine'],
        use_cache=True
    )
    assert mol0 is not mol2 and mol1 is not mol2
    assert mol2 is mol3

    mol4 = stk.BuildingBlock(
        smiles='NCCCN',
        functional_groups=['aldehyde'],
        use_cache=True
    )
    assert mol3 is not mol4

    # Make sure that charged molecules are handled correctly.
    mol5 = stk.BuildingBlock(
github lukasturcani / stk / tests / molecular / molecules / molecule / fixtures / metal_complex / paddlewheel / paddlewheel.py View on Github external
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]',
            bonders=(1, ),
            deleters=(),
        ),
    ]
)
_bi_2 = stk.BuildingBlock(
    smiles='Nc1ccc(C(=O)O)cc1',
github lukasturcani / stk / tests / molecular / molecules / test_building_block.py View on Github external
expected_bonds = {
        frozenset({stk.N, stk.C}): 2,
        frozenset({stk.C}): 2,
        frozenset({stk.H, stk.N}): 4,
        frozenset({stk.H, stk.C}): 6
    }
    assert expected_bonds == Counter(
        frozenset({b.atom1.__class__, b.atom2.__class__})
        for b in mol0.bonds
    )

    # Test that caching is working properly.
    mol1 = stk.BuildingBlock('NCCCN', ['amine'])
    assert mol0 is not mol1

    mol2 = stk.BuildingBlock(
        smiles='NCCCN',
        functional_groups=['amine'],
        use_cache=True
    )
    mol3 = stk.BuildingBlock(
        smiles='NCCCN',
        functional_groups=['amine'],
        use_cache=True
    )
    assert mol0 is not mol2 and mol1 is not mol2
    assert mol2 is mol3

    mol4 = stk.BuildingBlock(
        smiles='NCCCN',
        functional_groups=['aldehyde'],
        use_cache=True
github lukasturcani / stk / tests / fixtures / building_blocks / amine.py View on Github external
def amine2_alt1():
    return stk.BuildingBlock('NCNCN', ['amine'])
github lukasturcani / stk / tests / fixtures / populations.py View on Github external
def _population_members():
    bb1 = stk.BuildingBlock('NC(CCO)CN', ['amine'])
    bb2 = stk.BuildingBlock('[Br]CCCC[Br]', ['bromine'])
    bb3 = stk.BuildingBlock('[I]COCC[I]', ['iodine'])
    bb4 = stk.BuildingBlock('O=CC(C=O)CC=O', ['aldehyde'])

    c1 = stk.ConstructedMolecule(
        building_blocks=[bb2],
        topology_graph=stk.polymer.Linear('A', 3)
    )
    c2 = stk.ConstructedMolecule(
        building_blocks=[bb1, bb4],
        topology_graph=stk.cage.FourPlusSix()
    )
    c3 = stk.ConstructedMolecule(
        building_blocks=[bb1, bb4],
        topology_graph=stk.cage.EightPlusTwelve()
    )
    c4 = stk.ConstructedMolecule(
        building_blocks=[bb2, bb3],
        topology_graph=stk.polymer.Linear('AB', 3)
github lukasturcani / stk / tests / fixtures / building_blocks / amine.py View on Github external
def amine2_alt3():
    return stk.BuildingBlock('NC(Cl)CN', ['amine'])
github lukasturcani / stk / tests / fixtures / populations.py View on Github external
def tmp_population():
    bb1, bb2, bb3, bb4, c1, c2, c3, c4 = _population_members()
    return stk.Population(
        c3,
        stk.BuildingBlock('NCCCN'),
        bb1,
        stk.BuildingBlock('NCCCN', ['amine']),
        c1,
        stk.BuildingBlock('O=CCC=O'),
        c1,
        stk.BuildingBlock('O=CCC=O', ['aldehyde']),
        stk.Population(
            c1,
            stk.BuildingBlock('[Br]CC[Br]'),
            bb1,
            bb2,
            bb1
        ),
        c2,
        stk.Population(
            bb1,
            stk.BuildingBlock('CCCC'),
            stk.Population(
github lukasturcani / stk / tests / fixtures / building_blocks / amine.py View on Github external
def tmp_amine2():
    return stk.BuildingBlock('NCCCN', ['amine'])