From: Axel Kohlmeyer (
Date: Fri Jul 29 2011 - 18:05:32 CDT

On Fri, Jul 29, 2011 at 5:58 PM, Debasis Sengupta <> wrote:
> Hi,
> I have created a trajectory file which has variable number of atoms in each
> frame.  VMD appears to be reading only the first frame. My objective is to

yes. VMD currently only supports trajectories with the same number
of atoms in every frame.

> follow the environment of certain atoms in the trajectory.  For example, I
> want follow the environment of atom numbers, say, i, j and k in entire
> trajectory file. What I have done is, I created a secondary trajectory file
> (wrote a utility code to by reading the main trajectory file created by the
> MD program) containing atoms that are within, say, 3 angstroms from the
> atoms i, j and k.   Is there any way this can be done within VMD in easier
> way? I am not familiar with the VMD scripting. If scripting is the only

yes. you just load the full trajectory and then change the "atom
selection text"
from "all" to "within 3.0 of index i j k" and then activate the
"Update Selection
Every Frame" button in the Trajectory tab of the representation.

some more complex examples with scripts are in chapter 6 of this pdf.

> answer, does anyone have any such script? Thanks

i would recommend that before asking for "a script" you work your way
through the VMD user's guide and tutorial. they contain a _lot_ of useful
information and it will also save you from the embarrassment of asking
for something that is simple to do.

there also is a way to read trajectory files with a variable number of atoms,
buy automatically adding sufficient padding and a few more tricks.
this is implemented in the topotools plugin for .xyz format files.

but i recommend against using it, unless you have no alternative.


> Debasis

Dr. Axel Kohlmeyer
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.