From: Markus M. <m....@un...> - 2003-03-28 14:22:44
|
Dear Kristian, Thank you for your quick answer concerning pymol and python scripts.=20 You answered questions 1-3, indeed. Generator functions are described=20 at http://www.python.org/doc/2.2.2/whatsnew/node5.html and require=20 python 2.2. Questions 4 and 6 I can now answer myself: > 4) Can I temporarily return control to pymol from within a running a=20= > python script and continue running the script after I have finished=20 > interacting with pymol? The spawn command does the trick. I did not check out this ScriptBox=20 Utility yet. > 6) How do I generate symmetry molecules for one selected state of a=20 > molecule only? I have a molecule with 144 states and generating=20 > symmetry objects for all states simultaneously takes too long time and=20= > finally crashes pymol, because all memory is used up. Copy the desired state into a new object and generate the symmetry=20 molecules of this new object: def sym_state(s): cmd.delete("sym*") cmd.delete("tmp") cmd.create("tmp", "MyObject", s, 1) cmd.symexp("sym", "tmp", "tmp", 30) cmd.do("show cell") print("Generated symmetry objects for state " + `s`) return Cheers, Markus On Wednesday, March 26, 2003, at 02:51 pm, Kristian Rother wrote: > > Dear Markus, > >> 1) How can I supply arguments to a python script, >> when I invoke it from >> the pymol command line? > > Write the python script like > > def bla(arg1,arg2): > any.python.commands(arg1,arg2) > return > > from pymol import cmd > cmd.extend('blacommand',bla) > > Now you can call your function 'bla' from the PyMOL > command line: > > PyMOL> blacommand pdb1cso,42 > > Which would be like in Python: > > bla('pdb1cso','42') > > > >> 2) Can I set user variables in the pymol command >> line and access them >> in a python script? > > same answer as for 1). > > >> 3) Can I rerun a python script and use generator >> functions that I >> initialised in the run before? > > Sorry, I did not understand this question completely > (might be same answer as above two). > > >> 4) Can I temporarily return control to pymol from >> within a running a >> python script and continue running the script after >> I have finished >> interacting with pymol? > > You should probably check out the Script Box utility, > if You have not already (http://www.rubor.de/bioinf > > >> 5) Can I query the active state of a pymol object >> (and other properties >> as well) from withing a python script? > > Yes. Look at: > http://www.rubor.de/bioinf/pymol_tips.html#getcoord > > >> 6) > dunno > >> 7) > also. > > Good luck, > > Kristian Rother Markus Meier M. E. M=FCller Institut Biozentrum der Universit=E4t Basel Klingelbergstrasse 70 CH-4056 Basel Tel.: +41 61 267 20 91 Fax: +41 61 267 21 09 |