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

On Mon, Dec 19, 2011 at 1:26 PM, Joshua D. Moore <joshuadmoore_at_gmail.com> wrote:
> Thanks Alexander and Axel,
>
> Both of these are very useful and work.
>
> I was having trouble with this step: $sel_coor set {vx vy vz}
> [$sel_vel get {x y z}], so this works great of course.
>
> Assigning the beta field works well for my problem too though, so this
> is very useful to know too.

hmmm... i would say that (ab)using the beta field
is in this case not such a good idea, since beta
is not a "per-timestep" property, but rather a global
"per-molecule" property. a better choice would be
the "user", "user2", "user3" or "user4" field, which
are general purpose fields.

the difference in the visualization is that coloring
by velocity will automatically compute the magnitude
of the velocity from the three components, while
coloring by user(|2|3|4) will just pick the single
number 'as is'.

cheers,
    axel.

> Here's the simple solution with Axel's fix if someone comes across this later.
>
> 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}]
> }
>
>
> Thanks again.
>
> Josh
>
>
> On Mon, Dec 19, 2011 at 1:05 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>> 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.

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