Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_host(amine2, amine2_alt3, aldehyde3):
four_plus_six = stk.cage.FourPlusSix()
return stk.ConstructedMolecule(
building_blocks=[amine2, amine2_alt3, aldehyde3],
topology_graph=four_plus_six,
building_block_vertices={
amine2: four_plus_six.vertices[5:],
amine2_alt3: four_plus_six.vertices[4:5],
aldehyde3: four_plus_six.vertices[:4]
}
def test_random_mutation(polymer):
chain1 = stk.polymer.Linear('AB', 4)
chain2 = stk.polymer.Linear('AB', 5)
t1 = stk.RandomTopologyGraph([chain1])
t2 = stk.RandomTopologyGraph([chain2])
mutator1 = stk.Random(t1, t2, probabilities=[1, 0])
mutator2 = stk.Random(t1, t2, probabilities=[0, 1])
mutant1 = mutator1.mutate(polymer)
expected1 = stk.ConstructedMolecule(
building_blocks=list(polymer.building_block_vertices.keys()),
topology_graph=chain1
)
assert mutant1.get_identity_key() == expected1.get_identity_key()
expected2 = stk.ConstructedMolecule(
building_blocks=list(polymer.building_block_vertices.keys()),
topology_graph=chain2
)
mutant2 = mutator2.mutate(polymer)
assert mutant2.get_identity_key() == expected2.get_identity_key()
molecule=stk.ConstructedMolecule(
stk.cage.M6L12Cube(
building_blocks={
metal_atom: range(6),
linker: range(6, 18)
},
reaction_factory=stk.DativeReactionFactory(
stk.GenericReactionFactory(
bond_orders={
frozenset({
stk.GenericFunctionalGroup,
stk.SingleAtom
}): 9
}
)
)
)
'([H])=C1[H]'
),
functional_groups=[
stk.SmartsFunctionalGroupFactory(
smarts='[#6]~[#7X2]~[#35]',
bonders=(1, ),
deleters=(),
),
stk.SmartsFunctionalGroupFactory(
smarts='[#6]~[#7X2]~[#6]',
bonders=(1, ),
deleters=(),
),
]
)
iron_complex = stk.ConstructedMolecule(
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(
def tmp_macrocycle(tmp_bromine2, tmp_bromine2_alt1):
return stk.ConstructedMolecule(
building_blocks=[tmp_bromine2, tmp_bromine2_alt1],
topology_graph=stk.macrocycle.Macrocycle('AB', 3)
)
molecule=stk.ConstructedMolecule(
stk.metal_complex.BidentateSquarePlanar(
metals=_palladium_atom,
ligands=_bi_1,
reaction_factory=stk.DativeReactionFactory(
stk.GenericReactionFactory(
bond_orders={
frozenset({
stk.GenericFunctionalGroup,
stk.SingleAtom
}): 9
}
)
)
)
),
smiles=(
molecule=stk.ConstructedMolecule(
stk.cage.M4L6TetrahedronSpacer(
building_blocks={
iron_complex: range(4),
ditopic_linker: range(4, 10)
},
)
),
smiles=(
'[H]C1=C([H])C([H])=N2->[Fe+2]3456<-N7=C([H])C([H])=C'
'([H])C([H])=C7C([H])=N->3C3=C([H])C([H])=C(C([H])=C3'
'[H])C3=C([H])C([H])=C(C([H])=C3[H])N3->[Fe+2]789(<-N'
'%10=C([H])C([H])=C([H])C([H])=C%10C=3[H])<-N3=C([H])'
'C([H])=C([H])C([H])=C3C([H])=N->7C3=C([H])C([H])=C(C'
'([H])=C3[H])C3=C([H])C([H])=C(C([H])=C3[H])N3->[Fe+2'
']7%10(<-N%11=C([H])C([H])=C([H])C([H])=C%11C([H])=N-'
'>7C7=C([H])C([H])=C(C([H])=C7[H])C7=C([H])C([H])=C(C'
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)
)
return bb1, bb2, bb3, bb4, c1, c2, c3, c4
def tmp_four_plus_four(tmp_amine3, tmp_aldehyde3):
topology_graph = stk.cage.FourPlusFour()
return stk.ConstructedMolecule(
building_blocks=[tmp_amine3, tmp_aldehyde3],
topology_graph=topology_graph,
building_block_vertices={
tmp_amine3: topology_graph.vertices[:4],
tmp_aldehyde3: topology_graph.vertices[4:]
}
amine2_alt2,
aldehyde3,
aldehyde3_alt1,
aldehyde3_alt2
):
building_blocks = [
amine2,
amine2_alt1,
amine2_alt2,
aldehyde3,
aldehyde3_alt1,
aldehyde3_alt2
]
four_plus_six = stk.cage.FourPlusSix()
c = stk.ConstructedMolecule(
building_blocks=building_blocks,
topology_graph=four_plus_six,
building_block_vertices={
aldehyde3: four_plus_six.vertices[0:1],
aldehyde3_alt1: four_plus_six.vertices[1:2],
aldehyde3_alt2: four_plus_six.vertices[2:4],
amine2: four_plus_six.vertices[4:6],
amine2_alt1: four_plus_six.vertices[6:7],
amine2_alt2: four_plus_six.vertices[7:]
}
)
c.write(join(test_dir, 'multi_bb.mol'))
num_expected_bbs = {
amine2: 2,
amine2_alt1: 1,
amine2_alt2: 3,