[Chimera-users] Using the modeldisp command

Eric Pettersen pett at cgl.ucsf.edu
Tue Feb 7 12:06:55 PST 2012

Hi Forbes,
	The trick is that, unlike a Chimera command file, there is no  
implicit "wait 1" (i.e. show a new frame) at the end of commands  
executed with the Python runCommand call.  Therefore with this  
sequence of runCommands:

	runCommand("color red")
	runCommand("color green")
	runCommand("color blue")

the display will never show the models colored red or green, just  
blue.  So, with the print command removed from your
script the modeldisp/~modeldisp commands are executed "back to back"  
and you never see anything.  Though due to the arcane minutiae of how  
the print command works, you do wind up getting a frame redraw after a  
print which is why it works with the print in there.
	Also, Chimera does not execute at all (including frame redraws)  
during your time.sleep(0.1).  To get the script to work the way you  
want your options are:

	1) add "; wait 1" to the end of the modeldisp commands
	2) change time.sleep(0.1) to runCommand("wait 3") [3 frames at 30  
	3) both

Sorry for the inscrutableness of all this.


On Feb 6, 2012, at 7:10 PM, Forbes J. Burkowski wrote:

> Hi:
> I have given my students a little problem that involves producing an
> "animation" with each step in the animation being a PDB model within  
> an
> NMR generated file.  The solution to the problem is more complicated  
> than
> what is shown in the script below involving as it does the  
> calculation of
> RMSDs to get smoother transitions between successive displays of the
> models.
> My answer script is not working as expected due to an issue that I  
> have
> recreated in a shorter script that follows next:
> import chimera
> from chimera import runCommand
> import time
> numCycles = 10
> # ID's to try: 1BMR, 1DW5, 1QDP, 1D1H, 1N4N, 1IJC, 1PFD, 2LI3, 1AH1
> prot_L = chimera.openModels.open("1AH1", type="PDB")
> numModels = len(prot_L)
> runCommand("~modeldisp")
> for ic in range(numCycles):
>    for aix in range(numModels):
>        subIDstr = str(prot_L[aix].subid)
>        command = "modeldisp #0" + "." + subIDstr
>        runCommand(command)
>        time.sleep(0.1)
>        command = "~modeldisp #0" + "." + subIDstr
>        # The following print command seems to be necessary to get
>        # the animation!
>        print command
>        runCommand(command)
> This script runs just fine and does exactly what I wanted it to do.   
> Here
> is the problem: If I remove the print statement, initially there for
> debugging, the script does not work!  It seems weird that printing the
> argument for the runCommand would have any effect on the execution  
> of the
> runCommand statement.  Am I missing some vital point here????
> I am running the latest version of Chimera: (version 1.6 build 35398)
> under Windows 7 Professional.  Prior to each run I have being doing
> File... Close Session
> to eliminate any models that were brought in on a previous run.
> Cheers,
> Forbes Burkowski
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

More information about the Chimera-users mailing list