No idea if this will fix your problem, but what I've found is portable
across binaries from Delano Scientific/Schroedinger and
OS/self-compiled versions of pymol is to instead run:

pymol -r examply.py -- mymolecule.xyz

(or if I'm making pngs, usually pymol -qrck examply.py -- mymolecule.xyz )

The -- makes it so mymolecule.xyz is passed as an argument to the
python script instead of as an argument to pymol

Then examply.py is just

from pymol import cmd
import argv
import mymodule

cmd.load(sys.argv[1])
cmd.hide()
cmd.show("spheres")
mymodule.dosomething()


Note, that pymol has to be able to find mymodule, which if you're
using a Delano Scientific/Schrodinger binary can be annoying, but it
looks like that is already working for you.

Also, http://pymolwiki.org/index.php/Python_Integration makes it look like
pymol -l examply.py -- mymolecule.xyz

may work, but I've never done it, so no idea how the behavior differs.

-David


On Thu, Feb 17, 2011 at 3:05 AM, John Russo <lamaro...@gmail.com> wrote:
> Thanks, that is what I was looking for! I just made a simple
> script out of it which looks like this
>
> #!/usr/bin/env python
>
> import pymol
> from pymol import cmd
> import mymodule
>
> pymol.finish_launching()
>
> cmd.load("mymolecule.xyz")
> cmd.hide()
> cmd.show("spheres")
> mymodule.dosomething()
>
>
> I've noticed something strange though. The dosomething() function just
> colors atoms according to some order parameter. If I execute in the script
> above it is quite slow, I can see individual atoms being colored. Instead if
> I execute dosomething() from within the pymol interpreter it is much faster.
> Any reason for this?
>
>
>
>
>
>
> On 02/17/2011 04:33 PM, Tsjerk Wassenaar wrote:
>> Hi John,
>>
>> Is this what you're looking for?:
>>
>> http://www.pymolwiki.org/index.php/Launching_From_a_Script
>>
>> Cheers,
>>
>> Tsjerk
>>
>> On Thu, Feb 17, 2011 at 8:19 AM, John Russo<lamaro...@gmail.com>  wrote:
>>> Hi,
>>> I'm sorry for making such beginner's questions but searching the manual,
>>> google
>>> or the wiki didn't help me.
>>>
>>> I know how to extend pymol by writing python functions (through the
>>> extend command).
>>> But is it possible to do the opposite? I want to write a script that
>>> loads a molecule, does something
>>> to it and then displays the pymol window or outputs a png file. I want
>>> to this without having to
>>> enter commands in the pymol command line, since I need to put these
>>> operations in a script,
>>> without interactive control on pymol.
>>>
>>> Example. I want to write a script examply.py with which I can do
>>>
>>> ./examply.py mymolecule.xyz
>>>
>>> And for output I want to get mymolecule.png or the pymol window with all
>>> the operations
>>> already done.
>>>
>>> Any hints? Thank you.
>>>
>>>
>>>    John
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
>>> Pinpoint memory and threading errors before they happen.
>>> Find and fix more than 250 security defects in the development cycle.
>>> Locate bottlenecks in serial and parallel code that limit performance.
>>> http://p.sf.net/sfu/intel-dev2devfeb
>>> _______________________________________________
>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>>
>>
>>
>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to