From: Axel Kohlmeyer (
Date: Sat Aug 31 2013 - 06:37:12 CDT

On Fri, Aug 30, 2013 at 11:13 PM, Roger A Larson <> wrote:
> Hi,
> I have recently begun to use VMD to visualize crystals in a polycrystalline material. Currently, I have completed analysis, but I want to generate a different color scheme for each large crystal (grey for the grain boundaries). I import data to VMD from a lammpstrj file, and I would like to know if there is a command I can use to assign each atom to a specific group or if there is a way to import color from this input file.

> I guess what I want to ask is, is there a way to import colors from a lammpstrj file?

there is no way to communicate colors *directly* like this, however
you can use different per-atom properties for colorization in VMD.
e.g. you can export molecule ids to group atoms and use them for
colorization, those will be translated into residue ids in VMD.

> I can write the file, just don't know if there is a command for color customization from importing (I know some exist in the GUI):
> ITEM: ATOMS id type xs ys zs color?
> 0 Cu -5 0 5 green
> 1 Zr -5 0 5 red
> etc.
> Or perhaps assign a group id?

sort of. see above. it can get tricky, if those group/molecule
assignments have to change over time. VMD assumes a conventional
classical bio simulation data set, where this does not happen, so most
of the per-atom information is only stored once, except for
coordinates (and velocities). VMD has four "user" fields, that are
per-atom *and* per-timestep, but those are not accessible from reading
a trajectory through the molfile plugin. the lammps trajectory plugin
has a hack that one can (ab)use the velocity components to read
arbitrary per-atom/per-timestep fields into VMD. see:

if you are looking for something that is less of a hack and more
tightly connected to LAMMPS, you can check out the "image" dump style,
which can output images from LAMMPS simulations directly (or in
post-processing using the rerun command). but - of course - that is
not as interactive and flexible as VMD. check out:


> Thanks,
> Roger

Dr. Axel Kohlmeyer
International Centre for Theoretical Physics, Trieste. Italy.