From: Maria Pikoula (maria.pikoula_at_eng.ox.ac.uk)
Date: Sat Mar 08 2014 - 18:52:56 CST

Hello Maxim and thanks so much for your input. Please see below for my comments

On 8 Mar 2014, at 16:50, Maxim Belkin wrote:

> Hi Maria,
>
> - use "water and oxygen” as the selection (should be more robust)
Will do from now on, thanks!

> - no need to do "$sel_coor update"
OK I had no idea, was following other instructions..

> - in "foreach loop" change "sum1" to “sum”
This was a silly typo, cheers!

Eventually, I run it correctly like you said, but I still got 0.0 at each frame..any ideas why?
> 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.
>
So the reason I am doing sel_coor is because eventually I want to measure the average velocity based on position, so imagine a "slice" of the trajectory, for example for 0.0<x<5.0. This is why I would need to load both but I was experimenting with the simple version first (all oxygens). Any help with that is very much appreciated, I'm very much a VMD newbie.

> 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!
Thanks on behalf of my gender!
> 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
>>
>

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