
Hello friends, I need some help here. I created a basic model having just an atom and set its coordinates as (0,0,0). Now I want to make it move along a certain path defined mathematically (say, along x axis) and I need to see it move. So I used a * for* loop. But I couldn't see and motion and soon realised that the loop is very quick in executing and thus I could see the atom at its last coordinates. So I tried to add delay of 0.5 seconds for each loop by importing *time* module and useing *time.sleep*. But still I couldn't see any motion and the coordinates of the atom is set only at the end of the *for* loop. I could not see the intermediate path. I am sure you people must have tried this earlier and this problem has a solution but I just couldn't figure it out. Can you please help me out? Thank you in advance. -- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal

Hi Raju, It sounds like you are trying to do some programming, but instead you could just use Chimera commands, e.g. "move" to translate atom(s). Chimera commands can be entered into the Command Line (show using Favorites menu), or you can put them into a plain text file named *.cmd -- then opening the file in Chimera will execute the commands in the file. < http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/movies.html#moviecommands> <http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/indexcommand.html#cmdfile> Example command: move x .1 50 ... to move along laboratory X axis 0.1 angstroms for each of 50 frames. I hope this helps, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Jul 10, 2012, at 9:07 AM, Raju Purohit wrote:
Hello friends,
I need some help here.
I created a basic model having just an atom and set its coordinates as (0,0,0). Now I want to make it move along a certain path defined mathematically (say, along x axis) and I need to see it move. So I used a for loop. But I couldn't see and motion and soon realised that the loop is very quick in executing and thus I could see the atom at its last coordinates. So I tried to add delay of 0.5 seconds for each loop by importing time module and useing time.sleep. But still I couldn't see any motion and the coordinates of the atom is set only at the end of the for loop. I could not see the intermediate path. I am sure you people must have tried this earlier and this problem has a solution but I just couldn't figure it out.
Can you please help me out?
Thank you in advance.
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal

Hi Elaine, Thanks for your quick reply. The method you suggested is nice but I actually want to change the coordinates of the atom. In the present case, there is only one atom. In my next step, I will have to work with molecules and will have to make just a few atoms to move. And moreover, my project work uses chimera python for everything, so I would be glad if you can suggest me a python command. Thanks. On Tue, Jul 10, 2012 at 6:17 PM, Elaine Meng <meng@cgl.ucsf.edu> wrote:
Hi Raju, It sounds like you are trying to do some programming, but instead you could just use Chimera commands, e.g. "move" to translate atom(s). Chimera commands can be entered into the Command Line (show using Favorites menu), or you can put them into a plain text file named *.cmd -- then opening the file in Chimera will execute the commands in the file.
< http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/movies.html#moviecom...
< http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/indexcommand.html#cm...
Example command: move x .1 50
... to move along laboratory X axis 0.1 angstroms for each of 50 frames. I hope this helps, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco
On Jul 10, 2012, at 9:07 AM, Raju Purohit wrote:
Hello friends,
I need some help here.
I created a basic model having just an atom and set its coordinates as (0,0,0). Now I want to make it move along a certain path defined mathematically (say, along x axis) and I need to see it move. So I used a for loop. But I couldn't see and motion and soon realised that the loop is very quick in executing and thus I could see the atom at its last coordinates. So I tried to add delay of 0.5 seconds for each loop by importing time module and useing time.sleep. But still I couldn't see any motion and the coordinates of the atom is set only at the end of the for loop. I could not see the intermediate path. I am sure you people must have tried this earlier and this problem has a solution but I just couldn't figure it out.
Can you please help me out?
Thank you in advance.
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal

Hi Raju, During the execution of a Python script, Chimera does not redraw the graphics screen until explicitly requested or when the script ends. The simplest way to ask for a redraw is to execute the "wait 1" Chimera command, which you can do from Python with: from chimera import runCommand runCommand("wait 1") So if you embed that in your loop you should be able to see your atom move. Frames are redrawn at a rate of 25 per second (though future versions of Chimera may allow faster redraw rates), so you may want to wait more than 1 frame if the atoms moves too fast. Alternatively, there is also a direct Python call to wait(): from Midas import wait wait(1) FYI, there is another mailing list, chimera-dev, where programming-intensive questions like this one are more appropriate, so that the regular user's eyes don't glaze over. :-) --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Jul 10, 2012, at 9:07 AM, Raju Purohit wrote:
Hello friends,
I need some help here.
I created a basic model having just an atom and set its coordinates as (0,0,0). Now I want to make it move along a certain path defined mathematically (say, along x axis) and I need to see it move. So I used a for loop. But I couldn't see and motion and soon realised that the loop is very quick in executing and thus I could see the atom at its last coordinates. So I tried to add delay of 0.5 seconds for each loop by importing time module and useing time.sleep. But still I couldn't see any motion and the coordinates of the atom is set only at the end of the for loop. I could not see the intermediate path. I am sure you people must have tried this earlier and this problem has a solution but I just couldn't figure it out.
Can you please help me out?
Thank you in advance.
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

