| 1 | noBond = 3.5
|
|---|
| 2 | fullBond = 2.0
|
|---|
| 3 | resIDs = ["57.A", "68.A"]
|
|---|
| 4 | atomNames = ["SG", "N"]
|
|---|
| 5 |
|
|---|
| 6 | from chimera import openModels, Molecule, Bond
|
|---|
| 7 | bondRepr = Bond.Stick
|
|---|
| 8 | fullRadius = 0.2
|
|---|
| 9 |
|
|---|
| 10 | atoms = []
|
|---|
| 11 | allAtoms = openModels.list(modelTypes=[Molecule])[0].atoms
|
|---|
| 12 | for resID, atomName in zip(resIDs, atomNames):
|
|---|
| 13 | for a in allAtoms:
|
|---|
| 14 | if str(a.residue.id) == resID:
|
|---|
| 15 | atoms.append(a.residue.atomsMap[atomName][0])
|
|---|
| 16 | break
|
|---|
| 17 |
|
|---|
| 18 | a1, a2 = atoms
|
|---|
| 19 | dist = a1.coord().distance(a2.coord())
|
|---|
| 20 |
|
|---|
| 21 | if dist >= noBond:
|
|---|
| 22 | if a1 in a2.neighbors:
|
|---|
| 23 | a1.molecule.deleteBond(a1.bondsMap[a2])
|
|---|
| 24 | else:
|
|---|
| 25 | if a1 not in a2.neighbors:
|
|---|
| 26 | b = a1.molecule.newBond(a1, a2)
|
|---|
| 27 | b.drawMode = bondRepr
|
|---|
| 28 | else:
|
|---|
| 29 | b = a1.bondsMap[a2]
|
|---|
| 30 | if dist <= fullBond:
|
|---|
| 31 | b.radius = fullRadius
|
|---|
| 32 | else:
|
|---|
| 33 | b.radius = fullRadius * (1.0 - (dist-fullBond) / (noBond-fullBond))
|
|---|