From: Stephen Hicks (
Date: Sat Oct 11 2008 - 15:05:45 CDT


I have a VMD script that automatically performs a huge number of
'measure fit's, and I would occasionally notice that it would just
leave out the rotational part and simply return the identity matrix
with a translation. I was wondering where this came from and I
tracked it down to the fact that the Jacobi diagonalization is
quitting prematurely in fitrms.c. It uses a pretty standard algorithm
- rotating the matrix along each of the three axes in turn, but it
stops the moment rotation about a single axis doesn't improve the fit
by more than tol, which is set rather large. To fix it, I require
that all three axes show no improvement AND I decrease tol by a whole
lot. Since Jacobi's method converges quadratically, this shouldn't
cause any problems.

I've uploaded an example of the bug and a patch for fixing it. A
similar patch should also be applied to NAMD, since the same algorithm
is used there (in fitrms.C), although the smaller tol might break if
it's compiled with floats instead of doubles, so that might need to be

The files are available at

steve hicks