Subject: Re: CCL:scripting pymol

From: "Warren L. DeLano" <[email-masked]>
Date: Mon, 28 Oct 2002 20:33:25 -0800 (PST)

Luca,

   For future reference, please direct technical PyMOL questions like
this to the PyMOL mailing list. (See MailLists on http://www.pymol.org)

Over the past couple of years, we've built up an active community of
nearly 300 PyMOL users who are there to learn and to help each other get
the most out of this free/open-source molecular viewer.  Please join in!

The answer to your question is:

Launch PyMOL with a "-p" command-line argument.  PyMOL will then listen
for commands on standard input.  Using a Perl pipe, you can then control
PyMOL interactively and send commands as required in order to load new
structures, change the view, color, and so on.

The only trick with Perl is that you need to turn autoflush on so
that commands get passed along right away.

use FileHandle;
open(FILE,"|pymol -p");
FILE->autoflush(1);
print FILE "load \$PYMOL_PATH/test/dat/pept.pdb\n";
while(1) {
    sleep 0.2;
    print FILE "turn x,5\n";
}

Please excuse my non-OOP-0Perl4-vintage example...I've been a Python
addict for some time now.

If you want PyMOL to be just a minimal molecular display window, then
consider  launching PyMOL as:

pymol -qpxif 0

This will make PyMOL open a single window with no visible GUI, text, or
controls.

Cheers,
Warren

On Mon, 28 Oct 2002, Luca Fenu wrote:

> Dear all,
>
> I need to scan and make a choice about a list of molecules. does anyone
> knows how to send command to pymol through a perl or shell script? I've
> read pymol's manual, and it's possible to pass pymol some scripts, from
> its internal shell. but I don't know how to pass commands to it from
> another program. starting the process in foreground and feeding the
> command from the stdout of perl to the stdin of pymol doesn't work. I
> think pymol use another filehandle for aquiring commands. how can I
> avoid to restar a new pymol for every molecule?
> any suggestion? many thanks
>
> 	luca
>
>
>