re-introduced fix for real/double issue in gmx_density
authorBerk Hess <hess@kth.se>
Thu, 17 May 2012 22:07:46 +0000 (00:07 +0200)
committerBerk Hess <hess@kth.se>
Mon, 21 May 2012 14:13:21 +0000 (16:13 +0200)
The float density histogram could overflow for large data sets.
A fix replaced 3 of the 4 pointers to floats by pointers to doubles, leading
to compilation issues. In two steps these replacements were reverted.
Now all 4 pointers have been replaced.

Change-Id: I0d8e38d27ac5c469480ff731ad191d869f5d890f

src/tools/gmx_density.c

index fa02130d96efa238c5ecf85c757384d8dbdba6db..f18041c9dfc5567131097500ac01e01def9e8e41 100644 (file)
@@ -141,7 +141,7 @@ void center_coords(t_atoms *atoms,matrix box,rvec x0[],int axis)
 }
 
 void calc_electron_density(const char *fn, atom_id **index, int gnx[], 
-                          real ***slDensity, int *nslices, t_topology *top,
+                          double ***slDensity, int *nslices, t_topology *top,
                           int ePBC,
                           int axis, int nr_grps, real *slWidth, 
                           t_electron eltab[], int nr,gmx_bool bCenter,
@@ -239,7 +239,7 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
 }
 
 void calc_density(const char *fn, atom_id **index, int gnx[], 
-                 real ***slDensity, int *nslices, t_topology *top, int ePBC,
+                 double ***slDensity, int *nslices, t_topology *top, int ePBC,
                  int axis, int nr_grps, real *slWidth, gmx_bool bCenter,
                   const output_env_t oenv)
 {
@@ -323,7 +323,7 @@ void calc_density(const char *fn, atom_id **index, int gnx[],
   sfree(x0);  /* free memory used by coordinate array */
 }
 
-void plot_density(real *slDensity[], const char *afile, int nslices,
+void plot_density(double *slDensity[], const char *afile, int nslices,
                  int nr_grps, char *grpname[], real slWidth, 
                  const char **dens_opt,
                  gmx_bool bSymmetrize, const output_env_t oenv)
@@ -409,7 +409,7 @@ int gmx_density(int argc,char *argv[])
     "When calculating electron densities, atomnames are used instead of types. This is bad.",
   };
   
-  real **density;      /* density per slice          */
+  double **density;      /* density per slice          */
   real slWidth;          /* width of one slice         */
   char **grpname;        /* groupnames                 */
   int  nr_electrons;     /* nr. electrons              */