From: sajad falsafi (sajad.falsafi_at_yahoo.com)
Date: Wed Jul 06 2011 - 05:56:58 CDT

Hi

I acknowledge from Dr. Axel Kohlmeyer for his helpful suggestions.
We Write a Script to calculate the distance between atoms in big DCD files.

proc distance { frame } {
  global all sel1 sel2 coord1 coord2 outfile
  set coord1 [lindex [$sel1 get {x y z}] 0]
  set coord2 [lindex [$sel2 get {x y z}] 0]
  puts $outfile "$frame: [vecdist $coord1 $coord2]"
}
set outfile [open distance.dat w];
set mol [mol new protein.psf waitfor all]
mol addfile protein.pdb type pdb waitfor all
set sel1 [atomselect $mol "protein and resid 1 and alpha"]
set sel2 [atomselect $mol "protein and resid 2 and alpha"]
bigdcd distance eq-0.dcd eq-1.dcd
bigdcd_wait
close $outfile

Hope this helps you
Sajad & Zahra

________________________________
From: Axel Kohlmeyer <akohlmey_at_gmail.com>
To: snoze pa <snoze.pa_at_gmail.com>
Cc: vmd-l_at_ks.uiuc.edu
Sent: Wed, July 6, 2011 5:40:04 AM
Subject: Re: vmd-l: Distance between atoms in frame

On Tue, Jul 5, 2011 at 8:12 PM, snoze pa <snoze.pa_at_gmail.com> wrote:
> After many tweaks, the scripts start working. I will highly appreciate if
> you can find if it is fine to do this way. If yes then in case of multiple
> chains (chain A and chain B with same residue number) then how can I change
> ths script.

just figure out which index those atoms are
beforehand and then use a selection "index #"
this will certainly only get one atom.
since you your atom indices won't change,
you only have to do that once per system.

>
> Thank you.
>
> source bigdcd.tcl
>
> proc myrmsd { frame } {
> global ref sel all
> $all move [measure fit $sel $ref]

why this?? $sel and $ref and $all
are all the same molecule. thus the $all move
won't change the distance between $sel and $ref

> $sel frame $frame
> $ref frame $frame

if you update the frame here, the
measure fit from above will be for
the previous step.

> set com1 [measure center $sel weight mass]
> set com2 [measure center $ref weight mass]

why measure center for a single atom??

set coord1 [lindex [$sel get {x y z}] 0]
set coord2 [lindex [$ref get {x y z}] 0]

should do the same thing.

> set comdist [vecdist $com1 $com2]
> puts "$frame: $comdist"
> }
>

axel.

> set mol [mol new solvated_ionised.psf waitfor all]
> set all [atomselect $mol all]
> set ref [atomselect $mol "protein and resid 13 and name CA "]
> set sel [atomselect $mol "protein and resid 18 and name CA "]
>
> mol addfile solvated_ionised.pdb type pdb waitfor all
> bigdcd myrmsd dcd solvated_ionised4.dcd solvated_ionised5.dcd
> bigdcd_wait
> #quit
>
>
> On Tue, Jul 5, 2011 at 6:12 PM, snoze pa <snoze.pa_at_gmail.com> wrote:
>>
>> Dear VMD users,
>>
>> I need some help to calculate the distance between atoms. I am using
>> multiple large dcd files and would appreciate your help to get the corrected
>> distance between two CA atoms of residue 13 and 18 along trajectory. I want
>> to use bigdcd because large multiple dcd files. I am not expert in tcl
>> programming but trying hard to get it.
>>
>> Thank you.
>>
>>
>> source bigdcd.tcl
>>
>> proc myrmsd { frame } {
>> global ref sel all
>> $all move [measure fit $sel $ref]
>> puts "$frame: [measure bond [list [list $ind1 $mol] [list $ind2 $mol]]
>> frame all]"
>> }
>>
>> set mol [mol new solvated_ionised.psf waitfor all]
>> set all [atomselect $mol all]
>> set ref [atomselect $mol "protein and resid 13 and name CA"]
>> set sel [atomselect $mol "protein and resid 18 and name CA"]
>> set ind1 [join [$ref get index]]
>> set ind2 [join [$sel get index]]
>>
>>
>> mol addfile solvated_ionised.pdb type pdb waitfor all
>> bigdcd myrmsd dcd solvated_ionised4.dcd solvated_ionised5.dcd
>> bigdcd_wait
>> #quit
>>
>
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.