Re: Error in calculation dihedral angle

From: Peter Freddolino (
Date: Sat Feb 13 2021 - 18:40:08 CST

The arguments to `measure dihed` are supposed to be atom indices, not atom
selections. See


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