From: Blake Charlebois (bdc_at_mie.utoronto.ca)
Date: Wed Jun 01 2005 - 21:39:49 CDT

Hi Xiongce,

I don't have an appropriate script for that, but the following should get
you started.

If you only need interatomic distances, I think you can create a bond label
and use the Labels dialogue box to (see save button on the graph tab) to
obtain interatomic distance over time.

If you're willing to settle for geometric center instead of COM, the
following procedure (which I have not really tested) might help:

proc distance_between_centers {molid1 molid2 stxt1 stxt2 frame1 frame2} {
        set s1 [atomselect $molid1 "$stxt1" frame $frame1]
        set s2 [atomselect $molid2 "$stxt2" frame $frame2]
        set v1 [measure center $s1]
        set v2 [measure center $s2]
        $s1 delete
        $s2 delete
        return [veclength [vecsub $v1 $v2]]
}

You would call this with something like the following:
set frm 0
set delta_r [distance_between_centers top top "protein and resid 10"
"protein and resid 12" $frm $frm]
puts "$frm\t$delta_r"

You would need to loop through frames with commands like these:
set nf [molinfo $molid get numframes]
for {set frm 0} {$frm<=[expr {$nf-1}]} {incr frm} {
        something...
}

There is a COM procedure in one of the NAMD/VMD tutorials.

Can anyone think of an easier way to do this?

-----Original Message-----
From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On Behalf Of
Xiongce Zhao
Sent: June 1, 2005 1:37 PM
To: vmd list
Subject: vmd-l: how to write out the coordinates of center of mass of a
particularresidue

I hope to monitor the distance between the center of mass of two
residues, anyone can give some instructions?

Thank you very much.

Xiongce