-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+/*
+ * This file is part of the GROMACS molecular simulation package.
*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * For more info, check our website at http://www.gromacs.org
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
*
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
+ * 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 "statutil.h"
-#include "sysstuff.h"
-#include "typedefs.h"
-#include "smalloc.h"
-#include "macros.h"
-#include "gmx_fatal.h"
-#include "vec.h"
-#include "copyrite.h"
-#include "futil.h"
-#include "readinp.h"
-#include "statutil.h"
-#include "txtdump.h"
+
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/utility/smalloc.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/legacyheaders/readinp.h"
+#include "gromacs/legacyheaders/txtdump.h"
#include "gstat.h"
-#include "gmx_statistics.h"
-#include "xvgr.h"
+#include "gromacs/statistics/statistics.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/legacyheaders/viewit.h"
#include "gmx_ana.h"
#include "geminate.h"
}
fprintf(stdout, "\n");
- ffclose(fp);
+ gmx_ffclose(fp);
}
static void regression_analysis(int n, gmx_bool bXYdy,
int i, s;
double min, max;
int nbin;
-#if (defined SIZEOF_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT >= 8)
- long long int *histo;
-#else
- double *histo;
-#endif
+ gmx_int64_t *histo;
min = val[0][0];
max = val[0][0];
}
if (s < nset-1)
{
- fprintf(fp, "&\n");
+ fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
}
}
- ffclose(fp);
+ gmx_ffclose(fp);
}
static int real_comp(const void *a, const void *b)
double av, var, err;
real *tmp = NULL;
- fp = ffopen(avfile, "w");
+ fp = gmx_ffopen(avfile, "w");
if ((avbar_opt == avbarERROR) && (nset == 1))
{
avbar_opt = avbarNONE;
}
fprintf(fp, "\n");
}
- ffclose(fp);
+ gmx_ffclose(fp);
if (avbar_opt == avbar90)
{
}
fprintf(stdout, "Set %3d: err.est. %g a %g tau1 %g tau2 %g\n",
s+1, ee, a, tau1, tau2);
- fprintf(fp, "@ legend string %d \"av %f\"\n", 2*s, av[s]);
- fprintf(fp, "@ legend string %d \"ee %6g\"\n",
- 2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt));
+ if (output_env_get_xvg_format(oenv) == exvgXMGR)
+ {
+ fprintf(fp, "@ legend string %d \"av %f\"\n", 2*s, av[s]);
+ fprintf(fp, "@ legend string %d \"ee %6g\"\n", 2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt));
+ }
+ else if (output_env_get_xvg_format(oenv) == exvgXMGRACE)
+ {
+ fprintf(fp, "@ s%d legend \"av %f\"\n", 2*s, av[s]);
+ fprintf(fp, "@ s%d legend \"ee %6g\"\n", 2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt));
+ }
for (i = 0; i < nbs; i++)
{
fprintf(fp, "%g %g %g\n", tbs[i], sig[s]*sqrt(ybs[i]/(n*dt)),
s+1, sig[s]*anal_ee_inf(ac_fit, n*dt),
ac_fit[1], ac_fit[0], ac_fit[2]);
- fprintf(fp, "&\n");
+ fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
for (i = 0; i < nbs; i++)
{
fprintf(fp, "%g %g\n", tbs[i],
}
if (s < nset-1)
{
- fprintf(fp, "&\n");
+ fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
}
}
sfree(fitsig);
sfree(ybs);
sfree(tbs);
- ffclose(fp);
+ gmx_ffclose(fp);
}
static void luzar_correl(int nn, real *time, int nset, real **val, real temp,
int gmx_analyze(int argc, char *argv[])
{
static const char *desc[] = {
- "[TT]g_analyze[tt] reads an ASCII file and analyzes data sets.",
+ "[THISMODULE] reads an ASCII file and analyzes data sets.",
"A line in the input file may start with a time",
"(see option [TT]-time[tt]) and any number of [IT]y[it]-values may follow.",
"Multiple sets can also be",
"All options, except for [TT]-av[tt] and [TT]-power[tt], assume that the",
"points are equidistant in time.[PAR]",
- "[TT]g_analyze[tt] always shows the average and standard deviation of each",
+ "[THISMODULE] always shows the average and standard deviation of each",
"set, as well as the relative deviation of the third",
"and fourth cumulant from those of a Gaussian distribution with the same",
"standard deviation.[PAR]",
"zero or with a negative value are ignored.[PAR]"
"Option [TT]-luzar[tt] performs a Luzar & Chandler kinetics analysis",
- "on output from [TT]g_hbond[tt]. The input file can be taken directly",
- "from [TT]g_hbond -ac[tt], and then the same result should be produced."
+ "on output from [gmx-hbond]. The input file can be taken directly",
+ "from [TT]gmx hbond -ac[tt], and then the same result should be produced."
};
static real tb = -1, te = -1, frac = 0.5, filtlen = 0, binwidth = 0.1, aver_start = 0;
static gmx_bool bHaveT = TRUE, bDer = FALSE, bSubAv = TRUE, bAverCorr = FALSE, bXYdy = FALSE;
{ "-regression", FALSE, etBOOL, {&bRegression},
"Perform a linear regression analysis on the data. If [TT]-xydy[tt] is set a second set will be interpreted as the error bar in the Y value. Otherwise, if multiple data sets are present a multilinear regression will be performed yielding the constant A that minimize [MATH][GRK]chi[grk]^2 = (y - A[SUB]0[sub] x[SUB]0[sub] - A[SUB]1[sub] x[SUB]1[sub] - ... - A[SUB]N[sub] x[SUB]N[sub])^2[math] where now Y is the first data set in the input file and x[SUB]i[sub] the others. Do read the information at the option [TT]-time[tt]." },
{ "-luzar", FALSE, etBOOL, {&bLuzar},
- "Do a Luzar and Chandler analysis on a correlation function and related as produced by [TT]g_hbond[tt]. When in addition the [TT]-xydy[tt] flag is given the second and fourth column will be interpreted as errors in c(t) and n(t)." },
+ "Do a Luzar and Chandler analysis on a correlation function and "
+ "related as produced by [gmx-hbond]. When in addition the "
+ "[TT]-xydy[tt] flag is given the second and fourth column will be "
+ "interpreted as errors in c(t) and n(t)." },
{ "-temp", FALSE, etREAL, {&temp},
"Temperature for the Luzar hydrogen bonding kinetics analysis (K)" },
{ "-fitstart", FALSE, etREAL, {&fit_start},
npargs = asize(pa);
ppa = add_acf_pargs(&npargs, pa);
- parse_common_args(&argc, argv, PCA_CAN_VIEW,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv);
+ if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ {
+ return 0;
+ }
acfile = opt2fn_null("-ac", NFILE, fnm);
msdfile = opt2fn_null("-msd", NFILE, fnm);
if (fitfile != NULL)
{
- out_fit = ffopen(fitfile, "w");
+ out_fit = gmx_ffopen(fitfile, "w");
if (bXYdy && nset >= 2)
{
do_fit(out_fit, 0, TRUE, n, t, val, npargs, ppa, oenv);
do_fit(out_fit, s, FALSE, n, t, val, npargs, ppa, oenv);
}
}
- ffclose(out_fit);
+ gmx_ffclose(out_fit);
}
printf(" std. dev. relative deviation of\n");
}
if (s < nset-1)
{
- fprintf(out, "&\n");
+ fprintf(out, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
}
}
- ffclose(out);
+ gmx_ffclose(out);
fprintf(stderr, "\r%d, time=%g\n", j-1, (j-1)*dt);
}
if (ccfile)