[gmx-developers] Inverse Square Root code in Gromacs

Mark Abraham Mark.Abraham at anu.edu.au
Tue Nov 30 00:22:03 CET 2010


On 30/11/2010 7:59 AM, Haiqing Zhao wrote:
> Hi, all,
> Maybe this is such a small question since I'm new to Gromacs. sorry for spam.
>
> It is said that Gromacs has very efficient algorithm to calculate the square root. I serached the manual. And in Page227, it sounds like look-up tables&Newton Iteration were still used as other traditional algorithms did. I don't know if i got the right point? Could anybody give me some guide, or help me to find the source code of the Inverse Square Root?

http://repo.or.cz/w/gromacs.git/blob/HEAD:/include/vec.h

> (By the way, another result of my search is the other fast inverse square root method, from  http://en.wikipedia.org/wiki/Fast_inverse_square_root)

You'll note that the Quake code fragment there has a second N-R 
iteration at *single precision* commented out. That might well be 
acceptable for a video game, but not necessarily for a scientific 
application. You would have to compare the accuracy and performance on a 
real machine to see which is more suitable for any application.

Mark



More information about the gromacs.org_gmx-developers mailing list