GLmol
GLmol copied to clipboard
problem with parseObjMol in pymol2glmol.py
Hi; in pymol2glmol.py (https://raw.githubusercontent.com/Pymol-Scripts/Pymol-script-repo/master/pymol2glmol.py), there is this code:
def parseObjMol(obj):
name = obj[0]
ids = []
sphere = []
trace = []
ribbon = []
stick = []
surface = []
line = []
cross = []
smallSphere = []
helix = []
sheet = []
colors = {}
for atom in obj[5][7]:
rep = atom[20] + [0] * 12
serial = atom[22]
ss = atom[10]
bonded = (atom[25] == 1)
if (rep[5] == 1):
ribbon.append(serial)
if (rep[1] == 1):
sphere.append(serial)
if (rep[2] == 1):
surface.append(serial)
if (rep[7] == 1):
line.append(serial)
if (rep[6] == 1):
trace.append(serial)
if (rep[4] == 1 and not bonded):
smallSphere.append(serial)
if (rep[11] == 1 and not bonded):
cross.append(serial)
if (rep[0] == 1 and bonded):
stick.append(serial)
if (ss == 'S'):
sheet.append(serial)
if (ss == 'H'):
helix.append(serial)
...
There seem to be two problems with this code. The first is that at least with python3 and recent pymol, the line rep = atom[20] + [0] * 12 causes an exception, because atom[20] is an int ("visRep"), and python can't do int + list. I worked around that by doing rep = [atom[20]] + [0] * 12. But now I'm confused because the last part of the code checks for various elements of rep, but rep is never set to anything but all zeros (except the first element). So again it seems to be something wrong with the initialization of rep.
Any hints?