From: Alexander Balaeff (
Date: Mon Dec 19 2011 - 11:37:36 CST

Hi Joshua:

AFAIK, there are no VMD arrays that would hold the velocities of
the atoms, there are those for coordinates only. So you'd have to
use the existing arrays in molid 0 to copy the velocities to, and
color by that.

For example, let's say you are interested in the *absolute* value
of the velocity as opposite to vx, vy, vz. Then you could
calculate the absolute values of the velocities:

set all_one [atomselect 1 {all}]
set v_abs_vals {}
foreach vvec [$all_one get {x y z}] {
  lappend v_abs_vals [veclength $vvec]

then assign the velocities to, say, the beta column in molid 0:

set all_zero [atomselect 0 {all}]
$all_zero set beta $v_abs_vals

and color by beta.

Hope, this helps (or someone gives a more informed answer :)



On Mon, 19 Dec 2011, Joshua D. Moore wrote:

> Hi,
> I have 2 dcd files, one with the coordinates and one with the
> velocities. I would like to be able to read in the velocity *dcd to
> assign the vx,vy,vz per atom along with the coordinates so that I
> could eventually try to color by velocity.
> My thoughts were along the lines of these posts
> So I'm attempting to create 2 molecules, one with the coordinates (say
> molid 0) and another with the velocities (say molid 1). However, I
> can't figure out how to assign the vx,vy,vz fields in molid 0 with the
> x,y,z (which correspond to the velocities) from molid 1.
> Is there any easy command to set the vx,vy,vz?
> Something like (which doesn't work all the way)
> 1) set sel_vel [atomselect 1 "index 0"]
> 2) set sel_coor [atomselect 0 "index 0"]
> 3) set velocities [$sel_vel get {x y z}]
> Then I'm missing the next step to assign vx,vy,vz in molid 0 with the
> "velocities" array I created in step 3 above?
> So for this small example for index 0, I want the {x y z} from molid 1
> stored as the {vx vy vz} in molid 0.
> Is there any easier way to do this, other than to read in a LAMMPS
> trajectory formatted file with topotools?
> Thanks in advance.
> Josh

                Dr. Alexander Balaeff
  Department of Chemistry Phone: (919) 660-1634
  Duke University, Box 90349 FAX: (919) 660-1605
  Durham, NC 27708-0349 E-mail: