Merge branch 'master' into pygromacs
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_h2order.cpp
similarity index 96%
rename from src/gromacs/gmxana/gmx_h2order.c
rename to src/gromacs/gmxana/gmx_h2order.cpp
index bab0785283cc3abd0d298345679ab18d53d11918..2e0ab2655f67e202e79e0b811816cb69d02bd9b6 100644 (file)
@@ -36,8 +36,8 @@
  */
 #include "gmxpre.h"
 
-#include <math.h>
-#include <string.h>
+#include <cmath>
+#include <cstring>
 
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/trxio.h"
@@ -92,7 +92,7 @@ void calc_h2order(const char *fn, atom_id index[], int ngx, rvec **slDipole,
 
     if (!*nslices)
     {
-        *nslices = (int)(box[axis][axis] * 10); /* default value */
+        *nslices = static_cast<int>(box[axis][axis] * 10); /* default value */
 
 
     }
@@ -172,9 +172,9 @@ void calc_h2order(const char *fn, atom_id index[], int ngx, rvec **slDipole,
              */
 
             if (bMicel)
-            {                                          /* this is for spherical interfaces */
-                rvec_sub(com, x0[index[3*i]], normal); /* vector from Oxygen to COM */
-                slice = norm(normal)/(*slWidth);       /* spherical slice           */
+            {                                                      /* this is for spherical interfaces */
+                rvec_sub(com, x0[index[3*i]], normal);             /* vector from Oxygen to COM */
+                slice = static_cast<int>(norm(normal)/(*slWidth)); /* spherical slice           */
 
                 sum[slice]   += iprod(dipole, normal) / (norm(dipole) * norm(normal));
                 frame[slice] += iprod(dipole, normal) / (norm(dipole) * norm(normal));
@@ -186,7 +186,7 @@ void calc_h2order(const char *fn, atom_id index[], int ngx, rvec **slDipole,
                 /* this is for flat interfaces      */
 
                 /* determine which slice atom is in */
-                slice = (x0[index[3*i]][axis] / (*slWidth));
+                slice = static_cast<int>(x0[index[3*i]][axis] / (*slWidth));
                 if (slice < 0 || slice >= *nslices)
                 {
                     fprintf(stderr, "Coordinate: %f ", x0[index[3*i]][axis]);