From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Dec 19 2011 - 12:05:45 CST

On Mon, Dec 19, 2011 at 11:48 AM, Joshua D. Moore
<joshuadmoore_at_gmail.com> 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
>
> http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/16817.html
>
> http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/17961.html
>
> 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?

just amend your script so far with something like this:

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}]
}

axel.

>
> Thanks in advance.
>
> Josh

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.