VMD-L Mailing List
From: jo hanna (jfhanna_at_gmail.com)
Date: Fri Sep 07 2007 - 17:18:33 CDT
- Next message: Axel Kohlmeyer: "Re: Computing angles"
- Previous message: John Stone: "Re: is it possible to skip frame when using bigdcd"
- Next in thread: Axel Kohlmeyer: "Re: Computing angles"
- Reply: Axel Kohlmeyer: "Re: Computing angles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi
I am trying to calculate the angle between specific atoms in my files (pdb
and xtc) at each frame. The script I'm using is as follows:
**
set outfile [open angle.dat w]
set frame0 [atomselect top "all within 3 of index 2" frame 0]
set nf [molinfo top get numframes]
for {set i 0} {$i<$nf} {incr i} {
set A [atomselect top "index 2" frame $i]
set B [atomselect top "index 0" frame $i]
set C [atomselect top "index 1" frame $i]
global M_PI
# initialize arrays
set a() 0; set b() 0; set c() 0; set ab() 0; set ac() 0;
# split coordinates
set a(x) [lindex $A 0]; set a(y) [lindex $A 1]; set a(z) [lindex $A 2];
set b(x) [lindex $B 0]; set b(y) [lindex $B 1]; set b(z) [lindex $B 2];
set c(x) [lindex $C 0]; set c(y) [lindex $C 1]; set c(z) [lindex $C 2];
# setup vectors
set ab(x) [expr $b(x) - $a(x)];
set ab(y) [expr $b(y) - $a(y)];
set ab(z) [expr $b(z) - $a(z)];
set ac(x) [expr $c(x) - $a(x)];
set ac(y) [expr $c(y) - $a(y)];
set ac(z) [expr $c(z) - $a(z)];
# compute cosine
set cosine [expr \
($ab(x)*$ac(x) + $ab(y)*$ac(y) + $ab(z)*$ac(z)) / \
(sqrt(pow($ab(x),2) + pow($ab(y),2) + pow($ab(z),2)) * \
sqrt(pow($ac(x),2) + pow($ac(y),2) + pow($ac(z),2)))];
puts $outfile "set angle [expr acos($cosine)*(180.0/$M_PI)]"
}
close $outfile
**
Using this gives me an error that I don't understand and therefore can't
fix:
syntax error in expression "atomselect10 - atomselect9": variable references
resuire preceeding $
Can someone please advise?
Thanks
Jo
- Next message: Axel Kohlmeyer: "Re: Computing angles"
- Previous message: John Stone: "Re: is it possible to skip frame when using bigdcd"
- Next in thread: Axel Kohlmeyer: "Re: Computing angles"
- Reply: Axel Kohlmeyer: "Re: Computing angles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]