Merge release-5-0 into master
[alexxy/gromacs.git] / src / programs / mdrun / md.cpp
similarity index 99%
rename from src/programs/mdrun/md.c
rename to src/programs/mdrun/md.cpp
index b7dab3cf200677fa778e29ec6b4e3906ce302b8e..c8b4db19d5d8f3208ff92c3acd520d3f11e4effb 100644 (file)
 #include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #include "typedefs.h"
-#include "gromacs/utility/smalloc.h"
-#include "sysstuff.h"
-#include "vec.h"
+#include "gromacs/math/vec.h"
 #include "vcm.h"
 #include "mdebin.h"
 #include "nrnb.h"
 #include "calcmu.h"
-#include "index.h"
 #include "vsite.h"
 #include "update.h"
 #include "ns.h"
@@ -54,8 +53,6 @@
 #include "md_support.h"
 #include "md_logging.h"
 #include "network.h"
-#include "xvgr.h"
-#include "physics.h"
 #include "names.h"
 #include "force.h"
 #include "disre.h"
 #include "qmmm.h"
 #include "domdec.h"
 #include "domdec_network.h"
-#include "gromacs/gmxlib/topsort.h"
 #include "coulomb.h"
 #include "constr.h"
 #include "shellfc.h"
 #include "gromacs/gmxpreprocess/compute_io.h"
 #include "checkpoint.h"
-#include "mtop_util.h"
+#include "gromacs/topology/mtop_util.h"
 #include "sighandler.h"
 #include "txtdump.h"
 #include "gromacs/utility/cstringutil.h"
 #include "types/iteratedconstraints.h"
 #include "nbnxn_cuda_data_mgmt.h"
 
-#include "gromacs/utility/gmxmpi.h"
 #include "gromacs/fileio/confio.h"
+#include "gromacs/fileio/mdoutf.h"
 #include "gromacs/fileio/trajectory_writing.h"
 #include "gromacs/fileio/trnio.h"
 #include "gromacs/fileio/trxio.h"
 #include "gromacs/fileio/xtcio.h"
-#include "gromacs/timing/wallcycle.h"
-#include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/imd/imd.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
 #include "gromacs/pulling/pull.h"
 #include "gromacs/swap/swapcoords.h"
-#include "gromacs/imd/imd.h"
+#include "gromacs/timing/wallcycle.h"
+#include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/smalloc.h"
 
 #ifdef GMX_FAHCORE
 #include "corewrap.h"
@@ -170,7 +170,7 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     rvec              mu_tot;
     t_vcm            *vcm;
     t_state          *bufstate = NULL;
-    matrix           *scale_tot, pcoupl_mu, M, ebox;
+    matrix            pcoupl_mu, M;
     gmx_nlheur_t      nlh;
     t_trxframe        rerun_fr;
     gmx_repl_ex_t     repl_ex = NULL;
@@ -189,10 +189,8 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     gmx_ekindata_t   *ekind, *ekind_save;
     gmx_shellfc_t     shellfc;
     int               count, nconverged = 0;
-    real              timestep   = 0;
-    double            tcount     = 0;
-    gmx_bool          bConverged = TRUE, bOK, bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
-    gmx_bool          bAppend;
+    double            tcount                 = 0;
+    gmx_bool          bConverged             = TRUE, bOK, bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
     gmx_bool          bResetCountersHalfMaxH = FALSE;
     gmx_bool          bVV, bIterativeCase, bFirstIterate, bTemp, bPres, bTrotter;
     gmx_bool          bUpdateDoLR;
@@ -207,7 +205,6 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     double            cycles;
     real              saved_conserved_quantity = 0;
     real              last_ekin                = 0;
-    int               iter_i;
     t_extmass         MassQ;
     int             **trotter_seq;
     char              sbuf[STEPSTRSIZE], sbuf2[STEPSTRSIZE];
@@ -231,7 +228,6 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
 
     /* Check for special mdrun options */
     bRerunMD = (Flags & MD_RERUN);
-    bAppend  = (Flags & MD_APPENDFILES);
     if (Flags & MD_RESETCOUNTERSHALFWAY)
     {
         if (ir->nsteps > 0)
@@ -719,9 +715,7 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     bStateFromTPX    = !bStateFromCP;
     bInitStep        = bFirstStep && (bStateFromTPX || bVV);
     bStartingFromCpt = (Flags & MD_STARTFROMCPT) && bInitStep;
-    bLastStep        = FALSE;
     bSumEkinhOld     = FALSE;
-    bDoReplEx        = FALSE;
     bExchanged       = FALSE;
     bNeedRepartition = FALSE;
 
@@ -730,10 +724,7 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     step     = ir->init_step;
     step_rel = 0;
 
-    if (ir->nstlist == -1)
-    {
-        init_nlistheuristics(&nlh, bGStatEveryStep, step);
-    }
+    init_nlistheuristics(&nlh, bGStatEveryStep, step);
 
     if (MULTISIM(cr) && (repl_ex_nst <= 0 ))
     {