I started to add code to relax to enable interfacing with PyMOL. I
have used the information below 'pymol -qp' to open a pipe to write to
PyMOL, however I am having problems with the program quiting. The
issue is that if relax terminates, the pipe closes and PyMOL exits
saying:
PyMOL: normal program termination.
I'm not sure how to stop PyMOL from exiting when relax finishes?
Using exactly the same code with Molmol isn't a problem, relax
terminates and Molmol is happy to continue running. A script which
triggers the problem is:
-----
from time import sleep
# Create the run.
run.create('test', 'mf')
# Execute PyMOL.
pymol.view('test')
# Wait 30 seconds before terminating relax (by dropping off the end of
the script).
sleep(30)
-----
The user function 'pymol.view()' is the only functional function, if
you can call it that. The pymol code is within the branch
'tensor_pdb'. It's location in the subversion repository at
'branches/tensor_pdb' and the code can be checked out anonymously
using the command:
svn co svn://svn.gna.org/svn/relax/branches/tensor_pdb
or:
svn co http://svn.gna.org/svn/relax/branches/tensor_pdb
Any help would be appreciated.
Cheers,
Edward
On 10/28/06, Douglas Kojetin <douglas.kojetin@xxxxxxxxx> wrote:
Here is the an example of how to do this in Tcl:
set PYMOL [open "|pymol -pq " w]
puts $PYMOL "viewport 400,400"
puts $PYMOL "load file.pdf"
puts $PYMOL "hide all"
puts $PYMOL "show ribbon"
puts $PYMOL "color blue"
puts $PYMOL "zoom"
flush $PYMOL
puts $PYMOL "color red"
flush $PYMOL
puts $PYMOL "hide all"
puts $PYMOL "show spheres"
puts $PYMOL "color lime"
flush $PYMOL
Here is a page describing the command line options:
http://www.pymolwiki.org/index.php/Command_Line_Options
I used -p and -q above. From the above link:
-q Quiet launch. Suppress splash screen & other chatter.
-p Listen for commands on standard input.
One can use the normal PyMOL commands/settings as well. See the
PyMOLWiki for more info, such as this list of settings:
http://www.pymolwiki.org/index.php/Settings
I'm sure there at Python equivalents for Tcl's open, puts and flush.
I could try to figure these out if you would like.
Doug
On Oct 27, 2006, at 11:29 AM, Edward d'Auvergne wrote:
> On 10/28/06, Douglas Kojetin <douglas.kojetin@xxxxxxxxx> wrote:
>> Hi Edward-
>>
>> I am able to feed commands into PyMOL from Tcl/Tk scripts through the
>> use of UNIX pipes. From within the Tcl/Tk script, a pipe is opened
>> to PyMOL, and the script sends commands to PyMOL. I can tell PyMOL
>> to open a PDB file, display it in a certain way (cartoon, ribbon),
>> highlight certain atoms or residues (by sticks, spheres, etc.), color
>> them, etc. I've never tried writing images, but I don't think it
>> would be too difficult. Is this the type of functionality you are
>> looking to incorporate into relax?
>
> This is exactly what is needed. I didn't realise it accepted commands
> from STDIN, I told you I didn't look very hard! That makes things
> very easy to implement. Is there documentation for this interface?
> Are they python commands you send?
>
> Edward
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-devel mailing list
relax-devel@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel