*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015 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.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+#include <math.h>
+#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <math.h>
-#include "sysstuff.h"
-#include "network.h"
-#include "gromacs/utility/smalloc.h"
-#include "nrnb.h"
-#include "main.h"
-#include "chargegroup.h"
-#include "force.h"
-#include "macros.h"
-#include "names.h"
-#include "gmx_fatal.h"
-#include "txtdump.h"
-#include "typedefs.h"
-#include "update.h"
-#include "constr.h"
-#include "vec.h"
-#include "tgroup.h"
-#include "mdebin.h"
-#include "vsite.h"
-#include "force.h"
-#include "mdrun.h"
-#include "domdec.h"
-#include "gromacs/random/random.h"
-#include "physics.h"
-#include "xvgr.h"
-#include "mdatoms.h"
-#include "ns.h"
-#include "mtop_util.h"
-#include "pme.h"
-#include "gromacs/gmxlib/conformation-utilities.h"
-#include "gromacs/simd/simd.h"
+#include <algorithm>
+
+#include "gromacs/domdec/domdec.h"
+#include "gromacs/ewald/pme.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/trxio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/gmxlib/conformation-utilities.h"
+#include "gromacs/legacyheaders/chargegroup.h"
+#include "gromacs/legacyheaders/constr.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/mdebin.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/ns.h"
+#include "gromacs/legacyheaders/tgroup.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/update.h"
+#include "gromacs/legacyheaders/vsite.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/random/random.h"
+#include "gromacs/simd/simd.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
static void global_max(t_commrec *cr, int *n)
{
gmx_sumi(cr->nnodes, sum, cr);
for (i = 0; i < cr->nnodes; i++)
{
- *n = max(*n, sum[i]);
+ *n = std::max(*n, sum[i]);
}
sfree(sum);
unsigned long gmx_unused Flags,
gmx_walltime_accounting_t walltime_accounting)
{
- const char *TPI = "Test Particle Insertion";
gmx_localtop_t *top;
gmx_groups_t *groups;
gmx_enerdata_t *enerd;
gmx_int64_t rnd_count_stride, rnd_count;
gmx_int64_t seed;
double rnd[4];
- int i, start, end;
+ int i;
FILE *fp_tpi = NULL;
char *ptr, *dump_pdb, **leg, str[STRLEN], str2[STRLEN];
double dbl, dump_ener;
real *mass_cavity = NULL, mass_tot;
int nbin;
double invbinw, *bin, refvolshift, logV, bUlogV;
- real dvdl, prescorr, enercorr, dvdlcorr;
+ real prescorr, enercorr, dvdlcorr;
gmx_bool bEnergyOutOfBounds;
const char *tpid_leg[2] = {"direct", "reweighted"};
* The center of mass of the last atoms is then used for TPIC.
*/
nat_cavity = 0;
- while (sscanf(ptr, "%lf%n", &dbl, &i) > 0)
+ while (sscanf(ptr, "%20lf%n", &dbl, &i) > 0)
{
srenew(mass_cavity, nat_cavity+1);
mass_cavity[nat_cavity] = dbl;
dump_ener = 0;
if (dump_pdb)
{
- sscanf(dump_pdb, "%lf", &dump_ener);
+ sscanf(dump_pdb, "%20lf", &dump_ener);
}
atoms2md(top_global, inputrec, 0, NULL, top_global->natoms, mdatoms);
snew(leg, 4+nener);
e = 0;
sprintf(str, "-kT log(<Ve\\S-\\betaU\\N>/<V>)");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
sprintf(str, "f. -kT log<e\\S-\\betaU\\N>");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
sprintf(str, "f. <e\\S-\\betaU\\N>");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
sprintf(str, "f. V");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
sprintf(str, "f. <Ue\\S-\\betaU\\N>");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
for (i = 0; i < ngid; i++)
{
sprintf(str, "f. <U\\sVdW %s\\Ne\\S-\\betaU\\N>",
*(groups->grpname[groups->grps[egcENER].nm_ind[i]]));
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
}
if (bDispCorr)
{
sprintf(str, "f. <U\\sdisp c\\Ne\\S-\\betaU\\N>");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
}
if (bCharge)
{
{
sprintf(str, "f. <U\\sCoul %s\\Ne\\S-\\betaU\\N>",
*(groups->grpname[groups->grps[egcENER].nm_ind[i]]));
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
}
if (bRFExcl)
{
sprintf(str, "f. <U\\sRF excl\\Ne\\S-\\betaU\\N>");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
}
if (EEL_FULL(fr->eeltype))
{
sprintf(str, "f. <U\\sCoul recip\\Ne\\S-\\betaU\\N>");
- leg[e++] = strdup(str);
+ leg[e++] = gmx_strdup(str);
}
}
xvgr_legend(fp_tpi, 4+nener, (const char**)leg, oenv);
bNS = FALSE;
/* Calculate long range corrections to pressure and energy */
- calc_dispcorr(fplog, inputrec, fr, step, top_global->natoms, state->box,
+ calc_dispcorr(inputrec, fr, top_global->natoms, state->box,
lambda, pres, vir, &prescorr, &enercorr, &dvdlcorr);
/* figure out how to rearrange the next 4 lines MRS 8/4/2009 */
enerd->term[F_DISPCORR] = enercorr;
if (fp_tpi != NULL)
{
- gmx_fio_fclose(fp_tpi);
+ xvgrclose(fp_tpi);
}
if (fplog != NULL)
(int)(bin[i]+0.5),
bin[i]*exp(-bUlogV)*V_all/VembU_all);
}
- gmx_fio_fclose(fp_tpi);
+ xvgrclose(fp_tpi);
}
sfree(bin);