[Chimera-users] Motion of an atom
Raju Purohit
rajurnpurohit at gmail.com
Wed Jul 11 06:26:20 PDT 2012
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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20120711/9e465bd7/attachment.html>
More information about the Chimera-users
mailing list