Convert repl_ex.c to C++
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 28 May 2014 21:57:45 +0000 (23:57 +0200)
committerTeemu Murtola <teemu.murtola@gmail.com>
Tue, 3 Jun 2014 04:30:20 +0000 (06:30 +0200)
Moved matching header to start, eliminated unused variables, fixed
int64 format string, eliminated an unnecessary header.

Change-Id: I6985a41279c0be6e3c0c468a921dfe50a87bed4f

src/programs/mdrun/repl_ex.cpp [moved from src/programs/mdrun/repl_ex.c with 99% similarity]

similarity index 99%
rename from src/programs/mdrun/repl_ex.c
rename to src/programs/mdrun/repl_ex.cpp
index 0777244ba08d060807f3258d45b51725d2ab66c8..47a3d94e262f6ac0390d4af0369963edf2149672 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+
+#include "repl_ex.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #include <math.h>
-#include "repl_ex.h"
+
 #include "network.h"
 #include "gromacs/random/random.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/math/units.h"
 #include "copyrite.h"
-#include "macros.h"
 #include "gromacs/math/vec.h"
 #include "names.h"
 #include "domdec.h"
@@ -107,7 +109,7 @@ static gmx_bool repl_quantity(const gmx_multisim_t *ms,
 {
     real    *qall;
     gmx_bool bDiff;
-    int      i, s;
+    int      s;
 
     snew(qall, ms->nsim);
     qall[re->repl] = q;
@@ -143,7 +145,7 @@ gmx_repl_ex_t init_replica_exchange(FILE *fplog,
                                     const t_inputrec *ir,
                                     int nst, int nex, int init_seed)
 {
-    real                temp, pres;
+    real                pres;
     int                 i, j, k;
     struct gmx_repl_ex *re;
     gmx_bool            bTemp;
@@ -888,7 +890,7 @@ test_for_replica_exchange(FILE                 *fplog,
                           real                  time)
 {
     int       m, i, j, a, b, ap, bp, i0, i1, tmp;
-    real      ediff = 0, delta = 0, dpV = 0;
+    real      delta = 0;
     gmx_bool  bPrint, bMultiEx;
     gmx_bool *bEx      = re->bEx;
     real     *prob     = re->prob;
@@ -896,10 +898,9 @@ test_for_replica_exchange(FILE                 *fplog,
     gmx_bool  bEpot    = FALSE;
     gmx_bool  bDLambda = FALSE;
     gmx_bool  bVol     = FALSE;
-    gmx_rng_t rng;
 
     bMultiEx = (re->nex > 1);  /* multiple exchanges at each state */
-    fprintf(fplog, "Replica exchange at step " "%"GMX_PRId64 " time %g\n", step, time);
+    fprintf(fplog, "Replica exchange at step " "%" GMX_PRId64 " time %g\n", step, time);
 
     if (re->bNPT)
     {
@@ -1301,7 +1302,7 @@ gmx_bool replica_exchange(FILE *fplog, const t_commrec *cr, struct gmx_repl_ex *
                           t_state *state, gmx_enerdata_t *enerd,
                           t_state *state_local, gmx_int64_t step, real time)
 {
-    int i, j;
+    int j;
     int replica_id = 0;
     int exchange_partner;
     int maxswap = 0;