From: Axel Kohlmeyer (
Date: Tue Apr 17 2018 - 14:03:22 CDT

On Tue, Apr 17, 2018 at 2:28 PM, McGuire, Kelly <> wrote:
> I found a method on the VMD mailing list for coloring by velocity. I'm not
> sure I completely understood what was
> happening though. Here is the code:
> set sel_vel [atomselect 1 all]
> set sel_coor [atomselect 0 all]
> set nf [molinfo 1 get numframes]
> for {set i 0} {$i < $nf} {incr i} {
> $sel_coor frame $i
> $sel_vel frame $i
> $sel_coor set {vx vy vz} [$sel_vel get {x y z}]
> }
> Does this take the x y z coordinates and place them in vx vy vz? Could you
> explain how this shows the velocity?

this takes data from a velocity dcd file (thus the "coordinates" are
velocities) and copies it frame by frame to the velocity fields of a
trajectory data set with regular coordinates.

> Also, isn't it possible to write a velocity dcd file in NAMD?

yes, that seems to be used here.

> If that were
> loaded in VMD, could I just then choose the color by velocity
> representation? Thanks!

no, because the velocity dcd file has *only* velocities and when
reading it, VMD will read it like coordinates.
you need both, the velocity and the coordinate information.


> Kelly L. McGuire

Dr. Axel Kohlmeyer
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.