From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Sun Feb 19 2012 - 14:43:17 CST

On Sun, Feb 19, 2012 at 2:50 PM, Cosseddu, Salvatore
<S.M.Cosseddu_at_warwick.ac.uk> wrote:
> Dear Mish,
>
> What do you exactly mean by "any"?
> If I understood your message, do you know anything about tcl scriptiong?
> put in a file something like this (es dist.tcl):
>
> proc measure_dist_cent_mass { selstring1 selstring2 {molID {top}} {weight
> {}}} {
>
> set sel1 [atomselect $molID $selstring1]
> set sel2 [atomselect $molID $selstring2]
>
> if {![llength $weight]} {
> set cent_sel1 [measure center $sel1]
> set cent_sel2 [measure center $sel2]
> } else {
> set cent_sel1 [measure center $sel1 weight $weight]
> set cent_sel2 [measure center $sel2 weight $weight]
> }
>
> set dist [veclength [vecsub $cent_sel1 $cent_sel2]]
>
> $sel1 delete
> $sel2 delete
> return $dist
>
> }
>
> open TkConsole and run
>
> source <path>/dist.tcl
> where path is the directory of the script. Than you can obtain the
> information you want using the command
>
> measure_dist_cent_mass "resid 70" "resid 40"
>
> or, if you'd like the distance from center of mass
>
> measure_dist_cent_mass "resid 70" "resid 40" top mass

one word of warning: be always careful with
selection texts using the "resid" keyword.

the keyword "resid" refers to whatever number was
stored in the resid section of the corresponding topology
or trajectory data file. VMD does no check whether this
is unique and in most simulations with water as solvent
or other multiple components (multiple segments/chains)
it is not. specifically when looking at per residue properties,
you may easily get unexpected results.

on the other hand, using the "residue" key word will always
result in a unique label, since VMD will create them upon
reading. thus is is always recommended to make a check,
e.g. check that '[llength [lsort -unique [$sel1 get residue]]] == 1'

cheers,
    axel.

>
> (measure_dist_cent_mass <first selection string> <second selection string>
> [<molID>] [<weight>])
> molID and weight are optional, but if you want to use weight, you have to
> put also molID.
>
> I've just wrote this simple procedure from scratch, so it could contain
> bugs. Please refer to VMD manual and a good TCL book.
>
> Regards
> Salvatore
>
> --
> Salvatore Cosseddu
> PhD student
>
> Centre for Scientific Computing and School of Engineering
> University of Warwick
> Coventry CV4 7AL
> United Kingdom
>
> email: S.M.Cosseddu_at_warwick.ac.uk
>
>
>
>
> -----Messaggio originale-----
> Da: owner-vmd-l_at_ks.uiuc.edu per conto di mish
> Inviato: dom 19/02/2012 16:27
> A: vmd-l_at_ks.uiuc.edu
> Oggetto: vmd-l: Distance between center of mass of two amino acid residues.
>
>
>
> Hello all,
>
> Can any suggest me some way to measure the distance between geometric
> center ( or center of mass) if two amino acid residues in any any protein?
>
> Sincerely
> Mish,
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.