From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Jun 30 2004 - 13:32:28 CDT

Axel,
  We've already got a portable millisecond delay routine in VMD itself,
so if you think it would be useful to have that accessible via scripting
I could probably add a Tcl binding for it.

  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Jun 30, 2004 at 09:25:26AM +0200, Axel Kohlmeyer wrote:
>
> On Tue, 29 Jun 2004, Heshe Peshkin wrote:
>
> heshe,
>
> perhaps you can live with just loading all your
> configurations as separate molecules and then
> use a small tcl script to loop over the molecule
> indices and toggle the displayed status for the
> molecules.
>
> please see the attached vmd script.
>
> this will load 5 frames as molecules and then define a procedure
> molmovie that takes two (optional) arguments, the
> number of loops (default 10) and the delay between
> two frames (default 1 second).
>
> please modify it appropriately and then type
>
> molmovie 1 0
>
> at the vmd prompt. you should then see vmd display
> all loaded molecules, one after the other, as fast
> as possible.
>
> please let me know, if this works for you.
>
> regards,
> axel kohlmeyer.
>
> p.s.: for this kind of setup it would be nice, if VMD
> would allow sub-second precision delays with the sleep
> command.
>
> on a wide variety of unix platforms the following code
> has worked very well for me. i don't know how well this
> translates to windows, though.
>
>
>
> /*! sleep for some milliseconds */
> void ms_sleep(const int ms) {
> struct timeval tv;
>
> // convert milliseconds into seconds and microseconds
> tv.tv_sec = ms / 1000; tv.tv_usec = 1000 * (ms % 1000);
>
> if (select(0, NULL, NULL, NULL, &tv) < 0) {
> cerr << "ms_sleep: select error: "
> << strerror(errno) << endl;
> }
> }
>
>
>
> HP> Hello.
> HP>
> HP> I have the following problem: I am trying to make an "inbox" (wrapped)
> HP> movie of a polymer system with periodic boundaries. Contrary to the
> HP> unwrapped version, where I only have one PSF file for all the steps and
> HP> all the frames can be incorporated into one unit, here each step has its
> HP> own PSF (connectivity) and PDB (coordinates) file and each frame behaves
> HP> as separate. It is important that I make the movie exactly in the wrapped
> HP> version because there are some association going on in the system and I
> HP> might not capture all of it if I am looking at the unwrapped version (for
> HP> example if two elements are exactly one box away i will see them as
> HP> separate but in fact they will be associated).
> HP> Working with dynamic bonds doesn't help because it creates artificial
> HP> bonds between neighboring but not connected atoms, and between the
> HP> associating elements as well (or if the cutoff distance is too big then a
> HP> part of the existing bonds disappears). And last but not least, loading
> HP> all the frames, opening them one by one and rendering snapshots will take
> HP> forever.
> HP> So - how can I make my movie?
> HP>
> HP> Thanks in advance for any ideas.
> HP>
> HP> __________________________________________________
> HP> Do You Yahoo!?
> HP> Tired of spam? Yahoo! Mail has the best spam protection around
> HP> http://mail.yahoo.com
> HP>
> HP>
>
> --
>
>
> =======================================================================
> Dr. Axel Kohlmeyer e-mail: axel.kohlmeyer_at_rub.de
> Lehrstuhl fuer Theoretische Chemie Phone: ++49 (0)234/32-26673
> Ruhr-Universitaet Bochum - NC 03/53 Fax: ++49 (0)234/32-14045
> D-44780 Bochum http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/
> =======================================================================
>

>
> # create a movie from separate molecules.
>
>
> # load frames as separate molecules. of course in case of psf+pdb files,
> # this has to be 'mol new step-1.psf ; mol addfile step-1.pdb'
> mol new step-1.pdb
> mol new step-2.pdb
> mol new step-3.pdb
> mol new step-4.pdb
> mol new step-5.pdb
>
> # now disable all molecules
> for {set i 0} {$i < [molinfo num]} {incr i} {
> mol off $i
> }
>
>
> # now create an animation by sequentially
> # turning the molecules on and off
> # default is to wait a second between frames
> proc molmovie {{loops 10} {delay 1}} {
> global molmovie_last
>
> set nmols [molinfo num]
> display update on
> if {![info exists molmovie_last]} {
> set molmovie_last [expr $nmols - 1]
> }
>
> for {set i 0} {$i < $loops} {incr i} {
> for {set n 0} {$n < $nmols} {incr n} {
> display update
> display update ui
> mol on $n
> mol off $molmovie_last
> set molmovie_last $n
> sleep $delay
> }
> }
> }

-- 
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