pymol-open-source icon indicating copy to clipboard operation
pymol-open-source copied to clipboard

Build geometry and render separately when importing pymol as a module

Open giagitom opened this issue 6 years ago • 3 comments

Hi, I noticed that when PyMol is in batch mode or is imported as a module, commands like build geometries, coloring and so on seems to be delayed until the first ray trace command is reached. Is there a way to execute commands one by one when pymol is imported as a module?

giagitom avatar Nov 29 '18 20:11 giagitom

You are right, geometry update is triggered by rendering. What do you mean by executing commands one by one? What's your use case?

speleo3 avatar Dec 11 '18 14:12 speleo3

At the moment I need to discriminate between single-threaded geometry building phase and multi-threaded rendering phase. A workaround I have found could be to exec the command cmd.ray(renderer=2) after the geometry building phase. Maybe there is a better solution?

By executing "one by one" I mean execute commands like it would be using pymol in GUI mode

giagitom avatar Dec 12 '18 10:12 giagitom

I also noticed a different behavior when running the following code in batch mode with and without the cmd.ray(renderer=2) :

from pymol import cmd

cmd.fetch("1c0k",async=0)
cmd.set("gaussian_resolution",4)
cmd.set("gaussian_b_floor",120)
cmd.map_new("map","gaussian",1,"1c0k")

cmd.isosurface("iso1","map",1)
cmd.ray(renderer=2) #try to remove this command

cmd.transform_object("map",[0, -1, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 181.005, 181.005, 68.185, 1],transpose=1)

cmd.isosurface("iso2","map",1)
cmd.ray(renderer=2) #try to remove this command

cmd.delete("map")

cmd.png("test.png")

Without the two cmd.ray commands, isosurfaces are not shown in the final image

giagitom avatar Dec 17 '18 18:12 giagitom