Hi John, Folmer,

First, in reply to Folmer's comment, it did cross my mind whether it
was necessary to call Pymol from a script, rather than the reverse.
But John gave an example with the file to load as command line
argument (./examply.py mymolecule.xyz). If the filename is required
internally in the script, that is, AFAIK, cumbersome in Pymol. You
could of course have a script that only uses global identifiers (all,
n. ca, etc) and run

pymol mymolecule.xyz script.py

or

pymol mymolecule.xyz script.pml

That's what I usually do.

The approach shouldn't matter that much though. Yet it is a bit
puzzling why the response is slower with Pymol called from Python as
compared to direct interaction. To be able to try it, we'd need the
definition of 'dosomething'. I've tried a script which called
cmd.spectrum instead of the 'dosomething', but couldn't say it was
much slower than expected.

Cheers,

Tsjerk

On Thu, Feb 17, 2011 at 9:12 AM, Folmer Fredslund <folm...@gmail.com> wrote:
> Dear John
>
> 2011/2/17 John Russo <lamaro...@gmail.com>:
>> Hi,
>> I'm sorry for making such beginner's questions but searching the manual,
>> google
>> or the wiki didn't help me.
>>
>
> You're welcome to ask here.
>
>> 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.
>>
>
> I saw Tsjerks comment, ( and now yours since I write too slow) but was
> wondering maybe what you need is more simple.
> Do require to load PyMOL from a python script?
>
> If not, then simply put the commands you need into a text file with
> the .pml extension and PyMOL will recognize this when you run it.
>
> An example file (example.pml)
>
> load mymolecule.xyz
> zoom residue 45-60
> png mymolecule.png
>
>
> Then do like this
> pymol -c example.pml
>
> And you get mymolecule.png
>
> Best regards,
>
> --
> Folmer Fredslund
>
> ------------------------------------------------------------------------------
> 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
>



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands

------------------------------------------------------------------------------
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