[Chimera-users] Motion of an atom
conrad at cgl.ucsf.edu
Wed Jul 11 10:22:58 PDT 2012
This script works for me on the current daily build. It should work on
all versions of Chimera.
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):
> 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
> <mailto: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
> 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 Pettersen
> UCSF Computer Graphics Lab
> 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 <mailto:Chimera-users at cgl.ucsf.edu>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 436 bytes
Desc: not available
More information about the Chimera-users