Change GMX_DOUBLE to be always defined
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 16 Nov 2015 16:29:35 +0000 (17:29 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 4 Jan 2016 03:32:09 +0000 (04:32 +0100)
Also documented use of precision-related CMake variables

There may be some references in the SIMD documentation that still
refer to GMX_DOUBLE being defined, but we should solve that
separately, given the other changes at the moment.

Some abuse that un-defined GMX_DOUBLE was hard-coding some use of
single precision in mdebin_bar.cpp, so made that explicit.

Removed GMX_CPT_BUILD_DP, which can now be replaced by GMX_DOUBLE.

Removed some #ifdef in QM code, because floating-point arguments to
printf are automatically promoted to double. scanf still needs
versioning, though.

Refs #1855

Change-Id: I59b6874739d528603a86e0b6ab9bcadd67fdd3fa

61 files changed:
CMakeLists.txt
docs/dev-manual/build-system.rst
docs/doxygen/suppressions.txt
src/config.h.cmakein
src/contrib/testfft.c
src/gromacs/correlationfunctions/tests/autocorr.cpp
src/gromacs/ewald/long-range-correction.cpp
src/gromacs/fft/fft5d.h
src/gromacs/fft/fft_fftw3.cpp
src/gromacs/fft/fft_mkl.cpp
src/gromacs/fileio/checkpoint.cpp
src/gromacs/fileio/enxio.cpp
src/gromacs/fileio/tngio.cpp
src/gromacs/fileio/tngio_for_tools.cpp
src/gromacs/fileio/trxio.cpp
src/gromacs/fileio/trxio.h
src/gromacs/fileio/vmdio.cpp
src/gromacs/fileio/xdrd.cpp
src/gromacs/fileio/xtcio.cpp
src/gromacs/gmxana/gmx_energy.cpp
src/gromacs/gmxlib/network.h
src/gromacs/gmxlib/nonbonded/nonbonded.cpp
src/gromacs/linearalgebra/eigensolver.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/genborn.cpp
src/gromacs/mdlib/mdebin.cpp
src/gromacs/mdlib/mdebin_bar.cpp
src/gromacs/mdlib/minimize.cpp
src/gromacs/mdlib/nbnxn_atomdata.cpp
src/gromacs/mdlib/nbnxn_consts.h
src/gromacs/mdlib/nbnxn_grid.cpp
src/gromacs/mdlib/nbnxn_internal.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_inner.h
src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_common.h
src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn_outer.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_common.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_inner.h
src/gromacs/mdlib/nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn_outer.h
src/gromacs/mdlib/nbnxn_pairlist.h
src/gromacs/mdlib/nbnxn_search.cpp
src/gromacs/mdlib/perf_est.cpp
src/gromacs/mdlib/qm_gaussian.cpp
src/gromacs/mdlib/qm_orca.cpp
src/gromacs/options/basicoptions.h
src/gromacs/simd/simd.h
src/gromacs/simd/tests/base.cpp
src/gromacs/simd/tests/base.h
src/gromacs/simd/tests/simd.cpp
src/gromacs/simd/tests/simd.h
src/gromacs/simd/tests/simd4.cpp
src/gromacs/simd/tests/simd4.h
src/gromacs/simd/tests/simd4_floatingpoint.cpp
src/gromacs/simd/tests/simd4_math.cpp
src/gromacs/simd/tests/simd_floatingpoint.cpp
src/gromacs/simd/tests/simd_math.cpp
src/gromacs/tables/forcetable.cpp
src/gromacs/utility/baseversion.cpp
src/gromacs/utility/binaryinformation.cpp
src/gromacs/utility/real.h
src/testutils/testasserts.h

index a55d8847b40bd9a2912c4d19858b43a0d5f9dc70..c415c6d0d9f7758cdf4d214e03accd7f9434efa3 100644 (file)
@@ -343,14 +343,22 @@ if(GMX_SIMD STREQUAL "AVX_256"
     # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49002
 endif()
 
-
+# Implement double-precision option. This is complicated because we
+# need installed headers to use the precision mode of the build that
+# produced the library, but cannot use config.h in that case. We also
+# want such variables to always have a definition, because #if is more
+# robust than #ifdef. So, we put this value on the compiler command
+# line in all cases.
+#
+# GMX_RELAXED_DOUBLE_PRECISION does not need to be handled here,
+# because no installed header needs it
 if(GMX_DOUBLE)
-    add_definitions(-DGMX_DOUBLE)
-    list(APPEND INSTALLED_HEADER_DEFINITIONS "-DGMX_DOUBLE")
-    if(GMX_RELAXED_DOUBLE_PRECISION)
-        add_definitions(-DGMX_RELAXED_DOUBLE_PRECISION)
-    endif()
+    set(GMX_DOUBLE_VALUE 1)
+else()
+    set(GMX_DOUBLE_VALUE 0)
 endif()
+add_definitions(-DGMX_DOUBLE=${GMX_DOUBLE_VALUE})
+list(APPEND INSTALLED_HEADER_DEFINITIONS "-DGMX_DOUBLE=${GMX_DOUBLE_VALUE}")
 
 if(WIN32)
     list(APPEND GMX_EXTRA_LIBRARIES "wsock32")
index ef3d98fb7b859c688b411d81d9bce5076c67e913..83a806664892c1f9de5a0ac7707dd8c8a9da26af 100644 (file)
@@ -211,6 +211,25 @@ Variables affecting compilation/linking
 
 .. cmake:: GMX_DOUBLE
 
+   Many part of GROMACS are implemented in terms of "real" precision,
+   which is actually either a single- or double-precision type,
+   according to the value of this flag. Some parts of the code
+   deliberately use single- or double-precision types, and these are
+   unaffected by this setting. See reference manual for further
+   information.
+
+.. cmake:: GMX_RELAXED_DOUBLE_PRECISION
+
+   Permit a double-precision configuration to compute some quantities
+   to single-precision accuracy. Particularly on architectures where
+   only double-precision SIMD is available (e.g. Sparc machines such
+   as the K computer), it is faster to default to ``GMX_DOUBLE=ON``
+   and use SIMD than to use ``GMX_DOUBLE=OFF`` and use no
+   SIMD. However, if the user does not need full double precision,
+   then some optimizations can achieve the equivalent of
+   single-precision results (e.g. fewer Newton-Raphson iterations for
+   a reciprocal square root computation).
+
 .. cmake:: GMX_EXTRAE
 
 .. cmake:: GMX_EXTERNAL_BLAS
index 50aac3daee54a008cb7477679b2f9ecaa12f3bd1..7c14491381639c425aea9d447fa8c993444875d7 100644 (file)
@@ -35,8 +35,9 @@ src/gromacs/mdlib/nbnxn_search_simd_4xn.h: warning: should include "simd.h"
 # This module name doesn't really fall into any currently used pattern; needs some thought
 : error: no matching directory for module: module_mdrun_integration_tests
 
-# These would be nice to fix, but can wait for later
+# These would be nice to fix, but can wait for later / deletion / rewrites
 src/gromacs/gmxlib/nonbonded/nb_kernel_*/*: warning: includes "config.h" unnecessarily
+src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/kernelutil_sparc64_hpc_ace_double.h: warning: should include "config.h"
 src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_gpu_ref.cpp: warning: includes "config.h" unnecessarily
 src/gromacs/mdlib/nbnxn_kernels/nbnxn_kernel_ref.cpp: warning: includes "config.h" unnecessarily
 src/gromacs/mdlib/nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn.cpp: warning: includes "config.h" unnecessarily
index ce3dd1f0cc489eb2f875cda85a74cedd8236a63e..ed12f90b820aa2c3536831b00a46c78c4eb63f8d 100644 (file)
 /* Target mantissa accuracy for SIMD double precision math */
 #define GMX_SIMD_ACCURACY_BITS_DOUBLE @GMX_SIMD_ACCURACY_BITS_DOUBLE@
 
+/* Whether a double-precision configuration may target accuracy equivalent to single precision */
+#cmakedefine01 GMX_RELAXED_DOUBLE_PRECISION
+
 /* Integer byte order is big endian. */
 #cmakedefine01 GMX_INTEGER_BIG_ENDIAN
 
index 1f2f4936ac1fb2ea590c9e78a4bb543108145f59..8d154de96db93a95d27dfa68b963028f5d3bc824 100644 (file)
@@ -45,7 +45,7 @@
 void testfft(FILE *fp,t_complex ***grid,int nx,int ny,int nz,gmx_bool bFirst)
 {
 #ifdef USE_SGI_FFT
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
   static    zomplex   *coeff;
 #else
   static    complex   *coeff;
@@ -69,7 +69,7 @@ void testfft(FILE *fp,t_complex ***grid,int nx,int ny,int nz,gmx_bool bFirst)
 #ifdef USE_SGI_FFT
   if (bFirst) {
     fprintf(fp,"Going to use SGI optimized FFT routines.\n");
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     coeff  = zfft3di(nx,ny,nz,NULL);
 #else
     coeff  = cfft3di(nx,ny,nz,NULL);
@@ -78,7 +78,7 @@ void testfft(FILE *fp,t_complex ***grid,int nx,int ny,int nz,gmx_bool bFirst)
   }
   la1 = nx;
   la2 = ny;
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
   zfft3d(1,nx,ny,nz,(zomplex *)cptr,la1,la2,coeff);
 #else
   cfft3d(1,nx,ny,nz,(complex *)cptr,la1,la2,coeff);
@@ -88,7 +88,7 @@ void testfft(FILE *fp,t_complex ***grid,int nx,int ny,int nz,gmx_bool bFirst)
 #endif
   
 #ifdef USE_SGI_FFT
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
   zfft3d(-1,nx,ny,nz,(zomplex *)cptr,la1,la2,coeff);
 #else
   cfft3d(-1,nx,ny,nz,(complex *)cptr,la1,la2,coeff);
@@ -101,7 +101,7 @@ void testfft(FILE *fp,t_complex ***grid,int nx,int ny,int nz,gmx_bool bFirst)
 void testrft(FILE *fp,real ***grid,int nx,int ny,int nz,gmx_bool bFirst)
 {
 #ifdef USE_SGI_FFT
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
   static    double *coeff;
 #else
   static    float *coeff;
@@ -125,7 +125,7 @@ void testrft(FILE *fp,real ***grid,int nx,int ny,int nz,gmx_bool bFirst)
 #ifdef USE_SGI_FFT
   if (bFirst) {
     fprintf(fp,"Going to use SGI optimized FFT routines.\n");
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     coeff  = dfft3di(nx,ny,nz,NULL);
 #else
     coeff  = sfft3di(nx,ny,nz,NULL);
@@ -135,7 +135,7 @@ void testrft(FILE *fp,real ***grid,int nx,int ny,int nz,gmx_bool bFirst)
   job = 1;
   la1 = nx+2;
   la2 = ny;
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
   dzfft3d(job,nx,ny,nz,cptr,la1,la2,coeff);
 #else
   scfft3d(job,nx,ny,nz,cptr,la1,la2,coeff);
@@ -147,7 +147,7 @@ void testrft(FILE *fp,real ***grid,int nx,int ny,int nz,gmx_bool bFirst)
   job = -1;
   
 #ifdef USE_SGI_FFT
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
   zdfft3d(job,nx,ny,nz,cptr,la1,la2,coeff);
 #else
   csfft3d(job,nx,ny,nz,cptr,la1,la2,coeff);
index d0be9b987bf8171a5a96f437beb80936b05a939f..5631d3f43550dd7e4b608eb02909bb4e977991dd 100644 (file)
@@ -85,7 +85,7 @@ class AutocorrTest : public ::testing::Test
         AutocorrTest( )
             : checker_(refData_.rootChecker())
         {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
             checker_.setDefaultTolerance(test::relativeToleranceAsFloatingPoint(1, 1e-6));
 #else
             checker_.setDefaultTolerance(test::relativeToleranceAsFloatingPoint(1, 1e-3));
index 887d5cb9e4fec4802f5a826a1a3be1723e0895bc..7f54c1f9e5a63c1bb886d6aaf1e3bae8fff55910 100644 (file)
@@ -229,7 +229,7 @@ void ewald_LRcorrection(int start, int end,
                                     ewcdr    = ewc_q*dr;
                                     vc       = qqA*std::erf(ewcdr)*rinv;
                                     Vexcl_q += vc;
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
                                     /* Relative accuracy at R_ERF_R_INACC of 3e-10 */
 #define       R_ERF_R_INACC 0.006
 #else
index ceb87ddc89cea61c3b76ef960162eede02218e3d..10676d822ed93649c8783931b61bdeaa7ebf1404 100644 (file)
@@ -57,7 +57,7 @@ double MPI_Wtime();
 #include <fftw3.h>
 #endif
 
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
 #define FFTW(x) fftwf_ ## x
 #else
 #define FFTW(x) fftw_ ## x
index eee92b2a4e7698e6e674e5b4b3ccf2299c73ef97..e1087d03605891b388024ac525951cff1ef4e3f6 100644 (file)
@@ -47,7 +47,7 @@
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/mutex.h"
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define FFTWPREFIX(name) fftw_ ## name
 #else
 #define FFTWPREFIX(name) fftwf_ ## name
index 037818b9a73904099e05b8ba4972f61ea5a9761d..ee86ced85eae5838fce51a24f9c59888a411441c 100644 (file)
@@ -51,7 +51,7 @@
 #endif
 
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define GMX_DFTI_PREC  DFTI_DOUBLE
 #else
 #define GMX_DFTI_PREC  DFTI_SINGLE
index 8c7feb7194f09fd5291434de903df8d6b8b54004..48c3782cc10daeb9c490d27d691309cd92c91be0 100644 (file)
 #define CPT_MAGIC2 171819
 #define CPTSTRLEN 1024
 
-#ifdef GMX_DOUBLE
-#define GMX_CPT_BUILD_DP 1
-#else
-#define GMX_CPT_BUILD_DP 0
-#endif
-
 /* cpt_version should normally only be changed
  * when the header of footer format changes.
  * The state data format itself is backward and forward compatible.
@@ -286,7 +280,7 @@ static void do_cpt_double_err(XDR *xd, const char *desc, double *f, FILE *list)
 
 static void do_cpt_real_err(XDR *xd, real *f)
 {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     bool_t res = xdr_double(xd, f);
 #else
     bool_t res = xdr_float(xd, f);
@@ -321,7 +315,7 @@ static int do_cpte_reals_low(XDR *xd, int cptp, int ecpt, int sflags,
                              FILE *list, int erealtype)
 {
     bool_t  res = 0;
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     int     dtc = xdr_datatype_float;
 #else
     int     dtc = xdr_datatype_double;
@@ -1589,7 +1583,7 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep,
     buser   = gmx_strdup(BUILD_USER);
     bhost   = gmx_strdup(BUILD_HOST);
 
-    double_prec = GMX_CPT_BUILD_DP;
+    double_prec = GMX_DOUBLE;
     fprog       = gmx_strdup(gmx::getProgramContext().fullBinaryPath());
 
     ftime   = &(timebuf[0]);
@@ -1777,7 +1771,7 @@ static void check_match(FILE *fplog,
     check_string(fplog, "Build time", BUILD_TIME, btime, &mm);
     check_string(fplog, "Build user", BUILD_USER, buser, &mm);
     check_string(fplog, "Build host", BUILD_HOST, bhost, &mm);
-    check_int   (fplog, "Double prec.", GMX_CPT_BUILD_DP, double_prec, &mm);
+    check_int   (fplog, "Double prec.", GMX_DOUBLE, double_prec, &mm);
     check_string(fplog, "Program name", gmx::getProgramContext().fullBinaryPath(), fprog, &mm);
 
     check_int   (fplog, "#ranks", cr->nnodes, npp_f+npme_f, &mm);
@@ -1888,7 +1882,7 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
                   &state->edsamstate.nED, &state->swapstate.eSwapCoords, NULL);
 
     if (bAppendOutputFiles &&
-        file_version >= 13 && double_prec != GMX_CPT_BUILD_DP)
+        file_version >= 13 && double_prec != GMX_DOUBLE)
     {
         gmx_fatal(FARGS, "Output file appending requested, but the code and checkpoint file precision (single/double) don't match");
     }
index 77f15bbe79b01e5c535a35ea001ce0e8be5cd2c5..0e1dd5405f85b07619e4abea3af92ff2a1c582b5 100644 (file)
@@ -95,7 +95,7 @@ struct ener_file
 static void enxsubblock_init(t_enxsubblock *sb)
 {
     sb->nr = 0;
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     sb->type = xdr_datatype_double;
 #else
     sb->type = xdr_datatype_float;
@@ -446,7 +446,7 @@ static gmx_bool do_eheader(ener_file_t ef, int *file_version, t_enxframe *fr,
     gmx_bool     bRead      = gmx_fio_getread(ef->fio);
     int          ndisre     = 0;
     int          startb     = 0;
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     xdr_datatype dtreal = xdr_datatype_float;
 #else
     xdr_datatype dtreal = xdr_datatype_double;
index 665a176f5300c05b602496bb913866b64f6309c5..d42acb1cfca305bc67e17486df5fa7a1bbbe1178 100644 (file)
@@ -119,7 +119,7 @@ void gmx_tng_open(const char       *filename,
 
         char        programInfo[256];
         const char *precisionString = "";
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         precisionString = " (double precision)";
 #endif
         sprintf(programInfo, "%.100s %.128s%.24s",
@@ -367,7 +367,7 @@ static void set_writing_intervals(tng_trajectory_t  tng,
                                                                      const char*,
                                                                      const char,
                                                                      const char);
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_double_set;
 #else
     set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_set;
@@ -730,7 +730,7 @@ void gmx_fwrite_tng(tng_trajectory_t tng,
                                                            const char*,
                                                            const char,
                                                            const char);
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     static write_data_func_pointer           write_data           = tng_util_generic_with_time_double_write;
 #else
     static write_data_func_pointer           write_data           = tng_util_generic_with_time_write;
index ec99e120ae2a17a73235e50662d264a9882b5640..695e6f13089fdee06dd26a6044904935c89db7e5 100644 (file)
@@ -82,7 +82,7 @@ void gmx_prepare_tng_writing(const char              *filename,
                                                                      const char*,
                                                                      const char,
                                                                      const char);
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_double_set;
 #else
     set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_set;
index dc214538ae73746ab05825c55e29b57624e76c9e..8f06e63113a6358293bf42a8930241b4f26a38e9 100644 (file)
@@ -120,7 +120,7 @@ int check_times2(real t, real t0, gmx_bool bDouble)
 {
     int  r;
 
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     /* since t is float, we can not use double precision for bRmod */
     bDouble = FALSE;
 #endif
index ebca0a694c645d2f0b6d472273a7a212b3942c08..5563f144334b778fae6ccd26fea947de5e1e7ad0 100644 (file)
@@ -150,7 +150,7 @@ gmx_bool bRmod_fd(double a, double b, double c, gmx_bool bDouble);
  * larger than the float/double precision.
  */
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define bRmod(a, b, c) bRmod_fd(a, b, c, TRUE)
 #else
 #define bRmod(a, b, c) bRmod_fd(a, b, c, FALSE)
index 34c79ed04acee2376b34deb829a32e74bed03b13..fbbd88f667755620b71363514586d1a4898c1aa4 100644 (file)
@@ -188,7 +188,7 @@ gmx_bool read_next_vmd_frame(t_trxframe *fr)
 
     fr->bV = fr->vmdplugin->bV;
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     snew(ts.coords, fr->natoms*3);
     if (fr->bV)
     {
@@ -214,7 +214,7 @@ gmx_bool read_next_vmd_frame(t_trxframe *fr)
         return 0;
     }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     for (i = 0; i < fr->natoms; i++)
     {
         fr->x[i][0] = .1*ts.coords[i*3];
index 5556316ae1160dadae07a3521f723f7e2d46b0e8..efcee69d10ec3cfcf2dfb30cc0b6d52ec4ff4486 100644 (file)
@@ -43,7 +43,7 @@
 
 int xdr_real(XDR *xdrs, real *r)
 {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     float f;
     int   ret;
 
@@ -59,7 +59,7 @@ int xdr_real(XDR *xdrs, real *r)
 
 int xdr3drcoord(XDR *xdrs, real *fp, int *size, real *precision)
 {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     float *ffp;
     float  fprec;
     int    i, ret, isize;
index cf4bfd45739a2b12856355f16216c46dbdeeab95..4c11bb6ed6148fbdff956b48a5f3562ca9e6263e 100644 (file)
@@ -53,7 +53,7 @@
 
 static int xdr_r2f(XDR *xdrs, real *r, gmx_bool gmx_unused bRead)
 {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     float f;
     int   ret;
 
@@ -135,7 +135,7 @@ static int xtc_header(XDR *xd, int *magic, int *natoms, int *step, real *time,
 static int xtc_coord(XDR *xd, int *natoms, matrix box, rvec *x, real *prec, gmx_bool bRead)
 {
     int    i, j, result;
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     float *ftmp;
     float  fprec;
 #endif
@@ -155,7 +155,7 @@ static int xtc_coord(XDR *xd, int *natoms, matrix box, rvec *x, real *prec, gmx_
         return result;
     }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     /* allocate temp. single-precision array */
     snew(ftmp, (*natoms)*DIM);
 
index 5fa85da27ff35f0874fddfe9318c60121bf27f88..07ae1e55d95dd47a6594d38ccc0a545786639468 100644 (file)
@@ -2524,7 +2524,7 @@ int gmx_energy(int argc, char *argv[])
                     if (ndisre > 0)
                     {
                         GMX_RELEASE_ASSERT(blk_disre != NULL, "Trying to dereference NULL blk_disre pointer");
- #ifndef GMX_DOUBLE
+ #if !GMX_DOUBLE
                         float  *disre_rt     =     blk_disre->sub[0].fval;
                         float  *disre_rm3tav = blk_disre->sub[1].fval;
  #else
@@ -2615,7 +2615,7 @@ int gmx_energy(int argc, char *argv[])
                     blk = find_block_id_enxframe(fr, enx_i, NULL);
                     if (bORIRE && blk)
                     {
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
                         xdr_datatype dt = xdr_datatype_float;
 #else
                         xdr_datatype dt = xdr_datatype_double;
@@ -2626,7 +2626,7 @@ int gmx_energy(int argc, char *argv[])
                         {
                             gmx_fatal(FARGS, "Orientational restraints read in incorrectly");
                         }
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
                         vals = blk->sub[0].fval;
 #else
                         vals = blk->sub[0].dval;
@@ -2673,7 +2673,7 @@ int gmx_energy(int argc, char *argv[])
                     blk = find_block_id_enxframe(fr, enxORT, NULL);
                     if (bOTEN && blk)
                     {
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
                         xdr_datatype dt = xdr_datatype_float;
 #else
                         xdr_datatype dt = xdr_datatype_double;
@@ -2684,7 +2684,7 @@ int gmx_energy(int argc, char *argv[])
                         {
                             gmx_fatal(FARGS, "Orientational restraints read in incorrectly");
                         }
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
                         vals = blk->sub[0].fval;
 #else
                         vals = blk->sub[0].dval;
index 2a7a65724715ed03b46515ac59dc81c4ac19afb9..f362475c511618f922d8f511da71aab39c60a57d 100644 (file)
@@ -102,7 +102,7 @@ void gmx_sumf_sim(int nr, float r[], const struct gmx_multisim_t *ms);
 void gmx_sumd_sim(int nr, double r[], const struct gmx_multisim_t *ms);
 /* Calculate the sum over the simulations of an array of doubles */
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define gmx_sum       gmx_sumd
 #define gmx_sum_sim   gmx_sumd_sim
 #else
index edfa40ed33f299ed0e82efa671d880c23691e32a..90814968c855ffcdd7ca870c2b7413efea866c9d 100644 (file)
 /* Different default (c) and SIMD instructions interaction-specific kernels */
 #include "gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_c.h"
 
-#if GMX_SIMD_X86_SSE2 && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_SSE2 && !GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_sse2_single/nb_kernel_sse2_single.h"
 #endif
-#if GMX_SIMD_X86_SSE4_1 && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_SSE4_1 && !GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_sse4_1_single.h"
 #endif
-#if GMX_SIMD_X86_AVX_128_FMA && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_AVX_128_FMA && !GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_avx_128_fma_single/nb_kernel_avx_128_fma_single.h"
 #endif
-#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && !(defined GMX_DOUBLE)
+#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && !GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_avx_256_single/nb_kernel_avx_256_single.h"
 #endif
-#if GMX_SIMD_X86_SSE2 && defined GMX_DOUBLE
+#if GMX_SIMD_X86_SSE2 && GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_sse2_double/nb_kernel_sse2_double.h"
 #endif
-#if GMX_SIMD_X86_SSE4_1 && defined GMX_DOUBLE
+#if GMX_SIMD_X86_SSE4_1 && GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_double/nb_kernel_sse4_1_double.h"
 #endif
-#if GMX_SIMD_X86_AVX_128_FMA && defined GMX_DOUBLE
+#if GMX_SIMD_X86_AVX_128_FMA && GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_avx_128_fma_double/nb_kernel_avx_128_fma_double.h"
 #endif
-#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && defined GMX_DOUBLE
+#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_avx_256_double/nb_kernel_avx_256_double.h"
 #endif
-#if GMX_SIMD_SPARC64_HPC_ACE && defined GMX_DOUBLE
+#if GMX_SIMD_SPARC64_HPC_ACE && GMX_DOUBLE
 #    include "gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/nb_kernel_sparc64_hpc_ace_double.h"
 #endif
 
@@ -121,32 +121,32 @@ gmx_nonbonded_setup(t_forcerec *   fr,
             {
                 /* Add interaction-specific kernels for different architectures */
                 /* Single precision */
-#if GMX_SIMD_X86_SSE2 && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_SSE2 && !GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_sse2_single, kernellist_sse2_single_size);
 #endif
-#if GMX_SIMD_X86_SSE4_1 && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_SSE4_1 && !GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_sse4_1_single, kernellist_sse4_1_single_size);
 #endif
-#if GMX_SIMD_X86_AVX_128_FMA && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_AVX_128_FMA && !GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_avx_128_fma_single, kernellist_avx_128_fma_single_size);
 #endif
-#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && !(defined GMX_DOUBLE)
+#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && !GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_avx_256_single, kernellist_avx_256_single_size);
 #endif
                 /* Double precision */
-#if GMX_SIMD_X86_SSE2 && defined GMX_DOUBLE
+#if GMX_SIMD_X86_SSE2 && GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_sse2_double, kernellist_sse2_double_size);
 #endif
-#if GMX_SIMD_X86_SSE4_1 && defined GMX_DOUBLE
+#if GMX_SIMD_X86_SSE4_1 && GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_sse4_1_double, kernellist_sse4_1_double_size);
 #endif
-#if GMX_SIMD_X86_AVX_128_FMA && defined GMX_DOUBLE
+#if GMX_SIMD_X86_AVX_128_FMA && GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_avx_128_fma_double, kernellist_avx_128_fma_double_size);
 #endif
-#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && defined GMX_DOUBLE
+#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_avx_256_double, kernellist_avx_256_double_size);
 #endif
-#if GMX_SIMD_SPARC64_HPC_ACE && defined GMX_DOUBLE
+#if GMX_SIMD_SPARC64_HPC_ACE && GMX_DOUBLE
                 nb_kernel_list_add_kernels(kernellist_sparc64_hpc_ace_double, kernellist_sparc64_hpc_ace_double_size);
 #endif
                 ; /* empty statement to avoid a completely empty block */
@@ -180,38 +180,38 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl, gmx_bool bElecAndVdwS
     arch_and_padding[] =
     {
         /* Single precision */
-#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && !(defined GMX_DOUBLE)
+#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && !GMX_DOUBLE
         { "avx_256_single", 8 },
 #endif
-#if GMX_SIMD_X86_AVX_128_FMA && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_AVX_128_FMA && !GMX_DOUBLE
         { "avx_128_fma_single", 4 },
 #endif
-#if GMX_SIMD_X86_SSE4_1 && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_SSE4_1 && !GMX_DOUBLE
         { "sse4_1_single", 4 },
 #endif
-#if GMX_SIMD_X86_SSE2 && !(defined GMX_DOUBLE)
+#if GMX_SIMD_X86_SSE2 && !GMX_DOUBLE
         { "sse2_single", 4 },
 #endif
         /* Double precision */
-#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && defined GMX_DOUBLE
+#if (GMX_SIMD_X86_AVX_256 || GMX_SIMD_X86_AVX2_256) && GMX_DOUBLE
         { "avx_256_double", 4 },
 #endif
-#if GMX_SIMD_X86_AVX_128_FMA && defined GMX_DOUBLE
+#if GMX_SIMD_X86_AVX_128_FMA && GMX_DOUBLE
         /* Sic. Double precision 2-way SIMD does not require neighbor list padding,
          * since the kernels execute a loop unrolled a factor 2, followed by
          * a possible single odd-element epilogue.
          */
         { "avx_128_fma_double", 1 },
 #endif
-#if GMX_SIMD_X86_SSE2 && defined GMX_DOUBLE
+#if GMX_SIMD_X86_SSE2 && GMX_DOUBLE
         /* No padding - see comment above */
         { "sse2_double", 1 },
 #endif
-#if GMX_SIMD_X86_SSE4_1 && defined GMX_DOUBLE
+#if GMX_SIMD_X86_SSE4_1 && GMX_DOUBLE
         /* No padding - see comment above */
         { "sse4_1_double", 1 },
 #endif
-#if GMX_SIMD_SPARC64_HPC_ACE && defined GMX_DOUBLE
+#if GMX_SIMD_SPARC64_HPC_ACE && GMX_DOUBLE
         /* No padding - see comment above */
         { "sparc64_hpc_ace_double", 1 },
 #endif
index 472a884ef8e9edc7d4078c96f8d07565099db231..16412265b919ef14a21a81fe210e8010ce00cd3a 100644 (file)
@@ -94,7 +94,7 @@ eigensolver(real *   a,
     /* Call LAPACK routine using fortran interface. Note that we use upper storage,
      * but this corresponds to lower storage ("L") in Fortran.
      */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     F77_FUNC(dsyevr, DSYEVR) (jobz, "I", "L", &n, a, &n, &vl, &vu, &index_lower, &index_upper,
                               &abstol, &m, eigenvalues, eigenvectors, &n,
                               isuppz, &w0, &lwork, &iw0, &liwork, &info);
@@ -118,7 +118,7 @@ eigensolver(real *   a,
 
     abstol = 0;
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     F77_FUNC(dsyevr, DSYEVR) (jobz, "I", "L", &n, a, &n, &vl, &vu, &index_lower, &index_upper,
                               &abstol, &m, eigenvalues, eigenvectors, &n,
                               isuppz, work, &lwork, iwork, &liwork, &info);
@@ -207,7 +207,7 @@ sparse_parallel_eigensolver(gmx_sparsematrix_t *    A,
     iter = 1;
     do
     {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         F77_FUNC(pdsaupd, PDSAUPD) (&ido, "I", &n, "SA", &neig, &abstol,
                                     resid, &ncv, v, &n, iparam, ipntr,
                                     workd, iwork, workl, &lworkl, &info);
@@ -242,7 +242,7 @@ sparse_parallel_eigensolver(gmx_sparsematrix_t *    A,
     /* Extract eigenvalues and vectors from data */
     fprintf(stderr, "Calculating eigenvalues and eigenvectors...\n");
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     F77_FUNC(pdseupd, PDSEUPD) (&dovec, "A", select, eigenvalues, eigenvectors,
                                 &n, NULL, "I", &n, "SA", &neig, &abstol,
                                 resid, &ncv, v, &n, iparam, ipntr,
@@ -334,7 +334,7 @@ sparse_eigensolver(gmx_sparsematrix_t *    A,
     iter = 1;
     do
     {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         F77_FUNC(dsaupd, DSAUPD) (&ido, "I", &n, "SA", &neig, &abstol,
                                   resid, &ncv, v, &n, iparam, ipntr,
                                   workd, iwork, workl, &lworkl, &info);
@@ -369,7 +369,7 @@ sparse_eigensolver(gmx_sparsematrix_t *    A,
     /* Extract eigenvalues and vectors from data */
     fprintf(stderr, "Calculating eigenvalues and eigenvectors...\n");
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     F77_FUNC(dseupd, DSEUPD) (&dovec, "A", select, eigenvalues, eigenvectors,
                               &n, NULL, "I", &n, "SA", &neig, &abstol,
                               resid, &ncv, v, &n, iparam, ipntr,
index 143d765b2dbc47ea3a2ccafa61775549e449ecef..e36aa9d3494242e34397864fdb9ad72cbc192b55 100644 (file)
@@ -1637,7 +1637,7 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused *ir,
          * In single precision, this is faster on Bulldozer.
          */
 #if GMX_SIMD_REAL_WIDTH >= 8 || \
-        (GMX_SIMD_REAL_WIDTH >= 4 && GMX_SIMD_HAVE_FMA && !defined GMX_DOUBLE) || GMX_SIMD_IBM_QPX
+        (GMX_SIMD_REAL_WIDTH >= 4 && GMX_SIMD_HAVE_FMA && !GMX_DOUBLE) || GMX_SIMD_IBM_QPX
         *ewald_excl = ewaldexclAnalytical;
 #endif
         if (getenv("GMX_NBNXN_EWALD_TABLE") != NULL)
@@ -2889,7 +2889,7 @@ void init_forcerec(FILE              *fp,
     /* Generate the GB table if needed */
     if (fr->bGB)
     {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         fr->gbtabscale = 2000;
 #else
         fr->gbtabscale = 500;
index 4a3980eba90b7545fa68c4462a41de99c1f20fba..bc43ba9076603902c3e661784e632dd32608d274 100644 (file)
@@ -979,7 +979,7 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
     }
 
     /* Switch for determining which algorithm to use for Born radii calculation */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 
     switch (ir->gb_algorithm)
     {
index 20b54574924d433179ad53c0dc2cf6e0c07d8264..3555c6b8f443a28566467a86e383f5982dd17bac 100644 (file)
@@ -1325,7 +1325,7 @@ void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
                     add_subblocks_enxblock(&(fr.block[b]), 1);
                     fr.block[b].id        = id[b];
                     fr.block[b].sub[0].nr = nr[b];
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
                     fr.block[b].sub[0].type = xdr_datatype_float;
                     fr.block[b].sub[0].fval = block[b];
 #else
@@ -1345,7 +1345,7 @@ void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
                     fr.block[db].id        = enxDISRE;
                     fr.block[db].sub[0].nr = ndisre;
                     fr.block[db].sub[1].nr = ndisre;
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
                     fr.block[db].sub[0].type = xdr_datatype_float;
                     fr.block[db].sub[1].type = xdr_datatype_float;
                     fr.block[db].sub[0].fval = disre_rt;
index 6f1e56174c21af995f97e0a759258846158ffbeb..a7d886b73b29200f338adbb9530c4946b88d0d2d 100644 (file)
@@ -247,31 +247,22 @@ void mde_delta_h_handle_block(t_mde_delta_h *dh, t_enxblock *blk)
             unsigned int i;
 
             blk->sub[2].nr = dh->ndh;
-/* For F@H for now. */
-#undef GMX_DOUBLE
-#ifndef GMX_DOUBLE
+            /* Michael commented in 2012 that this use of explicit
+               xdr_datatype_float was good for F@H for now.
+               Apparently it's still good enough. */
             blk->sub[2].type = xdr_datatype_float;
             for (i = 0; i < dh->ndh; i++)
             {
                 dh->dhf[i] = (float)dh->dh[i];
             }
             blk->sub[2].fval = dh->dhf;
-#else
-            blk->sub[2].type = xdr_datatype_double;
-            blk->sub[2].dval = dh->dh;
-#endif
-            dh->written = TRUE;
+            dh->written      = TRUE;
         }
         else
         {
-            blk->sub[2].nr = 0;
-#ifndef GMX_DOUBLE
+            blk->sub[2].nr   = 0;
             blk->sub[2].type = xdr_datatype_float;
             blk->sub[2].fval = NULL;
-#else
-            blk->sub[2].type = xdr_datatype_double;
-            blk->sub[2].dval = NULL;
-#endif
         }
     }
     else
index c5c7136f2274562d37f166f69fcca6ef025d6afb..e7d4a94493b804d0732e986d64ac91d7ebbaadd1 100644 (file)
@@ -214,7 +214,7 @@ static void print_converged(FILE *fp, const char *alg, real ftol,
                 alg, ftol, gmx_step_str(count, buf));
     }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     fprintf(fp, "Potential Energy  = %21.14e\n", epot);
     fprintf(fp, "Maximum force     = %21.14e on atom %d\n", fmax, nfmax+1);
     fprintf(fp, "Norm of force     = %21.14e\n", fnorm);
@@ -2660,7 +2660,7 @@ double do_steep(FILE *fplog, t_commrec *cr,
         stepsize = ustep/s_min->fmax;
 
         /* Check if stepsize is too small, with 1 nm as a characteristic length */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         if (count == nsteps || ustep < 1e-12)
 #else
         if (count == nsteps || ustep < 1e-6)
@@ -2799,7 +2799,7 @@ double do_nm(FILE *fplog, t_commrec *cr,
     snew(fneg, natoms);
     snew(dfdx, natoms);
 
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     if (bIsMaster)
     {
         fprintf(stderr,
@@ -2945,7 +2945,7 @@ double do_nm(FILE *fplog, t_commrec *cr,
             if (!bIsMaster)
             {
 #ifdef GMX_MPI
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define mpi_type MPI_DOUBLE
 #else
 #define mpi_type MPI_FLOAT
index 33c9331f385002b0f2d2e0f4fe1e61529a3bbbb6..dc87f127ff0a5ba81165ed95e02957d482b5abeb 100644 (file)
@@ -491,7 +491,7 @@ nbnxn_atomdata_init_simple_exclusion_masks(nbnxn_atomdata_t *nbat)
      * are of equal size.
      */
     simd_excl_size = NBNXN_CPU_CLUSTER_I_SIZE*simd_width;
-#if defined GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
+#if GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
     snew_aligned(nbat->simd_exclusion_filter64, simd_excl_size,   NBNXN_MEM_ALIGN);
 #else
     snew_aligned(nbat->simd_exclusion_filter, simd_excl_size,   NBNXN_MEM_ALIGN);
@@ -500,7 +500,7 @@ nbnxn_atomdata_init_simple_exclusion_masks(nbnxn_atomdata_t *nbat)
     for (int j = 0; j < simd_excl_size; j++)
     {
         /* Set the consecutive bits for masking pair exclusions */
-#if defined GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
+#if GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
         nbat->simd_exclusion_filter64[j]     = (1U << j);
 #else
         nbat->simd_exclusion_filter[j]       = (1U << j);
index 3ada608f60379ae1a37a46848ca02087a2c15a62..f050c0efb9e3b85f843dfd7dfdc4e82364a64c0a 100644 (file)
@@ -71,7 +71,7 @@ extern "C" {
 /* To avoid NaN when excluded atoms are at zero distance, we add a small
  * number to r^2. NBNXN_AVOID_SING_R2_INC^-3 should fit in real.
  */
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
 #define NBNXN_AVOID_SING_R2_INC  1.0e-12f
 #else
 /* The double prec. x86 SIMD kernels use a single prec. invsqrt, so > 1e-38 */
index 342c466f662909962c0f87fcf6ba7224c462d5ef..92c56573b1dd68e87bb0a699f4be0e67b28d71e1 100644 (file)
@@ -405,7 +405,7 @@ static void sort_atoms(int dim, gmx_bool Backwards,
     }
 }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define R2F_D(x) ((float)((x) >= 0 ? ((1-GMX_FLOAT_EPS)*(x)) : ((1+GMX_FLOAT_EPS)*(x))))
 #define R2F_U(x) ((float)((x) >= 0 ? ((1+GMX_FLOAT_EPS)*(x)) : ((1-GMX_FLOAT_EPS)*(x))))
 #else
index 8113d601d9feb9f79a002e8aab3dd6e5cde07392..b7b7a5e52c2a52441ed506fa650f4e67cc65e4d5 100644 (file)
@@ -86,7 +86,7 @@ struct gmx_domdec_zones_t;
 #ifdef NBNXN_SEARCH_BB_SIMD4
 /* Always use 4-wide SIMD for bounding box calculations */
 
-#    ifndef GMX_DOUBLE
+#    if !GMX_DOUBLE
 /* Single precision BBs + coordinates, we can also load coordinates with SIMD */
 #        define NBNXN_SEARCH_SIMD4_FLOAT_X_BB
 #    endif
index 508d7614d8b9d00aa6146b303c2de13c554f7c02..a5c9ca103fe6f8afd98c8a3886330a3c0919510f 100644 (file)
                     rinvsix_nm   = rinvsix;
 #endif
                     cr2          = lje_coeff2*rsq;
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
                     expmcr2      = exp(-cr2);
 #else
                     expmcr2      = expf(-cr2);
             rs     = rsq*rinv*ic->tabq_scale;
             ri     = (int)rs;
             frac   = rs - ri;
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
             /* fexcl = F_i + frac * (F_(i+1)-F_i) */
             fexcl  = tab_coul_FDV0[ri*4] + frac*tab_coul_FDV0[ri*4+1];
 #else
             fcoul  = interact*rinvsq - fexcl;
             /* 7 flops for float 1/r-table force */
 #ifdef CALC_ENERGIES
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
             vcoul  = qq*(interact*(rinv - ic->sh_ewald)
                          -(tab_coul_FDV0[ri*4+2]
                            -halfsp*frac*(tab_coul_FDV0[ri*4] + fexcl)));
index 8e79ba49ab1363faac8e003a18e4b5802ebac459..1173f432fa54bc79dadf5112c92f6ac85db65d04 100644 (file)
@@ -160,7 +160,7 @@ NBK_FUNC_NAME(_VgrpF)
 #ifdef CALC_ENERGIES
     real       halfsp;
 #endif
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     const real            *tab_coul_FDV0;
 #else
     const real            *tab_coul_F;
@@ -203,7 +203,7 @@ NBK_FUNC_NAME(_VgrpF)
     halfsp = 0.5/ic->tabq_scale;
 #endif
 
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     tab_coul_FDV0 = ic->tabq_coul_FDV0;
 #else
     tab_coul_F    = ic->tabq_coul_F;
@@ -294,7 +294,7 @@ NBK_FUNC_NAME(_VgrpF)
             Vc_sub_self = 0.5*c_rf;
 #endif
 #ifdef CALC_COUL_TAB
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
             Vc_sub_self = 0.5*tab_coul_V[0];
 #else
             Vc_sub_self = 0.5*tab_coul_FDV0[2];
index 55dd8b310c1d41ac81e12f2ac0cd5480b267f780..8d75fdb2d702486c0f6fd7490e8277f4d94783d8 100644 (file)
@@ -106,7 +106,7 @@ gmx_load_simd_2xnn_interactions(int                  excl,
 #elif GMX_SIMD_HAVE_LOGICAL
     union
     {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         std::int64_t i;
 #else
         std::int32_t i;
index b3ada6af31c08b7ec61ebfba9ac67eaf0464bdf7..2f4c91c871e1043922e338cdd0258f7466def678 100644 (file)
 
     /* Load masks for topology exclusion masking. filter_stride is
        static const, so the conditional will be optimized away. */
-#if defined GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
+#if GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
     exclusion_filter = nbat->simd_exclusion_filter64;
 #else
     exclusion_filter = nbat->simd_exclusion_filter;
index 8584723eb44e37ed85014be259463d8fca3a67fd..9833f7a6a171b92b776353c8cf60cae24547ddb4 100644 (file)
@@ -119,7 +119,7 @@ gmx_load_simd_4xn_interactions(int                               excl,
 #elif GMX_SIMD_HAVE_LOGICAL
     union
     {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         std::int64_t i;
 #else
         std::int32_t i;
index d112e0599f03191b0efacec4f70cc5a73e4edc50..231419f2e0ab4d7072b9cdf3a36653f7f1038923 100644 (file)
 #endif
 
     /* Calculate 1/r */
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     rinv_S0     = invsqrt(rsq_S0);
     rinv_S1     = invsqrt(rsq_S1);
     rinv_S2     = invsqrt(rsq_S2);
index 57700fbb9046117fb5087d26313d86bc12111596..3458e92366abc01f80a6ac7c76a4b58a8e68c081 100644 (file)
@@ -75,7 +75,7 @@
     SimdBool  diagonal_mask1_S0, diagonal_mask1_S1, diagonal_mask1_S2, diagonal_mask1_S3;
 #endif
 
-#if defined GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
+#if GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
     std::uint64_t       *exclusion_filter;
 #else
     std::uint32_t       *exclusion_filter;
 #endif
 #endif
 
-#if defined GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
+#if GMX_DOUBLE && !GMX_SIMD_HAVE_INT32_LOGICAL
     exclusion_filter = nbat->simd_exclusion_filter64;
 #else
     exclusion_filter = nbat->simd_exclusion_filter;
index e629519ca91ed1565c0938d0d8e861eea54882e9..e88922ab6467651f0fdb8a38a5b34c8c1993d550 100644 (file)
@@ -196,7 +196,7 @@ typedef struct {
  * but too small will result in overhead.
  * Currently the block size is NBNXN_BUFFERFLAG_SIZE*3*sizeof(real)=192 bytes.
  */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define NBNXN_BUFFERFLAG_SIZE   8
 #else
 #define NBNXN_BUFFERFLAG_SIZE  16
index db09958fc3ae1b4b6edf6cf95910f1366184466b..145b6618dda9c332f5d0e0f274da8b2b5701e8d3 100644 (file)
@@ -3027,7 +3027,7 @@ static float boundingbox_only_distance2(const nbnxn_grid_t *gridi,
     rbb2 = std::max(0.0, rlist - 0.5*std::sqrt(bbx*bbx + bby*bby));
     rbb2 = rbb2 * rbb2;
 
-#ifndef GMX_DOUBLE
+#if !GMX_DOUBLE
     return rbb2;
 #else
     return (float)((1+GMX_FLOAT_EPS)*rbb2);
index f8f4dc51127477e381824f5689a6010447c2a5df..94fd494f247efb70bba2f829fa1b9f80f58554e8 100644 (file)
@@ -421,7 +421,7 @@ static void pp_verlet_load(const gmx_mtop_t *mtop, const t_inputrec *ir,
     /* Conversion factor for reference vs SIMD kernel performance.
      * The factor is about right for SSE2/4, but should be 2 higher for AVX256.
      */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     const real     nbnxn_refkernel_fac = 4.0;
 #else
     const real     nbnxn_refkernel_fac = 8.0;
index 76cbd9fe481f33d3415422ae236f482849c732ec..76a60693e2204b475ed28932772e560b282d1332 100644 (file)
@@ -180,14 +180,8 @@ void init_gaussian(t_QMrec *qm)
             out = fopen("LJ.dat", "w");
             for (i = 0; i < qm->nrQMatoms; i++)
             {
-
-#ifdef GMX_DOUBLE
-                fprintf(out, "%3d  %10.7lf  %10.7lf\n",
-                        qm->atomicnumberQM[i], qm->c6[i], qm->c12[i]);
-#else
                 fprintf(out, "%3d  %10.7f  %10.7f\n",
                         qm->atomicnumberQM[i], qm->c6[i], qm->c12[i]);
-#endif
             }
             fclose(out);
         }
@@ -413,19 +407,11 @@ void write_gaussian_SH_input(int step, gmx_bool swap,
     fprintf(out, "%2d%2d\n", qm->QMcharge, qm->multiplicity);
     for (i = 0; i < qm->nrQMatoms; i++)
     {
-#ifdef GMX_DOUBLE
-        fprintf(out, "%3d %10.7lf  %10.7lf  %10.7lf\n",
-                qm->atomicnumberQM[i],
-                qm->xQM[i][XX]/BOHR2NM,
-                qm->xQM[i][YY]/BOHR2NM,
-                qm->xQM[i][ZZ]/BOHR2NM);
-#else
         fprintf(out, "%3d %10.7f  %10.7f  %10.7f\n",
                 qm->atomicnumberQM[i],
                 qm->xQM[i][XX]/BOHR2NM,
                 qm->xQM[i][YY]/BOHR2NM,
                 qm->xQM[i][ZZ]/BOHR2NM);
-#endif
     }
     /* MM point charge data */
     if (QMMMrec->QMMMscheme != eQMMMschemeoniom && mm->nrMMatoms)
@@ -433,32 +419,18 @@ void write_gaussian_SH_input(int step, gmx_bool swap,
         fprintf(out, "\n");
         for (i = 0; i < mm->nrMMatoms; i++)
         {
-#ifdef GMX_DOUBLE
-            fprintf(out, "%10.7lf  %10.7lf  %10.7lf %8.4lf\n",
-                    mm->xMM[i][XX]/BOHR2NM,
-                    mm->xMM[i][YY]/BOHR2NM,
-                    mm->xMM[i][ZZ]/BOHR2NM,
-                    mm->MMcharges[i]);
-#else
             fprintf(out, "%10.7f  %10.7f  %10.7f %8.4f\n",
                     mm->xMM[i][XX]/BOHR2NM,
                     mm->xMM[i][YY]/BOHR2NM,
                     mm->xMM[i][ZZ]/BOHR2NM,
                     mm->MMcharges[i]);
-#endif
         }
     }
     if (bSA) /* put the SA coefficients at the end of the file */
     {
-#ifdef GMX_DOUBLE
-        fprintf(out, "\n%10.8lf %10.8lf\n",
-                qm->SAstep*0.5/qm->SAsteps,
-                1-qm->SAstep*0.5/qm->SAsteps);
-#else
         fprintf(out, "\n%10.8f %10.8f\n",
                 qm->SAstep*0.5/qm->SAsteps,
                 1-qm->SAstep*0.5/qm->SAsteps);
-#endif
         fprintf(stderr, "State Averaging level = %d/%d\n", qm->SAstep, qm->SAsteps);
     }
     fprintf(out, "\n");
@@ -574,19 +546,11 @@ void write_gaussian_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
     fprintf(out, "%2d%2d\n", qm->QMcharge, qm->multiplicity);
     for (i = 0; i < qm->nrQMatoms; i++)
     {
-#ifdef GMX_DOUBLE
-        fprintf(out, "%3d %10.7lf  %10.7lf  %10.7lf\n",
-                qm->atomicnumberQM[i],
-                qm->xQM[i][XX]/BOHR2NM,
-                qm->xQM[i][YY]/BOHR2NM,
-                qm->xQM[i][ZZ]/BOHR2NM);
-#else
         fprintf(out, "%3d %10.7f  %10.7f  %10.7f\n",
                 qm->atomicnumberQM[i],
                 qm->xQM[i][XX]/BOHR2NM,
                 qm->xQM[i][YY]/BOHR2NM,
                 qm->xQM[i][ZZ]/BOHR2NM);
-#endif
     }
 
     /* Pseudo Potential and ECP are included here if selected (MEthod suffix LAN) */
@@ -646,21 +610,12 @@ void write_gaussian_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
              */
             for (i = 0; i < mm->nrMMatoms; i++)
             {
-#ifdef GMX_DOUBLE
-                fprintf(out, "%10.7lf  %10.7lf  %10.7lf %8.4lf 0.0 %10.7lf %10.7lf\n",
-                        mm->xMM[i][XX]/BOHR2NM,
-                        mm->xMM[i][YY]/BOHR2NM,
-                        mm->xMM[i][ZZ]/BOHR2NM,
-                        mm->MMcharges[i],
-                        mm->c6[i], mm->c12[i]);
-#else
                 fprintf(out, "%10.7f  %10.7f  %10.7f %8.4f 0.0 %10.7f %10.7f\n",
                         mm->xMM[i][XX]/BOHR2NM,
                         mm->xMM[i][YY]/BOHR2NM,
                         mm->xMM[i][ZZ]/BOHR2NM,
                         mm->MMcharges[i],
                         mm->c6[i], mm->c12[i]);
-#endif
             }
             fprintf(out, "\n");
         }
@@ -668,19 +623,11 @@ void write_gaussian_input(int step, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
         {
             for (i = 0; i < mm->nrMMatoms; i++)
             {
-#ifdef GMX_DOUBLE
-                fprintf(out, "%10.7lf  %10.7lf  %10.7lf %8.4lf\n",
-                        mm->xMM[i][XX]/BOHR2NM,
-                        mm->xMM[i][YY]/BOHR2NM,
-                        mm->xMM[i][ZZ]/BOHR2NM,
-                        mm->MMcharges[i]);
-#else
                 fprintf(out, "%10.7f  %10.7f  %10.7f %8.4f\n",
                         mm->xMM[i][XX]/BOHR2NM,
                         mm->xMM[i][YY]/BOHR2NM,
                         mm->xMM[i][ZZ]/BOHR2NM,
                         mm->MMcharges[i]);
-#endif
             }
         }
     }
@@ -719,7 +666,7 @@ real read_gaussian_output(rvec QMgrad[], rvec MMgrad[], t_QMrec *qm, t_MMrec *mm
                 gmx_fatal(FARGS, "Error reading Gaussian output - not enough atom lines?");
             }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
             sscanf(buf, "%d %lf %lf %lf\n",
                    &atnum,
                    &qm->xQM[i][XX],
@@ -746,7 +693,7 @@ real read_gaussian_output(rvec QMgrad[], rvec MMgrad[], t_QMrec *qm, t_MMrec *mm
         gmx_fatal(FARGS, "Error reading Gaussian output");
     }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     sscanf(buf, "%lf\n", &QMener);
 #else
     sscanf(buf, "%f\n", &QMener);
@@ -758,7 +705,7 @@ real read_gaussian_output(rvec QMgrad[], rvec MMgrad[], t_QMrec *qm, t_MMrec *mm
         {
             gmx_fatal(FARGS, "Error reading Gaussian output");
         }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         sscanf(buf, "%lf %lf %lf\n",
                &QMgrad[i][XX],
                &QMgrad[i][YY],
@@ -779,7 +726,7 @@ real read_gaussian_output(rvec QMgrad[], rvec MMgrad[], t_QMrec *qm, t_MMrec *mm
             {
                 gmx_fatal(FARGS, "Error reading Gaussian output");
             }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
             sscanf(buf, "%lf %lf %lf\n",
                    &MMgrad[i][XX],
                    &MMgrad[i][YY],
@@ -816,7 +763,7 @@ real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step, t_QMrec *qm
         gmx_fatal(FARGS, "Error reading Gaussian output");
     }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     sscanf(buf, "%lf %lf\n", &QMener, &DeltaE);
 #else
     sscanf(buf, "%f %f\n",  &QMener, &DeltaE);
@@ -849,7 +796,7 @@ real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step, t_QMrec *qm
             gmx_fatal(FARGS, "Error reading Gaussian output");
         }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         sscanf(buf, "%lf %lf %lf\n",
                &QMgrad[i][XX],
                &QMgrad[i][YY],
@@ -869,7 +816,7 @@ real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step, t_QMrec *qm
         {
             gmx_fatal(FARGS, "Error reading Gaussian output");
         }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         sscanf(buf, "%lf %lf %lf\n",
                &MMgrad[i][XX],
                &MMgrad[i][YY],
@@ -913,7 +860,7 @@ real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step, t_QMrec *qm
         {
             gmx_fatal(FARGS, "Error reading Gaussian output");
         }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         sscanf(buf, "%lf\n", &qm->CIvec1[i]);
 #else
         sscanf(buf, "%f\n", &qm->CIvec1[i]);
@@ -926,7 +873,7 @@ real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step, t_QMrec *qm
         {
             gmx_fatal(FARGS, "Error reading Gaussian output");
         }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         sscanf(buf, "%lf\n", &qm->CIvec2[i]);
 #else
         sscanf(buf, "%f\n", &qm->CIvec2[i]);
index b0cf841c9ff063e7ce52ac18d56e870e3a39a5a4..fb4bc9dd620e889ccf30c920404ef3ea983a5a19 100644 (file)
@@ -192,20 +192,12 @@ void write_orca_input(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
             fprintf(LJCoeff, "%d\n", qm->nrQMatoms);
             for (i = 0; i < qm->nrQMatoms; i++)
             {
-#ifdef GMX_DOUBLE
-                fprintf(LJCoeff, "%10.7lf  %10.7lf\n", qm->c6[i], qm->c12[i]);
-#else
                 fprintf(LJCoeff, "%10.7f  %10.7f\n", qm->c6[i], qm->c12[i]);
-#endif
             }
             fprintf(LJCoeff, "%d\n", mm->nrMMatoms);
             for (i = 0; i < mm->nrMMatoms; i++)
             {
-#ifdef GMX_DOUBLE
-                fprintf(LJCoeff, "%10.7lf  %10.7lf\n", mm->c6[i], mm->c12[i]);
-#else
                 fprintf(LJCoeff, "%10.7f  %10.7f\n", mm->c6[i], mm->c12[i]);
-#endif
             }
             fclose(LJCoeff);
         }
@@ -226,19 +218,11 @@ void write_orca_input(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
         {
             atomNr = qm->atomicnumberQM[i];
         }
-#ifdef GMX_DOUBLE
-        fprintf(out, "%3d %10.7lf  %10.7lf  %10.7lf\n",
-                atomNr,
-                qm->xQM[i][XX]/0.1,
-                qm->xQM[i][YY]/0.1,
-                qm->xQM[i][ZZ]/0.1);
-#else
         fprintf(out, "%3d %10.7f  %10.7f  %10.7f\n",
                 atomNr,
                 qm->xQM[i][XX]/0.1,
                 qm->xQM[i][YY]/0.1,
                 qm->xQM[i][ZZ]/0.1);
-#endif
     }
     fprintf(out, "*\n");
 
@@ -253,19 +237,11 @@ void write_orca_input(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm)
         fprintf(pcFile, "%d\n", mm->nrMMatoms);
         for (i = 0; i < mm->nrMMatoms; i++)
         {
-#ifdef GMX_DOUBLE
-            fprintf(pcFile, "%8.4lf %10.7lf  %10.7lf  %10.7lf\n",
-                    mm->MMcharges[i],
-                    mm->xMM[i][XX]/0.1,
-                    mm->xMM[i][YY]/0.1,
-                    mm->xMM[i][ZZ]/0.1);
-#else
             fprintf(pcFile, "%8.4f %10.7f  %10.7f  %10.7f\n",
                     mm->MMcharges[i],
                     mm->xMM[i][XX]/0.1,
                     mm->xMM[i][YY]/0.1,
                     mm->xMM[i][ZZ]/0.1);
-#endif
         }
         fprintf(pcFile, "\n");
         fclose(pcFile);
@@ -316,7 +292,7 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr,
             {
                 gmx_fatal(FARGS, "Unexpected end of ORCA output");
             }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
             sscanf(buf, "%d%lf%lf%lf\n",
                    &atnum,
                    &qm->xQM[i][XX],
@@ -355,7 +331,7 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr,
     {
         gmx_fatal(FARGS, "Unexpected end of ORCA output");
     }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     sscanf(buf, "%lf\n", &QMener);
 #else
     sscanf(buf, "%f\n", &QMener);
@@ -381,7 +357,7 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr,
         {
             gmx_fatal(FARGS, "Unexpected end of ORCA output");
         }
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         if (i%3 == 0)
         {
             sscanf(buf, "%lf\n", &QMgrad[k][XX]);
@@ -431,7 +407,7 @@ real read_orca_output(rvec QMgrad[], rvec MMgrad[], t_forcerec *fr,
             {
                 gmx_fatal(FARGS, "Unexpected end of ORCA output");
             }
-    #ifdef GMX_DOUBLE
+    #if GMX_DOUBLE
             sscanf(buf, "%lf%lf%lf\n",
                    &MMgrad[i][XX],
                    &MMgrad[i][YY],
index a2b3360624e2ff6bc221061f0c1b396600f4c505..257cf5100eb14f55ecbaa36c6fa888826001378c 100644 (file)
@@ -772,7 +772,7 @@ class EnumOptionInfo : public OptionInfo
  * Generally, new would be better using DoubleOption, but this is provided for
  * cases where the output value needs to be of type `real` for some reason.
  */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 typedef DoubleOption     RealOption;
 typedef DoubleOptionInfo RealOptionInfo;
 #else
index 4dfd70e6da1c75e121243a8a742eea357ecec356..675be5f8f1a24726e718de7ec4211d0b6d0245e0 100644 (file)
@@ -60,7 +60,7 @@
  *
  * The defines in this top-level file will set default Gromacs real precision
  * operations to either single or double precision based on whether
- * GMX_DOUBLE is defined. The actual implementation - including e.g.
+ * GMX_DOUBLE is 1. The actual implementation - including e.g.
  * conversion operations specifically between single and double - is documented
  * in impl_reference.h.
  *
 #    include "impl_none/impl_none.h"
 #endif
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #    define GMX_SIMD_HAVE_REAL                                     GMX_SIMD_HAVE_DOUBLE
 #    define GMX_SIMD_REAL_WIDTH                                    GMX_SIMD_DOUBLE_WIDTH
 #    define GMX_SIMD_HAVE_INT32_EXTRACT                            GMX_SIMD_HAVE_DINT32_EXTRACT
 
 /*! \brief 1 if SimdReal is available, otherwise 0.
  *
- *  \ref GMX_SIMD_HAVE_DOUBLE if GMX_DOUBLE is set, otherwise \ref GMX_SIMD_HAVE_FLOAT.
+ *  \ref GMX_SIMD_HAVE_DOUBLE if GMX_DOUBLE is 1, otherwise \ref GMX_SIMD_HAVE_FLOAT.
  */
 #    define GMX_SIMD_HAVE_REAL               GMX_SIMD_HAVE_FLOAT
 
 /*! \brief Width of SimdReal.
  *
- *  \ref GMX_SIMD_DOUBLE_WIDTH if GMX_DOUBLE is set, otherwise \ref GMX_SIMD_FLOAT_WIDTH.
+ *  \ref GMX_SIMD_DOUBLE_WIDTH if GMX_DOUBLE is 1, otherwise \ref GMX_SIMD_FLOAT_WIDTH.
  */
 #    define GMX_SIMD_REAL_WIDTH              GMX_SIMD_FLOAT_WIDTH
 
 /*! \brief 1 if support is available for extracting elements from SimdInt32, otherwise 0
  *
- *  \ref GMX_SIMD_HAVE_DINT32_EXTRACT if GMX_DOUBLE is set, otherwise
+ *  \ref GMX_SIMD_HAVE_DINT32_EXTRACT if GMX_DOUBLE is 1, otherwise
  *  \ref GMX_SIMD_HAVE_FINT32_EXTRACT.
  */
 #    define GMX_SIMD_HAVE_INT32_EXTRACT      GMX_SIMD_HAVE_FINT32_EXTRACT
 
 /*! \brief 1 if logical ops are supported on SimdInt32, otherwise 0.
  *
- *  \ref GMX_SIMD_HAVE_DINT32_LOGICAL if GMX_DOUBLE is set, otherwise
+ *  \ref GMX_SIMD_HAVE_DINT32_LOGICAL if GMX_DOUBLE is 1, otherwise
  *  \ref GMX_SIMD_HAVE_FINT32_LOGICAL.
  */
 #    define GMX_SIMD_HAVE_INT32_LOGICAL      GMX_SIMD_HAVE_FINT32_LOGICAL
 
 /*! \brief 1 if arithmetic ops are supported on SimdInt32, otherwise 0.
  *
- *  \ref GMX_SIMD_HAVE_DINT32_ARITHMETICS if GMX_DOUBLE is set, otherwise
+ *  \ref GMX_SIMD_HAVE_DINT32_ARITHMETICS if GMX_DOUBLE is 1, otherwise
  *  \ref GMX_SIMD_HAVE_FINT32_ARITHMETICS.
  */
 #    define GMX_SIMD_HAVE_INT32_ARITHMETICS  GMX_SIMD_HAVE_FINT32_ARITHMETICS
 
 /*! \brief 1 if gmx::simdGatherLoadUBySimdIntTranspose is present, otherwise 0
  *
- *  \ref GMX_SIMD_HAVE_GATHER_LOADU_BYSIMDINT_TRANSPOSE_DOUBLE if GMX_DOUBLE is set, otherwise
+ *  \ref GMX_SIMD_HAVE_GATHER_LOADU_BYSIMDINT_TRANSPOSE_DOUBLE if GMX_DOUBLE is 1, otherwise
  *  \ref GMX_SIMD_HAVE_GATHER_LOADU_BYSIMDINT_TRANSPOSE_FLOAT.
  */
 #    define GMX_SIMD_HAVE_GATHER_LOADU_BYSIMDINT_TRANSPOSE_REAL    GMX_SIMD_HAVE_GATHER_LOADU_BYSIMDINT_TRANSPOSE_FLOAT
 
 /*! \brief 1 if real half-register load/store/reduce utils present, otherwise 0
  *
- *  \ref GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE if GMX_DOUBLE is set, otherwise
+ *  \ref GMX_SIMD_HAVE_HSIMD_UTIL_DOUBLE if GMX_DOUBLE is 1, otherwise
  *  \ref GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT.
  */
 #    define GMX_SIMD_HAVE_HSIMD_UTIL_REAL    GMX_SIMD_HAVE_HSIMD_UTIL_FLOAT
 
 /*! \brief 1 if Simd4Real is available, otherwise 0.
  *
- *  \ref GMX_SIMD4_HAVE_DOUBLE if GMX_DOUBLE is set, otherwise \ref GMX_SIMD4_HAVE_FLOAT.
+ *  \ref GMX_SIMD4_HAVE_DOUBLE if GMX_DOUBLE is 1, otherwise \ref GMX_SIMD4_HAVE_FLOAT.
  */
 #    define GMX_SIMD4_HAVE_REAL              GMX_SIMD4_HAVE_FLOAT
 
@@ -208,14 +208,14 @@ namespace gmx
  *
  * This type is only available if \ref GMX_SIMD_HAVE_REAL is 1.
  *
- * \ref SimdDouble if GMX_DOUBLE is set, otherwise \ref SimdFloat.
+ * \ref SimdDouble if GMX_DOUBLE is 1, otherwise \ref SimdFloat.
  *
  * \note This variable cannot be placed inside other structures or classes, since
  *       some compilers (including at least clang-3.7) appear to lose the
  *       alignment. This is likely particularly severe when allocating such
  *       memory on the heap, but it occurs for stack structures too.
  */
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
 typedef SimdDouble               SimdReal;
 #    else
 typedef SimdFloat                SimdReal;
@@ -226,7 +226,7 @@ typedef SimdFloat                SimdReal;
  *
  * This type is only available if \ref GMX_SIMD_HAVE_REAL is 1.
  *
- * If GMX_DOUBLE is defined, this will be set to \ref SimdDBool
+ * If GMX_DOUBLE is 1, this will be set to \ref SimdDBool
  * internally, otherwise \ref SimdFBool. This is necessary since some
  * SIMD implementations use bitpatterns for marking truth, so single-
  * vs. double precision booleans are not necessarily exchangable.
@@ -239,7 +239,7 @@ typedef SimdFloat                SimdReal;
  *       alignment. This is likely particularly severe when allocating such
  *       memory on the heap, but it occurs for stack structures too.
  */
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
 typedef SimdDBool                SimdBool;
 #    else
 typedef SimdFBool                SimdBool;
@@ -248,7 +248,7 @@ typedef SimdFBool                SimdBool;
 
 /*! \brief 32-bit integer SIMD type.
  *
- * If GMX_DOUBLE is defined, this will be set to \ref SimdDInt32
+ * If GMX_DOUBLE is 1, this will be set to \ref SimdDInt32
  * internally, otherwise \ref SimdFInt32. This might seem a strange
  * implementation detail, but it is because some SIMD implementations use
  * different types/widths of integers registers when converting from
@@ -260,7 +260,7 @@ typedef SimdFBool                SimdBool;
  *       alignment. This is likely particularly severe when allocating such
  *       memory on the heap, but it occurs for stack structures too.
  */
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
 typedef SimdDInt32               SimdInt32;
 #    else
 typedef SimdFInt32               SimdInt32;
@@ -271,7 +271,7 @@ typedef SimdFInt32               SimdInt32;
  *
  * This type is only available if \ref GMX_SIMD_HAVE_INT32_ARITHMETICS is 1.
  *
- * If GMX_DOUBLE is defined, this will be set to \ref SimdDIBool
+ * If GMX_DOUBLE is 1, this will be set to \ref SimdDIBool
  * internally, otherwise \ref SimdFIBool. This is necessary since some
  * SIMD implementations use bitpatterns for marking truth, so single-
  * vs. double precision booleans are not necessarily exchangable, and while
@@ -290,7 +290,7 @@ typedef SimdFInt32               SimdInt32;
  *       alignment. This is likely particularly severe when allocating such
  *       memory on the heap, but it occurs for stack structures too.
  */
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
 typedef SimdDIBool               SimdIBool;
 #    else
 typedef SimdFIBool               SimdIBool;
@@ -298,7 +298,7 @@ typedef SimdFIBool               SimdIBool;
 #endif  // GMX_SIMD_HAVE_INT32_ARITHMETICS
 
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 const int c_simdBestPairAlignment = c_simdBestPairAlignmentDouble;
 #else
 const int c_simdBestPairAlignment = c_simdBestPairAlignmentFloat;
@@ -311,14 +311,14 @@ const int c_simdBestPairAlignment = c_simdBestPairAlignmentFloat;
  *
  * This type is only available if \ref GMX_SIMD4_HAVE_REAL is 1.
  *
- * \ref Simd4Double if GMX_DOUBLE is set, otherwise \ref Simd4Float.
+ * \ref Simd4Double if GMX_DOUBLE is 1, otherwise \ref Simd4Float.
  *
  * \note This variable cannot be placed inside other structures or classes, since
  *       some compilers (including at least clang-3.7) appear to lose the
  *       alignment. This is likely particularly severe when allocating such
  *       memory on the heap, but it occurs for stack structures too.
  */
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
 typedef Simd4Double               Simd4Real;
 #    else
 typedef Simd4Float                Simd4Real;
@@ -329,7 +329,7 @@ typedef Simd4Float                Simd4Real;
  *
  * This type is only available if \ref GMX_SIMD4_HAVE_REAL is 1.
  *
- * If GMX_DOUBLE is defined, this will be set to \ref Simd4DBool
+ * If GMX_DOUBLE is 1, this will be set to \ref Simd4DBool
  * internally, otherwise \ref Simd4FBool. This is necessary since some
  * SIMD implementations use bitpatterns for marking truth, so single-
  * vs. double precision booleans are not necessarily exchangable.
@@ -340,7 +340,7 @@ typedef Simd4Float                Simd4Real;
  *       alignment. This is likely particularly severe when allocating such
  *       memory on the heap, but it occurs for stack structures too.
  */
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
 typedef Simd4DBool                Simd4Bool;
 #    else
 typedef Simd4FBool                Simd4Bool;
index d1804720835911dfa1da6b3511f90553970463ac..41825a9b38dcea311622d3c0cbe836d5140981a1 100644 (file)
@@ -81,7 +81,7 @@ SimdBaseTest::compareVectorRealUlp(const char * refExpr,   const char * tstExpr,
     size_t                        i;
 
     union {
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         double r; std::int64_t i;
 #else
         float  r; std::int32_t i;
index 59a84fe4d9de9a1a084f5a2851742d6b69ca2868..77d4a3dcbabb9a649bf5bd1e49b33bc514e14ec2 100644 (file)
@@ -102,7 +102,7 @@ class SimdBaseTest : public ::testing::Test
          * exponentials, logarithms, and error functions.
          */
         SimdBaseTest() :
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
             ulpTol_((1LL << (2 + std::numeric_limits<double>::digits-GMX_SIMD_ACCURACY_BITS_DOUBLE))),
 #else
             ulpTol_((1LL << (2 + std::numeric_limits<float>::digits-GMX_SIMD_ACCURACY_BITS_SINGLE))),
index 30589c83ae5e503a52e14fd2fdeff611f40f22f9..9ba7bb50caec10638ab8231af19ef001c767a25e 100644 (file)
@@ -78,7 +78,7 @@ const SimdReal rSimd_m3p75    = setSimdRealFrom1R(-3.75);
 const SimdReal rSimd_Exp      = setSimdRealFrom3R( 1.4055235171027452623914516e+18,
                                                    5.3057102734253445623914516e-13,
                                                    -2.1057102745623934534514516e+16);
-#    if GMX_SIMD_HAVE_DOUBLE && defined GMX_DOUBLE
+#    if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
 // Make sure we also test exponents outside single precision when we use double
 const SimdReal rSimd_ExpDouble = setSimdRealFrom3R( 6.287393598732017379054414e+176,
                                                     8.794495252903116023030553e-140,
index 89648b5c69a0efe46d5c49f7741c9dc2063f6ac6..2857b697de66cefbe460ddeb142800f478c416e3 100644 (file)
@@ -121,7 +121,7 @@ extern const SimdReal rSimd_m2p25;     //!< Negative value that rounds up.
 extern const SimdReal rSimd_m3p75;     //!< Negative value that rounds down.
 //! Three large floating-point values whose exponents are >32.
 extern const SimdReal rSimd_Exp;
-#    if GMX_SIMD_HAVE_DOUBLE && defined GMX_DOUBLE
+#    if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
 // Make sure we also test exponents outside single precision when we use double
 extern const SimdReal rSimd_ExpDouble;
 #    endif
index b6a005370fbeeb6c8dc03d223062e5032b15dd08..c50f8db6a2f99ad46043578d796b569b3753d3a0 100644 (file)
@@ -66,7 +66,7 @@ const Simd4Real rSimd4_m3p75    = setSimd4RealFrom1R(-3.75);
 const Simd4Real rSimd4_Exp      = setSimd4RealFrom3R( 1.4055235171027452623914516e+18,
                                                       5.3057102734253445623914516e-13,
                                                       -2.1057102745623934534514516e+16);
-#    if GMX_SIMD_HAVE_DOUBLE && defined GMX_DOUBLE
+#    if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
 // Make sure we also test exponents outside single precision when we use double
 const Simd4Real  rSimd_ExpDouble = setSimd4RealFrom3R( 6.287393598732017379054414e+176,
                                                        8.794495252903116023030553e-140,
index f1a0e3221e19b54ce942115bcef88b4f30792cd8..4432227cf75368ae766f648bb5339ff8c5905795 100644 (file)
@@ -80,7 +80,7 @@ extern const Simd4Real rSimd4_m2p25;     //!< Negative value that rounds up.
 extern const Simd4Real rSimd4_m3p75;     //!< Negative value that rounds down.
 //! Three large floating-point values whose exponents are >32.
 extern const Simd4Real rSimd4_Exp;
-#    if GMX_SIMD_HAVE_DOUBLE && defined GMX_DOUBLE
+#    if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
 // Make sure we also test exponents outside single precision when we use double
 extern const Simd4Real rSimd4_ExpDouble;
 #    endif
index 20ad9b9d71a4271e0647cbe10b89f5eade0e5581..6394fa3a60066d2fe91b5477351bb9fd2bd2a6dd 100644 (file)
@@ -297,7 +297,7 @@ TEST_F(Simd4FloatingpointTest, dotProduct)
 {
     Simd4Real v1 = setSimd4RealFrom3R(1, 4, 5);
     Simd4Real v2 = setSimd4RealFrom3R(3, 8, 2);
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
     EXPECT_DOUBLE_EQ(45.0, dotProduct(v1, v2));
 #    else
     EXPECT_FLOAT_EQ(45.0, dotProduct(v1, v2));
index bec5e63a01b0d09dc0fcb6d1423c97569289e15c..856841c22ec63fe21897d2851b2c100e959d3a43 100644 (file)
@@ -103,7 +103,7 @@ Simd4MathTest::compareSimd4MathFunction(const char * refFuncExpr, const char *si
     int                          i, iter;
     int                          niter   = s_nPoints/GMX_SIMD4_WIDTH;
     int                          npoints = niter*GMX_SIMD4_WIDTH;
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
     union {
         double r; std::int64_t i;
     } conv0, conv1;
index cc26d32f9a98240b9fce41c2638fcbdc65b36e55..18a213207ccf62a0d1127713eb6e1f0f385ff7d2 100644 (file)
@@ -243,7 +243,7 @@ TEST_F(SimdFloatingpointTest, frexp)
     GMX_EXPECT_SIMD_INT_EQ(setSimdIntFrom3I(61, -40, 55), exponent);
 
 
-#if GMX_SIMD_HAVE_DOUBLE && defined GMX_DOUBLE
+#if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
     fraction = frexp(rSimd_ExpDouble, &exponent);
 
     GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(0.6206306194761728178832527,
@@ -262,7 +262,7 @@ TEST_F(SimdFloatingpointTest, ldexp)
 
     GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(pow(2.0, 60.0), pow(2.0, -41.0), pow(2.0, 54.0)),
                             ldexp(one, setSimdIntFrom3I(60, -41, 54)));
-#if GMX_SIMD_HAVE_DOUBLE && defined GMX_DOUBLE
+#if GMX_SIMD_HAVE_DOUBLE && GMX_DOUBLE
     GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom3R(pow(2.0, 587.0), pow(2.0, -462.0), pow(2.0, 672.0)),
                             ldexp(one, setSimdIntFrom3I(587, -462, 672)));
 #endif
index bb0a3573f554247cc7202509800c459dc04b4c47..d9aa834dec488223b0e7f18a78c09d716dec4333 100644 (file)
@@ -104,7 +104,7 @@ SimdMathTest::compareSimdMathFunction(const char * refFuncExpr, const char *simd
     int                          i, iter;
     int                          niter   = s_nPoints/GMX_SIMD_REAL_WIDTH;
     int                          npoints = niter*GMX_SIMD_REAL_WIDTH;
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
     union {
         double r; std::int64_t i;
     } conv0, conv1;
@@ -462,7 +462,7 @@ refPmeForceCorrection(real x)
 TEST_F(SimdMathTest, pmeForceCorrection)
 {
     // Pme correction only needs to be ~1e-6 accuracy single, 1e-10 double
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     setUlpTol(std::int64_t(5e-10/GMX_REAL_EPS));
 #else
     setUlpTol(std::int64_t(5e-6/GMX_REAL_EPS));
@@ -485,7 +485,7 @@ refPmePotentialCorrection(real x)
 TEST_F(SimdMathTest, pmePotentialCorrection)
 {
     // Pme correction only needs to be ~1e-6 accuracy single, 1e-10 double
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     setUlpTol(std::int64_t(5e-10/GMX_REAL_EPS));
 #else
     setUlpTol(std::int64_t(5e-6/GMX_REAL_EPS));
index 847026578731a1558162b790dae94ae594c30ad2..7d9026f37b24c4fb56de99a5acb0b8b04b3fb6a8 100644 (file)
@@ -1405,7 +1405,7 @@ t_forcetable *make_tables(FILE *out,
     else
     {
         // No tables are read
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
         table->scale = 2000.0;
 #else
         table->scale = 500.0;
index 9a337993b0232a96fd57cc3d0fac7fd5905a0949..05d1c18f82cbafdd1954129b8cc699589ab77603 100644 (file)
@@ -55,7 +55,7 @@ const char *gmx_version_git_central_base_hash()
     return _gmx_central_base_hash;
 }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 void gmx_is_double_precision()
 {
 }
index c997f515f4b0b0095d1e0209404b7a058416f55b..29e492cd61e1112b19fd0c656656852ffe725b04 100644 (file)
@@ -194,7 +194,7 @@ const char *getFftDescriptionString()
     return "fftw3";
 #  else
     // Use the version string provided by libfftw3
-#    ifdef GMX_DOUBLE
+#    if GMX_DOUBLE
     return fftw_version;
 #    else
     return fftwf_version;
@@ -223,7 +223,7 @@ void gmx_print_version_info(FILE *fp)
         fprintf(fp, "Branched from:      %s\n", base_hash);
     }
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     fprintf(fp, "Precision:          double\n");
 #else
     fprintf(fp, "Precision:          single\n");
@@ -320,7 +320,7 @@ void printBinaryInformation(FILE                            *fp,
     const char *prefix          = settings.prefix_;
     const char *suffix          = settings.suffix_;
     const char *precisionString = "";
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
     precisionString = " (double precision)";
 #endif
     const char *const name = programContext.displayName();
index e8a3ae18e7702dc765c24ddc2564438e8a875b67..9ad17d3f9ba41badcfd632f9d548a058d12fc33d 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
 /*! \def gmx_real_fullprecision_pfmt
  * \brief Format string for full `real` precision.
  */
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 
 #ifndef HAVE_REAL
 typedef double      real;
index 92021f0c0d05b96b7bbf68f9abb27731db217e36..dc4b68bba235bbd84c57879b12d629f7e49da212 100644 (file)
@@ -541,7 +541,7 @@ static inline ::testing::AssertionResult assertEqualWithinTolerance(
  * \hideinitializer
  */
 
-#ifdef GMX_DOUBLE
+#if GMX_DOUBLE
 #define EXPECT_REAL_EQ_TOL(value1, value2, tolerance) \
     EXPECT_DOUBLE_EQ_TOL(value1, value2, tolerance)
 #define ASSERT_REAL_EQ_TOL(value1, value2, tolerance) \