Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_rdf.c
index bebb3f4769bc9acafb829958be55a113ee1f4b87..db06a912796122df176f76a9a0a3f4834034b603 100644 (file)
@@ -1,65 +1,64 @@
 /*
+ * 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 <ctype.h>
-#include "string2.h"
-#include "sysstuff.h"
-#include "typedefs.h"
-#include "macros.h"
-#include "vec.h"
-#include "pbc.h"
-#include "xvgr.h"
-#include "copyrite.h"
-#include "futil.h"
-#include "statutil.h"
-#include "tpxio.h"
-#include "physics.h"
-#include "index.h"
-#include "smalloc.h"
-#include "calcgrid.h"
-#include "nrnb.h"
-#include "coulomb.h"
+
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/legacyheaders/viewit.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trxio.h"
+#include "gromacs/topology/index.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/coulomb.h"
 #include "gstat.h"
-#include "matio.h"
 #include "gmx_ana.h"
-#include "names.h"
+#include "gromacs/legacyheaders/names.h"
+
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/pbcutil/rmpbc.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 static void check_box_c(matrix box)
 {
@@ -189,11 +188,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
     char         **grpname;
     int           *isize, isize_cm = 0, nrdf = 0, max_i, isize0, isize_g;
     atom_id      **index, *index_cm = NULL;
-#if (defined SIZEOF_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT >= 8)
-    long long int *sum;
-#else
-    double        *sum;
-#endif
+    gmx_int64_t   *sum;
     real           t, rmax2, cut2, r, r2, r2ii, invhbinw, normfac;
     real           segvol, spherevol, prev_spherevol, **rdf;
     rvec          *x, dx, *x0 = NULL, *x_i1, xi;
@@ -431,7 +426,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
     invvol_sum = 0;
     if (bPBC && (NULL != top))
     {
-        gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms, box);
+        gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
     }
 
     do
@@ -614,7 +609,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
         }
         nframes++;
     }
-    while (read_next_x(oenv, status, &t, natoms, x, box));
+    while (read_next_x(oenv, status, &t, x, box));
     fprintf(stderr, "\n");
 
     if (bPBC && (NULL != top))
@@ -744,7 +739,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
         }
         fprintf(fp, "\n");
     }
-    ffclose(fp);
+    gmx_ffclose(fp);
 
     do_view(oenv, fnRDF, NULL);
 
@@ -775,7 +770,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
         {
             fprintf(fp, "%10g %10g\n", i*0.5, hq[i]);
         }
-        ffclose(fp);
+        gmx_ffclose(fp);
         do_view(oenv, fnHQ, NULL);
         sfree(hq);
         sfree(integrand);
@@ -814,7 +809,7 @@ static void do_rdf(const char *fnNDX, const char *fnTPS, const char *fnTRX,
             }
             fprintf(fp, "\n");
         }
-        ffclose(fp);
+        gmx_ffclose(fp);
         sfree(sum);
 
         do_view(oenv, fnCNRDF, NULL);
@@ -835,7 +830,7 @@ int gmx_rdf(int argc, char *argv[])
         "scattering. The most common way to describe liquid structure is by a",
         "radial distribution function. However, this is not easy to obtain from",
         "a scattering experiment.[PAR]",
-        "[TT]g_rdf[tt] calculates radial distribution functions in different ways.",
+        "[THISMODULE] calculates radial distribution functions in different ways.",
         "The normal method is around a (set of) particle(s), the other methods",
         "are around the center of mass of a set of particles ([TT]-com[tt])",
         "or to the closest particle in a set ([TT]-surf[tt]).",
@@ -907,8 +902,11 @@ int gmx_rdf(int argc, char *argv[])
         { efXVG, "-hq", "hq",     ffOPTWR },
     };
 #define NFILE asize(fnm)
-    parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
-                      NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv);
+    if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
+                           NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+    {
+        return 0;
+    }
 
     if (bCM || closet[0][0] != 'n' || rdft[0][0] == 'm' || rdft[0][6] == 'm')
     {
@@ -945,7 +943,5 @@ int gmx_rdf(int argc, char *argv[])
            bCM, closet[0], rdft, bXY, bPBC, bNormalize, cutoff, binwidth, fade, ngroups,
            oenv);
 
-    thanx(stderr);
-
     return 0;
 }