Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_make_edi.c
index 8555ef4fd66c517f0ff976e43d1d7fa5b1349aaa..9665117ac134f7b24f296a073bfeb44ae0358288 100644 (file)
@@ -1,68 +1,64 @@
 /*
+ * This file is part of the GROMACS molecular simulation package.
  *
- *                This source code is part of
+ * 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.
  *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- *
- * The make_edi program was generously contributed by Oliver Lange, based
- * on the code from g_anaeig. You can reach him as olange@gwdg.de.
- *
- * 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
+ * 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:
- * Gromacs Runs One Microsecond At Cannonball Speeds
+ * 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
+/* The make_edi program was generously contributed by Oliver Lange, based
+ * on the code from g_anaeig. You can reach him as olange@gwdg.de. He
+ * probably also holds copyright to the following code.
+ */
+#include "gmxpre.h"
 
+#include <ctype.h>
 #include <math.h>
 #include <stdlib.h>
-#include <ctype.h>
 #include <string.h>
-#include "readinp.h"
-#include "statutil.h"
-#include "sysstuff.h"
-#include "typedefs.h"
-#include "smalloc.h"
-#include "macros.h"
-#include "gmx_fatal.h"
-#include "vec.h"
-#include "pbc.h"
-#include "copyrite.h"
-#include "futil.h"
-#include "statutil.h"
-#include "pdbio.h"
-#include "confio.h"
-#include "tpxio.h"
-#include "matio.h"
-#include "mshift.h"
-#include "xvgr.h"
-#include "do_fit.h"
-#include "rmpbc.h"
-#include "txtdump.h"
-#include "eigio.h"
-#include "index.h"
-#include "string2.h"
+
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/confio.h"
+#include "gromacs/fileio/pdbio.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/gmxana/eigio.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/readinp.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/topology/index.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
 
 typedef struct
 {
@@ -571,9 +567,9 @@ int gmx_make_edi(int argc, char *argv[])
 {
 
     static const char *desc[] = {
-        "[TT]make_edi[tt] generates an essential dynamics (ED) sampling input file to be used with [TT]mdrun[tt]",
-        "based on eigenvectors of a covariance matrix ([TT]g_covar[tt]) or from a",
-        "normal modes analysis ([TT]g_nmeig[tt]).",
+        "[THISMODULE] generates an essential dynamics (ED) sampling input file to be used with [TT]mdrun[tt]",
+        "based on eigenvectors of a covariance matrix ([gmx-covar]) or from a",
+        "normal modes analysis ([gmx-nmeig]).",
         "ED sampling can be used to manipulate the position along collective coordinates",
         "(eigenvectors) of (biological) macromolecules during a simulation. Particularly,",
         "it may be used to enhance the sampling efficiency of MD simulations by stimulating",
@@ -620,7 +616,7 @@ int gmx_make_edi(int argc, char *argv[])
         "(collective coordinates etc.), at least on the 'protein' side, ED sampling",
         "is not very parallel-friendly from an implementation point of view. Because",
         "parallel ED requires some extra communication, expect the performance to be",
-        "lower as in a free MD simulation, especially on a large number of nodes and/or",
+        "lower as in a free MD simulation, especially on a large number of ranks and/or",
         "when the ED group contains a lot of atoms. [PAR]",
         "Please also note that if your ED group contains more than a single protein,",
         "then the [TT].tpr[tt] file must contain the correct PBC representation of the ED group.",
@@ -675,7 +671,7 @@ int gmx_make_edi(int argc, char *argv[])
     static const char* evStepOptions[evStepNr] = {"-linstep", "-accdir", "-not_used", "-radstep"};
     static const char* ConstForceStr;
     static real      * evStepList[evStepNr];
-    static real        radfix   = 0.0;
+    static real        radstep  = 0.0;
     static real        deltaF0  = 150;
     static real        deltaF   = 0;
     static real        tau      = .1;
@@ -711,7 +707,7 @@ int gmx_make_edi(int argc, char *argv[])
           "Stepsizes (nm/step) for fixed increment linear sampling (put in quotes! \"1.0 2.3 5.1 -3.1\")"},
         { "-accdir", FALSE, etSTR, {&evParams[1]},
           "Directions for acceptance linear sampling - only sign counts! (put in quotes! \"-1 +1 -1.1\")"},
-        { "-radstep", FALSE, etREAL, {&radfix},
+        { "-radstep", FALSE, etREAL, {&radstep},
           "Stepsize (nm/step) for fixed increment radius expansion"},
         { "-maxedsteps", FALSE, etINT, {&edi_params.maxedsteps},
           "Maximum number of steps per cycle" },
@@ -782,8 +778,11 @@ int gmx_make_edi(int argc, char *argv[])
     };
 #define NFILE asize(fnm)
     edi_params.outfrq = 100; edi_params.slope = 0.0; edi_params.maxedsteps = 0;
-    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;
+    }
 
     indexfile       = ftp2fn_null(efNDX, NFILE, fnm);
     EdiFile         = ftp2fn(efEDI, NFILE, fnm);
@@ -814,12 +813,12 @@ int gmx_make_edi(int argc, char *argv[])
                     }
                 }
             }
-            else if (ev_class == evRADFIX && opt2parg_bSet(evStepOptions[ev_class], NPA, pa))
+            else if (ev_class == evRADFIX)
             {
                 snew(evStepList[ev_class], nvecs);
                 for (i = 0; i < nvecs; i++)
                 {
-                    evStepList[ev_class][i] = radfix;
+                    evStepList[ev_class][i] = radstep;
                 }
             }
             else if (ev_class == evFLOOD)
@@ -857,7 +856,6 @@ int gmx_make_edi(int argc, char *argv[])
         printf("\n");
     }
 
-    EigvecFile = NULL;
     EigvecFile = opt2fn("-f", NFILE, fnm);
 
     /*read eigenvectors from eigvec.trr*/
@@ -977,8 +975,7 @@ int gmx_make_edi(int argc, char *argv[])
     }
 
     /* Write edi-file */
-    write_the_whole_thing(ffopen(EdiFile, "w"), &edi_params, eigvec1, nvec1, listen, evStepList);
-    thanx(stderr);
+    write_the_whole_thing(gmx_ffopen(EdiFile, "w"), &edi_params, eigvec1, nvec1, listen, evStepList);
 
     return 0;
 }