• ## Outreach

From: Maxim Belkin (mbelkin_at_ks.uiuc.edu)
Date: Sat Mar 08 2014 - 10:50:07 CST

Hi Maria,

- use "water and oxygen” as the selection (should be more robust)
- no need to do "\$sel_coor update"
- in "foreach loop" change "sum1" to “sum”

However...
1. you don’t need sel_coor at all for what you are doing.
2. you don’t need to do "...set {vx vy vz}..." neither.

If you want to find average velocity each frame, then you can simply use "measure center":

set Vavr [measure center \$sel_vel] ; # Vavr - average velocity
foreach {vx vy vz} \$Vavr {break} ; # break that vector into components

I could imagine that you want to check if you have non-zero flux of water in your simulations. For that you could do:

measure avpos \$sel_vel

If you want to compute something else - let us know.

Happy Women's day!
Maxim

On Mar 8, 2014, at 5:51 AM, Maria Pikoula <maria.pikoula_at_eng.ox.ac.uk> wrote:

> Dear all,
>
> I have been attempting to use simultaneously coordinate and velocity information by processing two trajectories (one with coordinates and one with velocities) but with the same topology.
>
> I have tried this in the spirit of this thread: http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/19291.html
>
> When I try to write out all velocities for each selected atom in each frame, the numbers are always 0. Is this something to do with the way numbers are stored in VMD? It seems like a rounding errors may be to blame. I appreciate any feedback.
>
> ##################################
> Here are the TCL commands:
>
> set sel_vel [atomselect 1 "water and name O"] #selects coordinates
>
> set sel_coor [atomselect 0 "water and name O"] #selects corresponding velocities
>
> set n [molinfo 1 get numframes]
>
> # here I assign the velocity information to a variable in the coordinate selection
>
> for {set i 0} {\$i < \$n} {incr i} {
> \$sel_coor frame \$i
> \$sel_vel frame \$i
> \$sel_coor set {vx vy vz} [\$sel_vel get {x y z}]
> }
>
> #commands to write out the velocity information for vx
>
> set file [open xO_avg_velx_all.txt w]
> puts \$file "all vx"
> for { set i 0 } { \$i < \$n } { incr i } {
> set sum 0
> \$sel_coor frame \$i
> \$sel_coor update
> foreach xcoord [\$sel_coor get {vx}] {
> set sum1 [expr \$xcoord + \$sum]}
> puts \$file "\$sum [\$sel_coor num]"
> }
>
> ####################################
>
> Many thanks,
>
> Maria
>
>
> Maria Pikoula
> Doctoral Candidate in Centre for Doctoral Training in Healthcare Innovation
> Institute of Biomedical Engineering
> Department of Engineering Science
> University of Oxford
> maria.pikoula_at_eng.ox.ac.uk
>