[Chimera-users] time counter

Eric Pettersen pett at cgl.ucsf.edu
Wed Jun 26 11:21:42 PDT 2019

Hi Clara,
	Since you want to do some math with the frame number, I think you’ll need to resort to Python, but since you know all the Chimera command equivalents, it won’t be that hard.  The trick is to be aware that the following Python code will execute Chimera commands:

from chimera import runCommand
runCommand(“some chimera command here”)
runCommand(“another chimera command”)

So if you use a Python as the MD Movie per-frame script, it could be something like:

from chimera import runCommand
if mdInfo[‘frame’] == 1:
	runCommand(“2dlabels create timer text “0 ns" size 40 color white”)
	runCommand(“2dlabels change timer text “%.2f ns” % (mdInfo[‘frame] / 1000.0))

On the first frame it creates the label, and on subsequent frames it updates the label with a 2-decimal-place floating-point number [i.e. the format “%.2f” in the string] taken from the current frame number divided by 1000.
	Note that indentation is significant in Python, so the runCommand statements inside the if/else have to be indented the way I’ve shown.


	Eric Pettersen
	UCSF Computer Graphics Lab

> On Jun 26, 2019, at 6:02 AM, CLARA BLANES MIRA <c.blanes at goumh.umh.es> wrote:
> Dear chimera users,
> I have two doubts regarding per-frame actions:
> 1) I am trying to add a counter in my script (commands script, no python script). 
> It works when I do it as a per-frame action in the MD Movie window (just as Elaine does in the’Trajectory and ensemble Analysis Tutorial’)  but I am not able to do insert it in my command script: 
> Something like this:
> movie record
> 2dlabels create timer text “frame 0" size 40 color white
> alias ^actions 2dlabels change timer text "frame <FRAME>"
> perframe actions; coordset #0 1,216000,1000 load false; wait 216; ~perframe  
> movie encode movie.mp4
> 2) What I really want is to show nanoseconds, not frames. In my case 1000 frames = 1 ns. When I write frame <FRAME>/1000 in MD Movie window, obviously, it does not work. Any suggestion to make it work and insert it in the commands script?
> Thank you very much!,
> Clara
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20190626/dac0b862/attachment.html>

More information about the Chimera-users mailing list