From: Vermaas, Joshua (
Date: Fri Mar 23 2018 - 12:01:22 CDT


Selections are your friend.

set sel0 [atomselect top "noh and water and d*d<x*x+y*y+z*z" frame 0]
puts "Initial value [$sel0 num]"
set self [atomselect top "noh and water and d*d<x*x+y*y+z*z and index [$sel0 get index]"]
for { set f 0 } { $f < [molinfo top get numframes] } { incr f } {
$self frame $f
$self update
put "$f [$self num]"


On 03/18/2018 09:46 AM, Udaya Dahal wrote:
Sorry, I didn't put my question properly. I didn't mean to calculate distance. I want to calculate the correlation. I have 'n' water molecules within distance 'd' of a fixed point say (0,0,0). Now in subsequent frames, how many of them(water molecules in initial frame 'n') stay within that distance 'd' from (0,0,0).


On Sun, Mar 18, 2018 at 8:50 AM, Ashar Malik <<>> wrote:
Do you mean you want to measure/monitor the distance between "a molecule A" and a "water molecule" in your simulation? The word trajectory update is confusing.

If you just want a distance between two molecules listed for every frame of your trajectory -- then you should know that a distance can only be calculated between two points. Molecules have more than 1 point point so you will have two decide which point to use as reference. You can choose an atom or select a centre of geometry/mass and measure distance between that for two molecules.

To measure distance look at the command measure bond (>)

For this I don't think you can use anything else apart from atoms, meaning this won't work with centre of mass/geometry.
Try this. Drop back if it doesn't work and someone can help more. This is obviously assuming I understood your problem correctly.

On Sun, Mar 18, 2018 at 7:31 PM, Udaya Dahal <<>> wrote:

I would like to extract the data as in visualization without trajectory update. For eg. I am looking at water molecules at some distance from another molecule A. If I don't update the trajectory, I can see the water moving away from the initial distance. How to extract this data in text mode? I appreciate your help.