wait function doesn't seem to help. If I use wait(<some positive integer>), python stops executing ahead and hangs. If I use wait(<zero or some negative integer>), the code runs ignoring wait. This is my program: I have defined a variable atom1 which is an atom in chimera. Then I execute this program:
atom1.setCoord(chimera.Point(0,0,0)); for i in range(5): time.sleep(0.1); atom1.setCoord(chimera.Point(0,0,i)); wait(1);
I was expecting to see the atom move by 1 unit every loop but that does not happen. What would you suggest me to insert in this for loop so that the value on atom1 is updated in chimera? Thank you. On Tue, Jul 10, 2012 at 7:22 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Hi Raju, During the execution of a Python script, Chimera does not redraw the graphics screen until explicitly requested or when the script ends. The simplest way to ask for a redraw is to execute the "wait 1" Chimera command, which you can do from Python with:
from chimera import runCommand runCommand("wait 1")
So if you embed that in your loop you should be able to see your atom move. Frames are redrawn at a rate of 25 per second (though future versions of Chimera may allow faster redraw rates), so you may want to wait more than 1 frame if the atoms moves too fast. Alternatively, there is also a direct Python call to wait():
from Midas import wait wait(1)
FYI, there is another mailing list, chimera-dev, where programming-intensive questions like this one are more appropriate, so that the regular user's eyes don't glaze over. :-)
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
On Jul 10, 2012, at 9:07 AM, Raju Purohit wrote:
Hello friends,
I need some help here.
I created a basic model having just an atom and set its coordinates as (0,0,0). Now I want to make it move along a certain path defined mathematically (say, along x axis) and I need to see it move. So I used a *for* loop. But I couldn't see and motion and soon realised that the loop is very quick in executing and thus I could see the atom at its last coordinates. So I tried to add delay of 0.5 seconds for each loop by importing *time* module and useing *time.sleep*. But still I couldn't see any motion and the coordinates of the atom is set only at the end of the *for* loop. I could not see the intermediate path. I am sure you people must have tried this earlier and this problem has a solution but I just couldn't figure it out.
Can you please help me out?
Thank you in advance.
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal

This script works for me on the current daily build. It should work on all versions of Chimera. Conrad On 7/11/12 6:26 AM, Raju Purohit wrote:
wait function doesn't seem to help. If I use wait(<some positive integer>), python stops executing ahead and hangs. If I use wait(<zero or some negative integer>), the code runs ignoring wait.
This is my program: I have defined a variable atom1 which is an atom in chimera. Then I execute this program:
atom1.setCoord(chimera.Point(0,0,0)); for i in range(5): time.sleep(0.1); atom1.setCoord(chimera.Point(0,0,i)); wait(1);
I was expecting to see the atom move by 1 unit every loop but that does not happen. What would you suggest me to insert in this for loop so that the value on atom1 is updated in chimera?
Thank you.
On Tue, Jul 10, 2012 at 7:22 PM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
Hi Raju, During the execution of a Python script, Chimera does not redraw the graphics screen until explicitly requested or when the script ends. The simplest way to ask for a redraw is to execute the "wait 1" Chimera command, which you can do from Python with:
from chimera import runCommand runCommand("wait 1")
So if you embed that in your loop you should be able to see your atom move. Frames are redrawn at a rate of 25 per second (though future versions of Chimera may allow faster redraw rates), so you may want to wait more than 1 frame if the atoms moves too fast. Alternatively, there is also a direct Python call to wait():
from Midas import wait wait(1)
FYI, there is another mailing list, chimera-dev, where programming-intensive questions like this one are more appropriate, so that the regular user's eyes don't glaze over. :-)
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
On Jul 10, 2012, at 9:07 AM, Raju Purohit wrote:
Hello friends,
I need some help here.
I created a basic model having just an atom and set its coordinates as (0,0,0). Now I want to make it move along a certain path defined mathematically (say, along x axis) and I need to see it move. So I used a *for* loop. But I couldn't see and motion and soon realised that the loop is very quick in executing and thus I could see the atom at its last coordinates. So I tried to add delay of 0.5 seconds for each loop by importing *time* module and useing *time.sleep*. But still I couldn't see any motion and the coordinates of the atom is set only at the end of the *for* loop. I could not see the intermediate path. I am sure you people must have tried this earlier and this problem has a solution but I just couldn't figure it out.
Can you please help me out?
Thank you in advance.
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Raju R.N. Third Year, B.Tech Mechanical Engineering National Institute of Technology Karnataka, Surathkal
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (4)
-
Conrad Huang
-
Elaine Meng
-
Eric Pettersen
-
Raju Purohit