From: Vermaas, Josh (vermaasj_at_msu.edu)
Date: Mon Sep 13 2021 - 15:19:31 CDT

Hi Arpita,

Measure dihed wants a list of four numerical indices. You are passing four atomselections. You can convert an atomselection with a single atom to an index with something like this:

set simdata($i.r) [measure dihed [list [$sel1 get index] [$sel2 get index] [$sel3 get index] [$sel4 get index]]]

-Josh

From: <owner-vmd-l_at_ks.uiuc.edu> on behalf of Arpita Srivastava <Arpita.Srivastava_at_unh.edu>
Date: Monday, September 13, 2021 at 4:08 PM
To: "vmd-l_at_ks.uiuc.edu" <vmd-l_at_ks.uiuc.edu>
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.
(she/her/hers)
Postdoctoral Researcher
Dept. of Chemical Engineering
University of New Hampshire
Durham, NH 03824, US