Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_anadock.c
index 90ea0df0138cc4fb08c82f4af06845b5b4a60b78..b0e506085cb71da42227998db5cbadbabd0eb13f 100644 (file)
@@ -1,53 +1,56 @@
 /*
+ * 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) 2012,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 "confio.h"
-#include "copyrite.h"
-#include "futil.h"
-#include "gmx_fatal.h"
-#include "smalloc.h"
-#include "string2.h"
-#include "vec.h"
-#include "gmx_statistics.h"
-#include "statutil.h"
-#include "typedefs.h"
-#include "xvgr.h"
-#include "macros.h"
+#include "gmxpre.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "gromacs/fileio/confio.h"
+#include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/statistics/statistics.h"
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/legacyheaders/macros.h"
 
 static const char *etitles[] = { "E-docked", "Free Energy" };
 
@@ -73,7 +76,7 @@ static t_pdbfile *read_pdbf(const char *fn)
     init_t_atoms(&(pdbf->atoms), natoms, FALSE);
     snew(pdbf->x, natoms);
     read_stx_conf(fn, buf, &pdbf->atoms, pdbf->x, NULL, &pdbf->ePBC, pdbf->box);
-    fp = ffopen(fn, "r");
+    fp = gmx_ffopen(fn, "r");
     do
     {
         ptr = fgets2(buf, 255, fp);
@@ -94,7 +97,7 @@ static t_pdbfile *read_pdbf(const char *fn)
         }
     }
     while (ptr != NULL);
-    ffclose(fp);
+    gmx_ffclose(fp);
 
     return pdbf;
 }
@@ -193,7 +196,7 @@ static void analyse_em_all(int npdb, t_pdbfile *pdbf[], const char *edocked,
         {
             fprintf(fp, "%12lf\n", bFreeSort ? pdbf[i]->efree : pdbf[i]->edocked);
         }
-        ffclose(fp);
+        gmx_ffclose(fp);
     }
 }
 
@@ -262,7 +265,7 @@ static void line(FILE *fp)
 }
 
 static void cluster_em_all(FILE *fp, int npdb, t_pdbfile *pdbf[],
-                           const char *pdbout, gmx_bool bFree, gmx_bool bRMSD, real cutoff)
+                           gmx_bool bFree, gmx_bool bRMSD, real cutoff)
 {
     int   i, j, k;
     int  *cndx, ncluster;
@@ -340,17 +343,16 @@ static void cluster_em_all(FILE *fp, int npdb, t_pdbfile *pdbf[],
 int gmx_anadock(int argc, char *argv[])
 {
     const char     *desc[] = {
-        "[TT]g_anadock[tt] analyses the results of an Autodock run and clusters the",
+        "[THISMODULE] analyses the results of an Autodock run and clusters the",
         "structures together, based on distance or RMSD. The docked energy",
         "and free energy estimates are analysed, and for each cluster the",
         "energy statistics are printed.[PAR]",
         "An alternative approach to this is to cluster the structures first",
-        "using [TT]g_cluster[tt] and then sort the clusters on either lowest",
+        "using [gmx-cluster] and then sort the clusters on either lowest",
         "energy or average energy."
     };
     t_filenm        fnm[] = {
         { efPDB, "-f", NULL,       ffREAD  },
-        { efPDB, "-ox", "cluster", ffWRITE },
         { efXVG, "-od", "edocked", ffWRITE },
         { efXVG, "-of", "efree",   ffWRITE },
         { efLOG, "-g",  "anadock", ffWRITE }
@@ -373,10 +375,13 @@ int gmx_anadock(int argc, char *argv[])
     t_pdbfile **pdbf = NULL;
     int         npdbf;
 
-    parse_common_args(&argc, argv, 0, NFILE, fnm, NPA, pa, asize(desc), desc, 0,
-                      NULL, &oenv);
+    if (!parse_common_args(&argc, argv, 0, NFILE, fnm, NPA, pa, asize(desc), desc, 0,
+                           NULL, &oenv))
+    {
+        return 0;
+    }
 
-    fp = ffopen(opt2fn("-g", NFILE, fnm), "w");
+    fp = gmx_ffopen(opt2fn("-g", NFILE, fnm), "w");
     please_cite(stdout, "Hetenyi2002b");
     please_cite(fp, "Hetenyi2002b");
 
@@ -385,13 +390,10 @@ int gmx_anadock(int argc, char *argv[])
     analyse_em_all(npdbf, pdbf, opt2fn("-od", NFILE, fnm), opt2fn("-of", NFILE, fnm),
                    oenv);
 
-    cluster_em_all(fp, npdbf, pdbf, opt2fn("-ox", NFILE, fnm),
-                   bFree, bRMS, cutoff);
-
-    thanx(fp);
-    ffclose(fp);
+    cluster_em_all(fp, npdbf, pdbf, bFree, bRMS, cutoff);
 
-    thanx(stdout);
+    gmx_thanx(fp);
+    gmx_ffclose(fp);
 
     return 0;
 }