Hello,

On Fri, Apr 8, 2011 at 6:49 PM, Jason Vertrees <jason.vertrees@schrodinger.com> wrote:
Hi Marius,

> There's been quite a while since I wanted to ask this on the list, but would
> it be possible to have in Pymol some kind of technique to emulate realistic
> lighting (global illumination) in a rendered scene?

So, you're looking for something like ambient occlusion?  If so, try
this (taken from the gallery at the PyMOLWiki):

load $TUT/1hpv.pdb
set_color oxygen, [1.0,0.4,0.4]
set_color nitrogen, [0.5,0.5,1.0]
remove solvent
as spheres
util.cbaw
bg white
set light_count,10
set spec_count,1
set shininess, 10
set specular, 0.25
set ambient,0
set direct,0
set reflect,1.5
set ray_shadow_decay_factor, 0.1
set ray_shadow_decay_range, 2
unset depth_cue
ray

PyMOL can simulate this, but not do it numerically perfectly.  With
the addition of shaders and us working on modernizing the code, this
might be properly doable in the future.



I knew about the solution from the wiki, but as you mentioned there are better ways to do this :).
 

> The next point is related to the new volume representation. For example
> after loading a cube file which contains the electrostatic potential of a
> small molecule, Pymol does not show the whole range in the volume
> representation. My data spans from -0.08 to 172.6.  I haven't looked at how
> that scale is build, but would it be possible to let the user specify the
> range and build intermediate values from that. Also, while I understand that
> this feature was especially developed for the representation of electron
> density maps for proteins, not everyone is doing that and standard deviation
> or histograms on the volume representation should not be there by default. A
> simple scale should suffice.

Thanks for trying this out and offering your feedback.  Currently, the
vast majority of volumes users are crystallographers with very well
defined ranges for data.  We tried to make the common case easy for
them, while still allowing not-common use cases possible.  We do plan
to improve the UI in the future.  Context aside, here's your fix:

set volume_data_range, X

where X is the number (or fraction) of +/- sigma-levels PyMOL should
map out on the X axis.  The default is 5.  After you change this
value, please reload the Volume editor, by clicking on the "Volume"
button (twice).  For your data if you need to hit 30 "sigma levels" to
get to 172.6, then set volume_data_range to 30.  Again, this was for
statistically normalized crystallographic data and your data may not
be normal and thus not have "sigma" levels with meaning.  In that
case, just try the numbers and see what works for you.  You can also
use fractional values to focus on a narrow portion of the data (around
the mean).

I'm going to give that a try. Maybe if I find some time I'm going to write the volume class closer to my need and post somewhere the code. For this I would really like to be able to see what gets passed thru it interactively (the reason why I've asked about iPyton).
 

> Also right clicking on the volume representation raises the following error
>
> Error: 2
> <type 'exceptions.TypeError'> Exception in Tk callback
>   Function: <bound method Volume.editPoint of
> <pmg_tk.skins.normal.volume.Volume instance at 0x2aaaac556b90>> (type: <type
> 'instancemethod'>)
>   Args: (<Tkinter.Event instance at 0x2aaaac7277a0>,)
>   Event type: ButtonPress (type num: 4)
> Traceback (innermost last):
>   File "/usr/lib/python2.7/site-packages/Pmw/Pmw_1_3/lib/PmwBase.py", line
> 1747, in __call__
>     return apply(self.func, args)
>   File "/usr/lib64/python2.7/site-packages/pmg_tk/skins/normal/volume.py",
> line 369, in editPoint
>     event.x = self.active_ramp.getPoint(pt) + self.padX
> <type 'exceptions.TypeError'>: unsupported operand type(s) for +: 'NoneType'
> and 'int'

This is a bug.  We'll fix this.  In the meantime, please right-click
closer to color points.  Right-clicking a point will allow you to edit
it.  Right-clicking the background will bring up that exception.  You
can delete points with the middle mouse button.


> Finally is it possible to use Pymol from within iPython? For example I
> wanted recently to see the properties of a C object. That would have been
> extremly easy in iPython
>
> import pymol
> cube = pymol.cmd.load("my.cube")
> cube.[TAB] [TAB]


This is what I get in iPython

In [4]: cube = pymol.cmd.load("my_cube.cube")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/marius/<ipython console> in <module>()

/usr/lib64/python2.7/site-packages/pymol/importing.pyc in load(filename, object, state, format, finish, discrete, quiet, multiplex, zoom, partial, mimic, _self)
    870                           discrete,quiet,multiplex,zoom,mimic,_self=_self)
    871         finally:
--> 872             _self.unlock(r,_self)
    873         if go_to_first_scene:
    874             if int(_self.get_setting_legacy("presentation_auto_start"))!=0:

/usr/lib64/python2.7/site-packages/pymol/locking.pyc in unlock(result, _self)
     77
     78 def unlock(result=None,_self=cmd): # INTERNAL
---> 79     if (thread.get_ident() == pymol.glutThread):
     80         if _self.reaper:
     81             try:

AttributeError: 'module' object has no attribute 'glutThread'

Regards,
Marius

I think it should be, but I haven't tried.  iPython will have to use
the same Python that you used to build PyMOL.

Cheers,

-- Jason

--
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC

(e) Jason.Vertrees@schrodinger.com
(o) +1 (603) 374-7120