<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Clara,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>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:</div><div class=""><br class=""></div><div class="">from chimera import runCommand</div><div class="">runCommand(“some chimera command here”)</div><div class="">runCommand(“another chimera command”)</div><div class=""><br class=""></div><div class="">So if you use a Python as the MD Movie per-frame script, it could be something like:</div><div class=""><br class=""></div><div class="">from chimera import runCommand</div><div class="">if mdInfo[‘frame’] == 1:</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>runCommand(“2dlabels create timer text “0 ns" size 40 color white”)</div><div class="">else:</div><div class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>runCommand(“2dlabels change timer text “%.2f ns” % (mdInfo[‘frame] / 1000.0))</div><div class=""><br class=""></div><div class="">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.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Note that indentation is significant in Python, so the runCommand statements inside the if/else have to be indented the way I’ve shown.</div><div class=""><br class=""></div><div class="">—Eric</div><div class="">
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span class="Apple-tab-span" style="white-space: pre;"><br class="Apple-interchange-newline"> </span>Eric Pettersen</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>UCSF Computer Graphics Lab</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Jun 26, 2019, at 6:02 AM, CLARA BLANES MIRA <<a href="mailto:c.blanes@goumh.umh.es" class="">c.blanes@goumh.umh.es</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Dear chimera users,</div><div class=""><br class=""></div><div class="">I have two doubts regarding per-frame actions:</div><div class=""><br class=""></div><div class="">1) I am trying to add a counter in my script (commands script, no python script). </div><div class=""><br class=""></div><div class="">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: </div><div class=""><br class=""></div><div class="">Something like this:</div><div class=""><br class=""></div><div class=""><div class=""><i class=""><br class=""></i></div><div class=""><i class=""><br class=""></i></div><div class=""><i class=""><font color="#0056d6" class="">movie record</font></i></div><div class=""><i class=""><font color="#0056d6" class="">2dlabels create timer text “frame 0" size 40 color white</font></i></div><div class=""><i class=""><font color="#0056d6" class="">alias ^actions 2dlabels change timer text "frame <FRAME>"</font></i></div><div class=""><i class=""><font color="#0056d6" class=""><br class=""></font></i></div><div class=""><i class=""><font color="#0056d6" class="">perframe actions; coordset #0 1,216000,1000 load false; wait 216; ~perframe </font></i></div><div class=""><i class=""><font color="#0056d6" class="">movie encode movie.mp4</font></i></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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?</div><div class=""><br class=""></div><div class="">Thank you very much!,</div><div class="">Clara</div><div class=""><br class=""></div></div>_______________________________________________<br class="">Chimera-users mailing list: <a href="mailto:Chimera-users@cgl.ucsf.edu" class="">Chimera-users@cgl.ucsf.edu</a><br class="">Manage subscription: <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br class=""></div></blockquote></div><br class=""></div></body></html>