From: John Stone (
Date: Tue Mar 04 2008 - 15:26:04 CST

  For the sort of visualization you're doing, you will need to
express the the atom type to VMD in a different way. VMD actually won't
let atom types change during the course of a trajectory, so in order to
do the sort of thing you have in mind, you'll want to use one of the
time-varying "user" data fields to store the atom type as a numeric value.
In your XYZ file, you'll just list the atoms types as being identical,
VMD only looks at the first frame anyway. Subsequent to loading the XYZ
file, you'll use a Tcl script to populate the "user" fields for each
atom with their atom type at that frame. From there, you can use atom
selections on the "user" values to display things in any way you like.

Here is an extremely crude example script you can start from:

## 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/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 Wed, Mar 05, 2008 at 02:49:58AM +0530, Suman Chakrabarty wrote:
> Dear all,
> I have just started using VMD for some visualization of simple
> Lennard-Jones fluid systems. I am facing some problems to do the following:
> My system consists of only two types of atoms (Lennard-Jones particles):
> A and B. Their identities can interchange. So, the number of A and B
> changes during the simulation. In some cases even the total number is
> not constant, i.e. some particles can diseapear from the system.
> I want to visualize the trajectory of only A type atoms throughout the
> simulation.
> Since I am new to file formats, I am using simple XYZ format as follows:
> total number of A type atoms in the system in the first line followed by
> an empty line and then coordinates like "H x-coord y-coord z-coord"
> (let's say the A type to be Hydrogen). Different frames will be appended
> one after another, with changing number of particles at every frame.
> Even the "Update Selection Every Frame" option is not serving the
> purpose (if I have correctly understood the purpose!). It always assumes
> the number of particles given at the first frame!
> Please help me to achieve this goal using VMD. I can provide further
> information regarding my system if needed.
> Thanks,
> Suman Chakrabarty.
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

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:                 Phone: 217-244-3349
  WWW:      Fax: 217-244-6078