From: Dave Schall (
Date: Tue May 14 2013 - 11:47:07 CDT


Your method sort of works, in that charge (now vx) does change dynamically;
however, there is one odd thing. The range for vx seems to be the absolute
value of the original q. My actual charge ranges from -0.62 to +0.22. Once
I ran your script, I have an autoscale values ranging from 0 to +0.62. So
there is something funny going on.

I actually cheated (after trying your script) and did search and replace
with "perl -pi 's/q/vx/g' lammps.trj" to simply change all the q's to vx's
in the dump file. No additional scripts necessary (but I get the same range


On Tue, May 14, 2013 at 3:38 AM, Axel Kohlmeyer <> wrote:

> On Mon, May 13, 2013 at 10:20 PM, Dave Schall <> wrote:
> > Hello,
> hi dave,
> > I am trying to visualize results from a simulation where charge is a
> dynamic
> > variable. I am using coordinate and charge data output from a LAMMPS dump
> > command. The lammps trj file loads no problem into vmd, and I can color
> > atoms by charge, but I don't see the charges varying frame to frame (and
> > they are varying, I checked). I checked the "update colors every frame"
> box
> this is due to the design decision in VMD. since its original target
> was visualize data from conventional bio force fields, properties that
> don't change (atom type, radius, number of atoms, charge and so on)
> were only stored once per molecule. only coordinates were stored per
> frame resulting in huge savings in memory consumption for long
> trajectories. there are some additional fields that can store per
> frame per atom data (user, user2, user3, user4, vx, vy, vz), but only
> the velocity fields are supported by the molfile plugin interface,
> which is used to read in trajectories. in the plugin for LAMMPS
> trajectories, i've included a little hack that allows you to remap
> fields, i.e. you can divert the charge field to the vx property and
> thus access the information inside of VMD.
> > as well. I seem to recall you need some sort of tcl script if you want to
> > update charge for every frame. I have an old script that works for pdb
> files
> > but I am not sure exactly where to start modifying the script to read a
> > lammps trj file. Can anybody point me towards a solution?
> that is a very cumbersome approach and i don't recommend that. i'd
> suggest you use something like this to load the charge information
> into the user field.
> global env
> set mol [mol new lammps.trj type lammpstrj waitfor all]
> # insert "mol addfile command here, if needed"
> set nf [molinfo $mol get numframes]
> set sel [atomselect $mol all]
> for {set i 0} {$i < $nf} {incr i} {
> $sel frame 0
> $sel set user [$sel get vx]
> $sel set vx 0.0
> }
> $sel delete
> unset sel
> if you then set Coloring Method to Trajectory->User->User you should
> get the visualization you are looking for.
> for more info on the lammps molfile plugin, you can go to this page
> and if you'd rather do it "the hard way", you can look up some
> examples and explanations in this pdf
> please let us know if you have any additional questions.
> cheers,
> axel.
> >
> > Thanks,
> >
> > Dave
> >
> >
> >
> > --
> > J. David Schall, Assistant Professor
> > Dept. of Mechanical Engineering, Oakland University
> > 130 DHE, Rochester, MI 48309
> > 248-370-2870
> --
> Dr. Axel Kohlmeyer
> International Centre for Theoretical Physics, Trieste. Italy.

J. David Schall, Assistant Professor
Dept. of Mechanical Engineering, Oakland University
130 DHE, Rochester, MI 48309