AMBER Archive (2006)

Subject: Re: AMBER: angle between two vectors

From: Myunggi Yi (myunggi_at_gmail.com)
Date: Mon Oct 16 2006 - 11:15:59 CDT


You can use tcl script in VMD.
You may want to modify the following tcl script.
Enjoy it.

+++++++++++++++++++++++++++++++++++++++
set outfile [open cn-m2-vmd.dat w]
set nf [molinfo top get numframes]
set g34 [atomselect top "resname GLY and name CA"]
set v27 [atomselect top "resid 7 34 61 88 and name CA"]
set c5 [atomselect top "resname HMT and name C5"]
set n1 [atomselect top "resname HMT and name N1"]
set all [atomselect top all]
set conv [expr 180.0/acos(-1.0)]

# angle calculation loop
for { set i 0 } { $i < $nf } { incr i } {
  $g34 frame $i
  $v27 frame $i
  set com1 [measure center $g34]
  set com2 [measure center $v27]
  set m2 [vecsub $com2 $com1]
  set m2mag [veclength $m2]

  $c5 frame $i
  $n1 frame $i
  set com3 [measure center $c5]
  set com4 [measure center $n1]
  set cn [vecsub $com4 $com3]
  set cnmag [veclength $cn]

  set dotp [vecdot $m2 $cn]
  set theta [expr $conv * acos($dotp / ($m2mag * $cnmag))]
  if { $theta > 90.0 } {
    set theta [expr 180.0 - $theta]
  }
  puts $outfile "[expr ($i + 1) * 10] $theta"
}
close $outfile
++++++++++++++++++++++++++++++++++++++++++

On 10/12/06, David A. Case <case_at_scripps.edu> wrote:
> On Thu, Oct 12, 2006, Lwin, ThuZar wrote:
>
> > Do you have any suggestion on how to do the following using amber
> > ptraj?
> > Vector 1: Assign a vector between atom A and B.
> > Vector 2: Assign another vector between atom C and D.
> > Then calculate angle between vector 1 and vector 2.
>
> My best guess is to use the vector command to write out files with the two
> vectors as a function of time, then use a short awk or perl script to compute
> the angles.
>
> (This would be a good functionality to have inside ptraj, but as far as I
> know, it is not there now.)
>
> ...dac
>
> -----------------------------------------------------------------------
> The AMBER Mail Reflector
> To post, send mail to amber_at_scripps.edu
> To unsubscribe, send "unsubscribe amber" to majordomo_at_scripps.edu
>

-- 
Best wishes,

MYUNGGI YI ================================== KLB 419 Institute of Molecular Biophysics Florida State University Tallahassee, FL 32306

Office: (850) 645-1334 http://www.scs.fsu.edu/~myunggi ----------------------------------------------------------------------- The AMBER Mail Reflector To post, send mail to amber_at_scripps.edu To unsubscribe, send "unsubscribe amber" to majordomo_at_scripps.edu