From: Olaf Lenz (
Date: Fri Feb 08 2013 - 10:01:15 CST

Hash: SHA1


I believe that I have a partial solution to both of your problems.

On 02/08/2013 01:55 PM, Gavin Melaugh wrote:
> 1) Can I load xyz configuration files into VMD, in which the number
> of particles (bacterial cells) is different in each configuration
> file.

As Axel already commented, in principle it is not possible to have a
varying particle number in VMD. However, in conjunction with answer 2),
you can create a file that has the maximum number of atoms of in all
timesteps and set the radius of all unused particles to 0.

> 2) Also if 1) can be achieved, is there also a way of defining the
> radius of each individual particle. The output from my simulation
> gives xyz files with the following format

By chance, I have exactly had this case already, so I have a
ready-to-run solution, which still needs some lengthy explanation.

To be able to do that (and more), I have developed an extension to the
VTF format ( The VTF
format is a format that I have developed with applications like yours in
mind. It is a textual format that is very simple to produce. In fact,
the format that your program produces could already be interpreted as VTF.

Unfortunately, the most recent VTF reader plugin that can help you is
not in VMD 1.9.1 yet. I have already submitted the updated code to the
VMD devels, and I hope it will be included in VMD 1.9.2, which is
intended to be released pretty soon (?). So it will be simple as soon as
VMD 1.9.2 is out, before that you will have to compile the VTF reader
plugin yourself. All code can be found here:

To be able to use it, you have to compile the vtfplugin and load it into

The usage is not exactly simple, but it gives you quite some power once
you have understood it. The idea is as follows:

1. The VTF format is extensible, i.e. a user can put arbitrary user data
into the file without breaking the format. In particular, you can add
arbitrary data after the coordinates, which I call "user data". One
example for this would be the radius, others would be the dipole moment,
or any other data that a user can think of.

2. The VTF reader plugin reads all data that VMD can use directly from
the file.

3. The Tcl-plugin "vtftools" provides a function that can be used to
load all user data from the file into Tcl variables.

4. Once this is done, you can use Tcl scripting and traces to visualize
the user data, e.g. you can set up a trace that updates the radii of all
atoms when you change the frame.

You can find my example for atoms with arbitrary radii in the files
samples/userdata/radius.* in the above repository. To run it, execute

  vmd -e radius.vmd

The file radius.vtf is a VTF file that has the radii of the atoms in the
extra column. radius.vmd defines a function "sample_load" that loads the
VTF file into VMD and the userdata into Tcl variables and sets up a
trace that automatically changes the radii when the frame is changed.

I think that this should actually solve your problem, even if it is not
exactly trivial to understand. If you need further help, contact me!


- --
Dr. rer. nat. Olaf Lenz
Institut für Computerphysik, Allmandring 3, D-70569 Stuttgart
Phone: +49-711-685-63607
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -