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

Hi,

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]"
}

-Josh

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).

Regards,

On Sun, Mar 18, 2018 at 8:50 AM, Ashar Malik <asharjm_at_gmail.com<mailto:asharjm_at_gmail.com>> 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 (http://www.ks.uiuc.edu/Research/vmd/vmd-1.8.6/ug/node124.html5cb9%7Ca0f29d7e28cd4f5484427885aee7c080%7C0%7C0%7C636569839088441187&sdata=hDjHPWFdT8xovlqnQMtMv2E2Y2N0sL5wme0UcQSdPBk%3D&reserved=0>)

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 <dahal.udaya_at_gmail.com<mailto:dahal.udaya_at_gmail.com>> wrote:
Hi,

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.

Regards,
UD

--
Best,
/A