From: Smith, Harper E. (
Date: Tue Sep 14 2021 - 09:30:53 CDT

Hi Arpita,

You are giving dihed atomselections instead of indices.

measure dihed [list [$sel1 get index] [$sel2 get index] [$sel3 get index] [$sel4 get index]]

From: <> on behalf of Arpita Srivastava <>
Sent: Monday, September 13, 2021 3:20 PM
To: <>
Subject: vmd-l: Regarding atom index in VMD

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.
Postdoctoral Researcher
Dept. of Chemical Engineering
University of New Hampshire
Durham, NH 03824, US