NOTE: this doesn't actually work yet, so most people can probably ignore this message completely .. but i'd love some help! :)
Hi, I've been doing all of my electrostatics calculations in MOE, but I'd like to switch to PyMOL. I looked/asked around a bit and found APBS <http://agave.wustl.edu/apbs/>, a cool GPL'd Poisson Boltzmann solver. I figured that the first step in plugging APBS into PyMOL would just be getting PyMOL to read dx files (that's APBS's default output format). I have this almost, but not quite, working. I haven't messed around much with PyMOL's internals, so I'm sure I've done a few things the wrong way. Here's what I did and where I'm stuck: 1) understand the dx file format - i was in a hurry here, so i just read one of the APBS source files. i don't know much about licenses, and i don't know if that means that part of my code now needs to be GPL'd instead of released under the PyMOL license. 3) wrote some Python code to read in a dx file and turn it into a nice class. 4) gave that class the ability to spit out a list that i *think* matches PyMOL's PyList version of an electrostatics map (ObjectMapState in ObjectMap.h/c) 5) added a function ObjectMap *ObjectMapLoadFromPyList(ObjectMap *I,PyObject *list,int state,int discrete); to ObjectMap.h/c that should be able to load it. Now, I wasn't sure exactly how I should get PyMOL to actually load the dx files. The most promising way looked like importing.load_object, so .. 6) added dx to importing.loadable (loadable.dx = 31) and #define'd cLoadTypeDxPyListMap to be 31 in Cmd.c. added a new case for cLoadTypeDxPyListMap to the big switch in CmdLoadObject and made it call through to ObjectMapLoadFromPyList. 7) made a little python script called dxMap.py that looks like this: from pymol import importing f = file('meoh.dx') d = readDX(f) f.close() thing = d.getObjectMapState(asList=True) importing.load_object(importing.loadable.dx, thing, 'map') and a pml script that says load methanol.pdb show surface, methanol run dxMap.py ramp_new e_lvl, map, [-0.02,0.00,0.02] set surface_color, e_lvl, methanol At this point, things *almost* work. If I click on "map" in the main PyMOL window, it shows a box around my molecule (methanol in case you haven't guessed yet :)) that looks like the right size. But, the surface is entirely white (and middle-clicking on the ramp and dragging doesn't help). Even more disturbing, when I try something like "isosurf surf1, map, 0.008", PyMOL segfaults :(. My guess is that I don't quite understand what PyMOL wants me to send to ObjectMapLoadFromPyList or ObjectMapStateFromPyList. I've tried lots of prinf debugging throughout ObjectMap.c, Isosurf.c and Field.c and everything looks right. Anyone have any quick guesses as to what I might be doing wrong? If I put my little bit of Python and C code up on the web somewhere, would someone be willing to take a look at it? I'm pretty sure the problem is in one of my Python classes (ObjectMapState, Isofield and Field) or in my C code, rather than in the dx parsing, so looking at those things shouldn't force the GPL taint upon you :). In case it matters, I'm using the CVS version of PyMOL, compiled to use Python2.3 (i don't have Python2.2 on my system, the cvs version of PyMOL wants Python2.2 and the ext package includes Python2.1 ..). thanks in advance, -michael -- This isn't a democracy;| _ |Michael Lerner it's a cheer-ocracy. | ASCII ribbon campaign ( ) | Michigan -Torrence, Bring It On| - against HTML email X | Biophysics | / \ | mler...@umich