Re: [External Email] Re: Error in calculation dihedral angle

From: Jiali Wang (
Date: Sat Feb 13 2021 - 22:06:38 CST

Dear Peter,
Thank you for your reply. I use "set sel1 [[atomselect top "$selA"] get
index]" to get index, is there something wrong here?
 I am very new to the script part of calculations. I appreciate your help
very much.

On Sat, Feb 13, 2021 at 7:48 PM Peter Freddolino <> wrote:

> The arguments to `measure dihed` are supposed to be atom indices, not atom
> selections. See
> Best,
> Peter
> On Sat, Feb 13, 2021 at 1:56 AM jiali wang <>
> wrote:
>> Dear NAMD users,
>> I have an error when I calculate the dihedral angle, the calculation
>> performed in the VMD. code as below, but it says "expected integer but got
>> "$sel1" measure dihed: bad atom index". Do you know what happened?
>> Thank you so much!!
>> Jiali
>> set selA [atomselect top "segname PP5 and name C"]
>> set selB [atomselect top "segname PP5 and name CA"]
>> set selC [atomselect top "segname PP5 and name CB"]
>> set selD [atomselect top "segname PP5 and name CG"]
>> set sel1 [[atomselect top "$selA"] get index]
>> set sel2 [[atomselect top "$selB"] get index]
>> set sel3 [[atomselect top "$selC"] get index]
>> set sel4 [[atomselect top "$selD"] get index]
>> set nf [molinfo top get numframes]
>> set outfile [open dihed-cal.dat w]
>> for {set i 0} {$i < $nf} {incr i} {
>> puts "frame $i of $nf"
>> set dihedlist [measure dihed {$sel1 $sel2 $sel3 $sel4}]
>> puts $outfile "$i $dihedlist"

This archive was generated by hypermail 2.1.6 : Fri Dec 31 2021 - 23:17:10 CST