From: Arpita Srivastava (Arpita.Srivastava_at_unh.edu)
Date: Mon Sep 13 2021 - 14:20:59 CDT

Dear VMD users,
I am a beginner to tcl scripting and want to compute dihedral angle due to four atoms (A, B, C and A1) for 501 frames. I am using the following script,

set sel1 [atomselect top "name A"]
set sel2 [atomselect top "name B"]
set sel3 [atomselect top "name C"]
set sel4 [atomselect top "name A1"]
set nf [molinfo top get numframes]
set outfile [open dihedral.dat w]
for {set i 1} {$i <=501} {incr i} {
puts "frame $i of $nf"
puts "frame $i of $nf"
$sel1 frame $i
$sel2 frame $i
$sel3 frame $i
$sel4 frame $i
set simdata($i.r) [measure dihed [list $sel1 $sel2 $sel3 $sel4]]
puts $outfile "$i $simdata($i.r)"
}
close $outfile

However, I am getting this error note, "expected integer but got "atomselect16" measure dihed: bad atom index."
This could probably be due to the incorrect atom indexing within the command line. I really appreciate if you could provide me some insights to fix this.
Thanks in advance!

Best regards,

Arpita Srivastava, Ph.D.
(she/her/hers)
Postdoctoral Researcher
Dept. of Chemical Engineering
University of New Hampshire
Durham, NH 03824, US