From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Dec 21 2004 - 10:14:12 CST

Erik,
  Which version of VMD are you running (and what platform/OS)?
If you have a structure that causes the behavior you describe, I'd love
to get a copy of it for testing.

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Mon, Dec 20, 2004 at 07:23:07PM -0500, nordgren_at_sas.upenn.edu wrote:
> Hi folks,
>
> I'm having a little trouble that I wondered if anyone else has seen
> before... I didn't turn up any previous posts on this subject...
>
> So, I've been analyzing a NAMD trajectory for a protein simulation,
> and trying to extract the phi & psi backbone torsional angles for
> each residue. Here is a snippet of my VMD (Tcl) code... (This
> loop is nested within another loop, over the various identical
> protein structures in my system, and that within yet another loop,
> over the frames of the input trajectory.)
>
> # inner loop: compute the local phi and psi angles
> for {set r_num $resid_min} {$r_num <= $resid_max} {incr r_num} {
> set index [lindex $helix_atoms($h_num) $r_num]
> set now_atom [atomselect top "index $index" frame $frame]
> set now_phi [$now_atom get phi]
> set now_psi [$now_atom get psi]
> # the next line is just for debugging purposes
> puts "residue=$r_num ; index=$index ; phi/psi = $now_phi $now_psi"
> set phi($r_num) [expr {$phi($r_num) + $now_phi}]
> set psi($r_num) [expr {$psi($r_num) + $now_psi}]
> # clear atom selection from memory
> $now_atom delete
> }
>
> Now, most of the time this works fine (and gives physically reasonable
> results) but every now and then (repeatably, but only for certain
> trajectories from certain MD runs) this code crashes, because the
> "get phi" command for a particular atom selection returns a non-numeric
> value of "nan0x000002000000"
>
> My inspection of the residue in question leads to the hypothesis that
> the "NaN" is turning up due to a torsional angle of 180.0 degrees,
> along with some related bug in the phi/psi computation.
>
> So, here are my questions:
> 1) Is this in fact a bug in VMD? Anyone see this before? If so, is
> there a fix?
> 2) If there is no quick fix, can someone recommend a good Tcl trick
> to recognize the "number-ness" of a value, so I can avoid crashing my
> algorithm, by screening for NaN's before trying to do arithmetic on them?
>
> Thanks much,
> Erik
>
>
> C. Erik Nordgren, Ph.D.
> Department of Chemistry
> University of Pennsylvania

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078