Hi, pymol.cmd.refresh() doesn't work when the function is placed before cmd.png(), but works when placed after. As cmd.refresh() is much faster than time.sleep(1), the script is now quicker (I used this function to get the 2D pictures from a sdf file containing less than 100 structures).
here is now the corrected script : def mol2png(ctfile,name): pymol.cmd.read_molstr(ctfile,name) pymol.cmd.set("valence",1) pymol.cmd.hide("all") pymol.cmd.show("sticks") pymol.cmd.set("stick_radius",1) pymol.cmd.color("black","elem c") pymol.cmd.color("red","elem o") pymol.cmd.color("blue","elem n") pymol.cmd.color("yellow","elem s") pymol.cmd.bg_color("white") pymol.cmd.zoom(name) pymol.cmd.ray() pymol.cmd.png(name) pymol.cmd.refresh() pymol.cmd.delete(name) Works fine with a Centrino (1.6GHz) laptop and Linux Debian (sarge). Thanks, Jerome Pansanel Selon Warren DeLano <war...@delsci.com>: > Jerome, > > Try calling > > pymol.cmd.refresh() > > before > > pymol.cmd.png(name) > > Cheers, > Warren > > -- > Warren L. DeLano, Ph.D. > Principal Scientist > > . DeLano Scientific LLC > . 400 Oyster Point Blvd., Suite 213 > . South San Francisco, CA 94080 USA > . Biz:(650)-872-0942 Tech:(650)-872-0834 > . Fax:(650)-872-0273 Cell:(650)-346-1154 > . mailto:war...@delsci.com > > > > -----Original Message----- > > From: pymol-users-ad...@lists.sourceforge.net > > [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of > > Jerome PANSANEL > > Sent: Friday, January 06, 2006 5:06 AM > > To: pymol-users@lists.sourceforge.net > > Subject: [PyMOL] Python scripting for Pymol > > > > Hi, > > > > I writing a small script in python, in order to export png > > picture from a MDL sdfile. > > Here is a sample of the function : > > > > def mol2png(ctfile,name): > > pymol.cmd.read_molstr(ctfile,name) > > pymol.cmd.set("valence",1) > > pymol.cmd.color("black","elem c") > > pymol.cmd.color("red","elem o") > > pymol.cmd.color("blue","elem n") > > pymol.cmd.color("yellow","elem s") > > pymol.cmd.bg_color("white") > > pymol.cmd.zoom(name) > > pymol.cmd.png(name) > > time.sleep( 1 ) > > pymol.cmd.delete(name) > > > > > > It works fine only if I have the function time.sleep(1). If > > not, I have only empty pictures. Is there another solution to > > delete the molecule only when the png file has been written ? > > > > Thanks, > > > > Jerome Pansanel > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep > > through log files for problems? Stop! Download the new AJAX > > search engine that makes searching your log files as easy as > > surfing the web. DOWNLOAD SPLUNK! > > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > > _______________________________________________ > > PyMOL-users mailing list > > PyMOL-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/pymol-users > > > > > > > > > -------------------------------------------- Mail sent through IMP: http://horde.org/imp/