Re: Single vs. Double precision

From: Axel Kohlmeyer (
Date: Mon Jan 19 2009 - 10:25:36 CST

On Mon, 19 Jan 2009, Neelanjana Sengupta wrote:

NS> Hello NAMD community,
NS> I gather from a previous conversation that the NAMD code uses double
NS> precision. However, can the code be compiled as a single precision version?

no. there are some defines to switch between single and double
precision, but only some parts of the code respect this.

NS> And if so, has anybody compared results and found serious deviations between
NS> the single and double precision results for any system?

there are some places where single precision (FFT, force/energy
computation), where single precision can be applied, but in other
places (summations) where even double precision may result in
artefacts, due to limited numerical accuracy for large enough
systems. there are some applications that show little sensitivity
to single/double precision issues (homogeneous bulk lennard-jones
systems), but others are notoriously difficult (systems with
significant potential drops in one or two dimensions, e.g. metal
surface slabs or lipid bilayers) since you don't have that much
error cancellation anymore.

if you store coordinates in single precision, you have to take
extra precautions for handling very large systems, since you
would store coordinates with different relative precision,
depending on how close you are to the origin. e.g., with domain
decomposition, you can define per domain offsets, but that
would work only well in case of a large enough number of domains.

NAMD contains some of this in the modules that would support CUDA.

the best way to study the impact of single vs. double would be
by running tests with the gromacs code. gromacs _can_ be compiled
in single or double precision. for a proper comparison, you'll have
to turn off the assembly innerloops though, since they may use single
precision even in double precision mode.


NS> Some information would be appreciated.
NS> Thanks,
NS> Neelanjana

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.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:52:15 CST