From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Mar 30 2006 - 17:55:05 CST

Hi,
  Since this topic came up, I thought I'd mention that I've written a plugin
that's in the new test versions of VMD that makes it easier to do this
sort of thing, and will also allow you to make Tk windows easily.
Here's a different version of the script that uses the demomaster plugin
rather than doing the timing etc for itself. I fixed a couple of minor
bugs, but this script will work with the code that's in the currently
available test versions:

package require demomaster

proc step1 {} {
  mol delete all
  mol new 1tit
  mol delrep 0 top
  mol representation Tube 0.4 6
  mol color Name
  mol selection {protein}
  mol material Opaque
  mol addrep top
  mol rename top {dimer_LGH.pdb}
}

proc step2 {} {
  myrotate y 360 5
}

proc step3 {} {
  mol delrep 0 top
  mol representation CPK 1.4 0.5 8 8
  mol color Name
  mol selection {protein}
  mol addrep top
}

proc rundemo {} {
  ::DemoMaster::reset
  ::DemoMaster::usewindow .test "Test VMD Demo Window #1"

  ::DemoMaster::addbutton {Start Demo} { step1 } 1
  ::DemoMaster::addbutton {Step 2} { step2 } 10
  ::DemoMaster::addbutton {Step 3} { step3 } 1
  ::DemoMaster::addbutton {Button 4} { puts "workaround a bug" } 1

  ::DemoMaster::packbuttons

  ::DemoMaster::registernexthotkey 1
  ::DemoMaster::registerprevhotkey 2

  ::DemoMaster::printstatus

  ::DemoMaster::autorun
}

On Thu, Mar 30, 2006 at 05:24:24PM -0600, John Stone wrote:
> Hi,
> Due to the way VMD and Tcl handle events, and in particular due to the
> way the scene manipulation commands work (for performance reasons) you
> have to do this a little differently than you might expect:
>
> proc mywait { waittime } {
> set starttime [clock seconds]
> while {[expr [clock seconds] - $starttime < $waittime]} {
> }
> }
>
> proc myrotate { axis angle step } {
> for {set i 0} {$i < $angle} {incr i $step} {
> rotate $axis by $step
> display update ui
> }
> }
>
> mol delete all
> mol new 1tit
> mol delrep 0 top
> mol representation Tube 0.4 6
> mol color Name
>
> mol selection {protein}
> mol material Opaque
> mol addrep top
> mol rename top {dimer_LGH.pdb}
> myrotate y 360 5
> mywait 10
> mol delrep 0 top
> mol representation CPK 1.4 0.5 8 8
> mol color Name
> mol selection {protein}
> mol addrep top
>
>
>
>
>
> On Thu, Mar 30, 2006 at 02:37:49PM -0800, Harindar Keer wrote:
> > Hi,
> >
> > I am trying to write a script describe biological system in VMD. I am
> > trying to do something as following
> > i) Load molecule in CPK representation
> > ii) rotate it by 360
> > ii) And then change representation to VDW after waiting for sometime
> > and then to NewCartoon representation.
> >
> > The issue is all I get to see is NewCartoon representation roataing at
> > the end, I tried wait and also waitfor, suggested by John on mailing
> > list, it seems to stop the rotation and again start after time.
> >
> > I used "play" to load following script
> >
> > mol new {./Desktop/1LGH_A.pdb} type pdb
> > mol delrep 0 top
> > mol representation Tube 0.4 6
> > mol color Name
> >
> > mol selection {protein}
> > mol material Opaque
> > mol addrep top
> > mol rename top {dimer_LGH.pdb}
> > rotate y by 360 5
> > wait 10
> > mol delrep 0 top
> > mol representation CPK 1.4 0.5 8 8
> > mol color Name
> > mol selection {protein}
> > mol addrep top
> >
> >
> >
> > Many thanks,
> > Harindar
>
> --
> NIH Resource for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078