From: Axel Kohlmeyer (
Date: Tue Feb 24 2009 - 19:51:15 CST

On Tue, 24 Feb 2009, Lee, Hwan Kyu (NIH/NHLBI) [E] wrote:

HKL> Dear VMDer,

HKL> I calculated center of mass for each residue, and then calculated
HKL> dihedral angles for those four center of mass. I wrote tcl script
HKL> like below, but got an error, "expected integer but got
HKL> "11.965297699" measure dihed: bad atom index". It looks like
HKL> $sel11 cannot be recognized as a coordinate of COM. How can I fix
HKL> this problem? Thanks for your help in advance.

measure dihed measures the dihedral between atoms
(which you specify as indices). this is why the code
tells you that it expected an integer when you gave
a floating point number.

you have to either compute the dihedral angle "manually",
or load a second dummy molecule with just four atoms,
transfer the COM coodinates to them and then do a
measure dihed on those atoms.

please also note the error at the end.
$selX1 are no atomselections and thus
do accept a delete argument. (you'll get an
"unknown command error" on those).


HKL> -----------------
HKL> set numFrames [molinfo top get numframes]
HKL> for {set pp 300} {$pp < $numFrames} {incr pp} {
HKL> set n 1
HKL> while {$n < 35} {
HKL> set n1 [expr {$n+1}]
HKL> set n2 [expr {$n+2}]
HKL> set n3 [expr {$n+3}]
HKL> set sel1 [atomselect top "resid $n"]
HKL> set sel2 [atomselect top "resid $n1"]
HKL> set sel3 [atomselect top "resid $n2"]
HKL> set sel4 [atomselect top "resid $n3"]
HKL> set sel11 [measure center $sel1 weight mass]
HKL> set sel21 [measure center $sel2 weight mass]
HKL> set sel31 [measure center $sel3 weight mass]
HKL> set sel41 [measure center $sel4 weight mass]
HKL> set dih [measure dihed [list $sel11 $sel21 $sel31 $sel41]]
HKL> $sel1 delete
HKL> $sel2 delete
HKL> $sel3 delete
HKL> $sel4 delete

HKL> $sel11 delete
HKL> $sel21 delete
HKL> $sel31 delete
HKL> $sel41 delete

HKL> incr n
HKL> set result [open "dihedral.xvg" a]
HKL> puts $result "$dih"
HKL> close $result
HKL> }
HKL> }
HKL> -----------------
HKL> best,
HKL> Hwankyu.

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.