/usr/lib/python2.7/dist-packages/chempy/bmin/util.py is in pymol 1.8.4.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # pymol
from __future__ import print_function
from chempy import Bond
import copy
import random
# cap gaps in chain as aldehydes and neutral amines...
# (for instance, when
def cap(object):
from pymol import cmd
model = cmd.get_model(object)
# guarantee identical ordering
cmd.delete(object)
cmd.load_model(model,object)
n_list = cmd.identify("(name N &!(name C around 2.0))")
c_list = cmd.identify("(name C &!(name N around 2.0))")
print(n_list)
print(c_list)
for a in n_list:
newat = copy.deepcopy(model.atom[a])
newat.coord = [
newat.coord[0] + random.random(),
newat.coord[1] + random.random(),
newat.coord[2] + random.random(),
]
newat.symbol = 'H'
newat.name = 'HN'
newat.numeric_type = 43
bond = Bond()
bond.order = 1
bond.stereo = 0
bond.index = [ a, model.nAtom ]
print("adding",newat.name,bond.index)
model.add_atom(newat)
model.add_bond(bond)
for a in c_list:
newat = copy.deepcopy(model.atom[a])
newat.coord = [
newat.coord[0] + random.random(),
newat.coord[1] + random.random(),
newat.coord[2] + random.random(),
]
newat.symbol = 'H'
newat.name = 'HC'
newat.numeric_type = 41
bond = Bond()
bond.order = 1
bond.stereo = 0
bond.index = [ a, model.nAtom ]
print("adding",newat.name,bond.index)
model.add_atom(newat)
model.add_bond(bond)
# reload
cmd.delete(object)
cmd.load_model(model,object)
cmd.sort(object)
|