Hello Stuart,

 

By default, alter_state expressions are evaluated in the "pymol"
namespace of the current PyMOL instance, not the "cmd" (pymol.cmd)
namespace.  The reason why it works with 'run' is that run also executes
in "pymol" by default, and thus, includes any functions you define.

 

Try:

 

cmd.alter_state(1, copy, "x,y,z = cmd.sym_partner([x,y,z],
stored.tmpOp)")



instead, after using cmd.extend in your startup or GUI script.

 

Cheers,

Warren

 

 

________________________________

From: Stuart Ballard [mailto:srball...@wisc.edu] 
Sent: Monday, August 24, 2009 3:38 PM
To: pymol-users
Subject: [PyMOL] Calling scripted functions within alter_state

 

Hello Warren, all,


I've been working on a plugin for PyMOLX11Hybrid, in which I have a few
lines of code such as:

        cmd.alter_state(1, copy, "x,y,z = sym_partner([x,y,z],
stored.tmpOp)")

AND

    cmd.alter_state(1, object, "x,y,z =
cell_shift_helper([x,y,z],stored.shift)")

Both those functions (sym_partner and cell_shift_helper) are extended
through cmd.extend() function, along with several others which work
perfectly well. The issue arises only when I attempt to use these
functions through a menu added to PyMOL GUI, which does not involve
issuing the run /(filepath)/(script).py command in PyMOL, but rather
initializes necessary commands on startup. I've confirmed that the
cmd.extend() calls are made properly, but I can only fix the problem by
issuing the run command independent of my initialization scripts.

Because this script is planned to be incorporated into a build of PyMOL
which will be run from a variety of file paths, I'd like to know how I
can solve this problem without simply jury rigging a run command. Is
there a way to properly make commands available within an alter_state
command without using the run command?


Thanks,
Stuart Ballard
Dept. of Biochemistry
UW-Madison

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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