From: Michael G. L. <ml...@um...> - 2003-12-11 18:58:29
|
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 | / \ | mlerner@umich |
From: Warren L. D. <wa...@de...> - 2003-12-11 20:37:24
|
Michael, Impressive! I think you're one of the few people to delve into PyMOL's source like this. Obviously I'd be the best person to look at your code, but I'm crunched right now getting ready for this upcoming trip. Also, if the code is GPL-contaminated, then it can't be useful in the main version, but perhaps we can rewrite this cleanly later on. I can probably help you in January. What you've written sounds right... One thing I'd suggest for debugging in the meantime is that you use the isomesh or isosurface routines to explore what data is ending up in the Map, before trying to use the color ramps. There may also be some code in the chempy brick stuff which could serve as an example for populating the list. Cheers, Warren -- mailto:wa...@de... Warren L. DeLano, Ph.D. Principal Scientist DeLano Scientific LLC Voice (650)-346-1154 Fax (650)-593-4020 |
From: Michael G. L. <ml...@um...> - 2003-12-17 23:00:46
|
Hi again, I've gotten the code much closer to working. Also, I think it's factored well enough that most of it should be non-GPL-contaminated. After I actually get it working completely, I'll email the APBS folks to see if they care about licensing issues. Right now, I can generate isomeshes and isosurfaces for methanol that look reasonable (yay!). But I can't get the surface coloring to work. If I do this: load methanol.pdb show surface, methanol run cleanerDxMap.py # loads up my APBS-generated map ramp_new e_lvl, map, [-10,0.00,10] set surface_color, e_lvl, methanol isosurf surfneg, map, -0.1 isomesh meshpos, map, 0.1 color red, surfneg color blue, meshpos I get a good looking mesh, a good looking isosurface, and a completely white surface around methanol. dragging the limits on the map around to really small things or really large things doesn't seem to help either. Any quick guesses? In case you have a little bit of spare time, I have two dumb sounding questions: 1) What exactly is supposed to go into ObjectMapState->Dim? At first, I thought it was just a list of three integers giving the map dimensions (in grid points), but that doesn't seem to be the answer. When I take a map that PyMOL generates for me (e.g. with cmd.map_new("map","gaussian","0.1","methanol")) and print it out as a Python list (using ObjectMapAsPyList, etc.), I get different results each time the program is run. 2) What exactly is supposed to go into ObjectMapState->Field->Points? I think it's just the x,y,z coordinates of the points starting at minCorner and working up through maxCorner by incrementing z then y then x ([x1,y1,z1,x1,y1,z2,...]. But, when I first tried to set points myself, I got a few things wrong .. it looks like n_dim is supposed to be 4. I had guessed 3. It also looks like Dim should be four ints, the grid dimensions followed by the number 3. Finally, it looks like stride should be the normal stride followed by the base_size. What am I missing here? Why is points a four-dimensional thing while data is a three-dimensional thing? thanks, -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 | / \ | mlerner@umich On Thu, 11 Dec 2003, Warren L. DeLano wrote: > Michael, > > Impressive! I think you're one of the few people to delve into > PyMOL's source like this. > > Obviously I'd be the best person to look at your code, but I'm > crunched right now getting ready for this upcoming trip. Also, if the > code is GPL-contaminated, then it can't be useful in the main version, > but perhaps we can rewrite this cleanly later on. I can probably help > you in January. What you've written sounds right... > > One thing I'd suggest for debugging in the meantime is that you > use the isomesh or isosurface routines to explore what data is ending up > in the Map, before trying to use the color ramps. There may also be > some code in the chempy brick stuff which could serve as an example for > populating the list. > > Cheers, > Warren > > -- > mailto:wa...@de... > Warren L. DeLano, Ph.D. > Principal Scientist > DeLano Scientific LLC > Voice (650)-346-1154 > Fax (650)-593-4020 > > > |
From: Michael B. <mb...@gm...> - 2003-12-17 23:28:11
|
On Wed, Dec 17, 2003 at 06:00:44PM -0500, Michael George Lerner wrote: > I've gotten the code much closer to working. Also, I think it's factored > well enough that most of it should be non-GPL-contaminated. After I > actually get it working completely, I'll email the APBS folks to see if > they care about licensing issues. What's the problem? Both PyMOL and APBS are licensed under the GPL so I see no problems there. Do you imply that you want to license your own code under a non-GPL-compatible license? Why? Michael |
From: Michael B. <mb...@gm...> - 2003-12-18 00:31:01
|
On Thu, Dec 18, 2003 at 12:26:48AM +0100, Michael Banck wrote: > On Wed, Dec 17, 2003 at 06:00:44PM -0500, Michael George Lerner wrote: > > I've gotten the code much closer to working. Also, I think it's factored > > well enough that most of it should be non-GPL-contaminated. After I > > actually get it working completely, I'll email the APBS folks to see if > > they care about licensing issues. > > What's the problem? Both PyMOL and APBS are licensed under the GPL so I > see no problems there. Well, pymol isn't obviously. Note to self: Don't post about licensing stuff after an evening of mulled wine. Still, as long as the pymol license is GPL-compatible (which I believe it is, but I'm no lawyer), and the additional code is licensed under the same license, it should be alright, as I understand it. sorry, Michael |
From: Michael G. L. <ml...@um...> - 2003-12-18 00:46:02
|
> > What's the problem? Both PyMOL and APBS are licensed under the GPL so I > > see no problems there. > > Well, pymol isn't obviously. Note to self: Don't post about licensing > stuff after an evening of mulled wine. I've had an evening of nice port .. we'll see how a port-influenced evening compares to a mulled-wine-influenced evening :). > Still, as long as the pymol license is GPL-compatible (which I believe > it is, but I'm no lawyer), and the additional code is licensed under the > same license, it should be alright, as I understand it. The potential problem is this: once I get this working, I want to give it to PyMOL. That way, I don't have to care about maintainance :). If I'm going to give it to PyMOL, I think it needs to use the PyMOL license, not the GPL. The license thing is probably not a big deal anyway. On the one hand, I'm not sure that anything I've done is actually forced to be GPL'd. On the other hand, it would probably take Warren all of an hour to re-create everything I've done. It took me a while because in addition to writing something that parses DX files, I had to figure out some of the PyMOL internals. And I'm slow :). Playing around with PyMOL is definately fun, though. -michael |