From: Chola Regmi (cholaregmi_at_gmail.com)
Date: Wed Mar 19 2014 - 19:36:55 CDT

Hi Josh,
Thank you so much. It works. Instead of writing pdbs I opened .dat file and
saved {x y z} values.

set out [open velocityofselectedindices w]
set positionsel [atomselect coordinatemoleculenumber "water and same
residue as within 3.5 of protein"]
for { set f 0 } { $f < [molinfo coordinatemoleculenumber numframes] } {
incr f } {
#Update the frame
$positionsel frame $f
#Recalculate what is close to the protein
$positionsel update
#Since the positions and velocities have the same structure, the indices
can be shared between them
set velocitysel [atomselect velocitymoleculenumber "index [$positionsel get
index]"]
set velocity [$velocitysel get {x y z}]
foreach i $velocity {puts $out "$f \t $i"}

}
close $out
This gives frame no. and x y z component of velocity. Is the unit of
velocity A/ps.

Chola

On Wed, Mar 19, 2014 at 6:35 PM, Josh Vermaas <vermaas2_at_illinois.edu> wrote:

> Hi Chola,
>
> I think you can do what you are looking for by loading two molecules, one
> with the velocity and the other with the coordinates. You'd do something
> like the following:
>
> set positionsel [atomselect coordinatemoleculenumber "water and same
> residue as within 3.5 of protein"]
>
> for { set f 0 } { $f < [molinfo coordinatemoleculenumber numframes] } {
> incr f } {
> #Update the frame
> $positionsel frame $f
> #Recalculate what is close to the protein
> $positionsel update
> #Since the positions and velocities have the same structure, the indices
> can be shared between them
> set velocitysel [atomselect velocitymoleculenumber "index [$positionsel
> get index]" frame $f]
> $velocitysel writepdb frame$f.pdb
> $velocitysel delete
> }
>
> This is probably a good place to start. The biggest problem I think you'll
> face is bookkeeping. The number of atoms in the selection will change at
> every frame, which I've found to be a nightmare when trying to sanely
> normalize my input. Another issue you'll face is that pdbs are a
> particularly poor way of storing velocities, since they are a fixed format
> file with not a whole lot of significant figures. For alot of things that's
> fine, but I seem to remember from the last time I looked at a velocity
> trajectory that the velocities come in units that mean you are cutting off
> many sig figs. What I would do is calculate the quantity of interest
> directly in VMD and write that to a file instead of a set of pdbs.
>
> Good luck!
> -Josh Vermaas
>
>
> On 03/19/2014 04:29 PM, Chola Regmi wrote:
>
> Dear VMD users,
> I want to write a dcd/pdb or xyz file of my selection (updated every
> frame) in each frame from my NAMD velocity dcd file. Since my selection is
> like "water and within 3.5 A of protein". But NAMD velocity dcd file
> contains only velocity components of each atoms and selection does not
> work. Is there any way VMD can be used to extract the velocity of selected
> atoms only using velocity dcd file or combining with trajectory dcd file.
> I want to analyse the velocity of water molecules in different solvation
> layers.
>
> Thank you.
> Chola
>
>
>