From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Jan 31 2005 - 13:21:05 CST

Jay,
  Assuming you've been able to load your XYZ file into
VMD without any trouble, the interesting part will be getting
the per-atom time-varying scalar values of interest into
the "user" field of VMD so you can use it to color your
structure. If the value of interest is based on the
atomic coordinates, such as position, or something along
those lines, the process would be relatively simple, as you
can simply calculate the "user" values based on data that's
already in VMD. If you need to read in data from an external
file or files, then things will be more interesting, and
you'll have to learn more Tcl programming to get it done,
since you'll have to parse the external files and such.
If you're new to Tcl, there's a lot of information available
from the main Tcl web site:
  http://www.tcl.tk/

Here's a very simple example script that sets the "user" values
for an atom selection (in this case, "all") in a time-varying fashion:

##
## Example script that sets the "User" data field with time varying values
## which can be used to color over time
##

##
## load a fake "trajectory" by repeatedly loading the same PDB :-)
##
set file /Home/h2/johns/vmd/proteins/brH.pdb
if {[molinfo num] > 0} {
  mol delete all
}
mol new $file
for {set i 0} {$i<20} {incr i} {
  mol addfile $file
}

##
## Make an atom selection, set the "User" fields for all atoms
## in the selection ("all" in this case since I'm too lazy to do
## something more interesting)
##
set numframes [molinfo top get numframes]
set sel [atomselect top "all"]
for {set i 0} {$i<$numframes} {incr i} {
  animate goto $i
  $sel frame $i
  puts "Setting User data for frame [$sel frame] ..."
  $sel set user $i
}
$sel delete

##
## change the "color by" and "trajectory" tab settings so that
## the new color values, and start it animating...
##
mol modcolor 0 0 User
mol colupdate 0 0 1
mol scaleminmax 0 0 0.0 $numframes
animate forward

On Sat, Jan 29, 2005 at 03:57:05PM -0800, Jay Lee wrote:
> Hi,
>
> I have some questions. Would you help on those?
> Since I am a beginner, I need your kind help.
>
> Basically, I would like to make a movie out of xyz
> with dynamic coloring.
>
> for example, if i have 100 atoms, and I run MD 100
> steps, I would like to color of each atom based on its
> own dynamic scalar value (like distances from center,
> energies, velocities...which vary by each step)
> I might write positions with scalar value of all steps
> (100 steps in this case) into xyz file.
>
> My question is
>
> 1. Is there any one who can share a script to make a
> movie as I decribed ?
>
> 2. If I have a tcl script for that, how to populate
> the "user" field for coloring?
>
> Thank you for your time.
> Have a nice day.
>
> Jay Lee
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail

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