-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
+/*
+ * This file is part of the GROMACS molecular simulation package.
*
- * 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 <string.h>
+#include "gmxpre.h"
+
#include <math.h>
+#include <string.h>
#include <algorithm>
-#include "macros.h"
-#include "statutil.h"
-#include "sysstuff.h"
-#include "smalloc.h"
-#include "vec.h"
-#include "pbc.h"
-#include "bondf.h"
-#include "futil.h"
-#include "xvgr.h"
-#include "txtdump.h"
-#include "gmx_statistics.h"
-#include "gstat.h"
-#include "index.h"
-#include "random.h"
-#include "names.h"
-#include "physics.h"
-#include "calcmu.h"
-#include "enxio.h"
-#include "nrjac.h"
-#include "matio.h"
-#include "gmx_ana.h"
-#include "copyrite.h"
-
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/enxio.h"
+#include "gromacs/fileio/matio.h"
+#include "gromacs/fileio/trxio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/gmxana/gmx_ana.h"
+#include "gromacs/gmxana/gstat.h"
+#include "gromacs/legacyheaders/calcmu.h"
+#include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/viewit.h"
+#include "gromacs/linearalgebra/nrjac.h"
+#include "gromacs/listed-forces/bonded.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/pbcutil/rmpbc.h"
+#include "gromacs/random/random.h"
+#include "gromacs/statistics/statistics.h"
+#include "gromacs/topology/index.h"
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/programinfo.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
#define e2d(x) ENM2DEBYE*(x)
#define EANG2CM E_CHARGE*1.0e-10 /* e Angstrom to Coulomb meter */
snew(gb, 1);
- if ((ptr = getenv("GKRWIDTH")) != NULL)
+ if ((ptr = getenv("GMX_DIPOLE_SPACING")) != NULL)
{
double bw = strtod(ptr, NULL);
gb->spacing = bw;
}
/*2.0*j/(gb->ny-1.0)-1.0;*/
}
- out = ffopen(cmap, "w");
+ out = gmx_ffopen(cmap, "w");
write_xpm(out, 0,
"Dipole Orientation Distribution", "Fraction", "r (nm)",
gb->bPhi ? "Phi" : "Alpha",
gb->nx, gb->ny, xaxis, yaxis,
gb->cmap, 0, hi, rlo, rhi, nlevels);
- ffclose(out);
+ gmx_ffclose(out);
sfree(xaxis);
sfree(yaxis);
}
/* Swap x0 and x1 */
x0 = x1;
}
- ffclose(fp);
+ gmx_ffclose(fp);
}
gmx_bool read_mu_from_enx(ener_file_t fmu, int Vol, ivec iMu, rvec mu, real *vol,
slab_dipole[i][ZZ]/nframes,
mutot);
}
- ffclose(fp);
+ gmx_ffclose(fp);
do_view(oenv, fn, "-autoscale xy -nxy");
}
snew(dipsp, gnx_tot);
/* we need a dummy file for gnuplot */
- dip3d = (FILE *)ffopen("dummy.dat", "w");
+ dip3d = (FILE *)gmx_ffopen("dummy.dat", "w");
fprintf(dip3d, "%f %f %f", 0.0, 0.0, 0.0);
- ffclose(dip3d);
+ gmx_ffclose(dip3d);
- dip3d = (FILE *)ffopen(fndip3d, "w");
+ dip3d = (FILE *)gmx_ffopen(fndip3d, "w");
try
{
gmx::BinaryInformationSettings settings;
settings.generatedByHeader(true);
settings.linePrefix("# ");
- gmx::printBinaryInformation(dip3d, gmx::ProgramInfo::getInstance(),
+ gmx::printBinaryInformation(dip3d, output_env_get_program_context(oenv),
settings);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
close_trj(status);
}
- ffclose(outmtot);
- ffclose(outaver);
- ffclose(outeps);
+ gmx_ffclose(outmtot);
+ gmx_ffclose(outaver);
+ gmx_ffclose(outeps);
if (fnadip)
{
- ffclose(adip);
+ gmx_ffclose(adip);
}
if (cosaver)
{
- ffclose(caver);
+ gmx_ffclose(caver);
}
if (dip3d)
fprintf(dip3d, "set zrange [0.0:%4.2f]\n\n", box[ZZ][ZZ]);
fprintf(dip3d, "splot 'dummy.dat' using 1:2:3 w vec\n");
fprintf(dip3d, "pause -1 'Hit return to continue'\n");
- ffclose(dip3d);
+ gmx_ffclose(dip3d);
}
if (bSlab)
fprintf(outdd, "%10g %10f\n",
(i*mu_max)/ndipbin, dipole_bin[i]/(double)teller);
}
- ffclose(outdd);
+ gmx_ffclose(outdd);
sfree(dipole_bin);
}
if (bGkr)
int gmx_dipoles(int argc, char *argv[])
{
const char *desc[] = {
- "[TT]g_dipoles[tt] computes the total dipole plus fluctuations of a simulation",
+ "[THISMODULE] computes the total dipole plus fluctuations of a simulation",
"system. From this you can compute e.g. the dielectric constant for",
"low-dielectric media.",
"For molecules with a net charge, the net charge is subtracted at",
"the dipoles divided by the distance to the third power.[PAR]",
"[PAR]",
"EXAMPLES[PAR]",
- "[TT]g_dipoles -corr mol -P 1 -o dip_sqr -mu 2.273 -mumax 5.0[tt][PAR]",
+ "[TT]gmx dipoles -corr mol -P 1 -o dip_sqr -mu 2.273 -mumax 5.0[tt][PAR]",
"This will calculate the autocorrelation function of the molecular",
"dipoles using a first order Legendre polynomial of the angle of the",
"dipole vector and itself a time t later. For this calculation 1001",
};
real mu_max = 5, mu_aver = -1, rcmax = 0;
real epsilonRF = 0.0, temp = 300;
- gmx_bool bPairs = TRUE, bPhi = FALSE, bQuad = FALSE;
+ gmx_bool bPairs = TRUE, bPhi = FALSE, bQuad = FALSE;
const char *corrtype[] = {NULL, "none", "mol", "molsep", "total", NULL};
const char *axtitle = "Z";
int nslices = 10; /* nr of slices defined */
t_filenm fnm[] = {
{ efEDR, "-en", NULL, ffOPTRD },
{ efTRX, "-f", NULL, ffREAD },
- { efTPX, NULL, NULL, ffREAD },
+ { efTPR, NULL, NULL, ffREAD },
{ efNDX, NULL, NULL, ffOPTRD },
{ efXVG, "-o", "Mtot", ffWRITE },
{ efXVG, "-eps", "epsilon", ffWRITE },
npargs = asize(pa);
ppa = add_acf_pargs(&npargs, pa);
- parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW | PCA_BE_NICE,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv);
+ if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ {
+ return 0;
+ }
printf("Using %g as mu_max and %g as the dipole moment.\n",
mu_max, mu_aver);
}
snew(top, 1);
- ePBC = read_tpx_top(ftp2fn(efTPX, NFILE, fnm), NULL, box,
+ ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), NULL, box,
&natoms, NULL, NULL, NULL, top);
snew(gnx, ncos);