Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / solvate.cpp
index 41cc0db1d40d5cb370de1d8ff956f1534cbb80c3..421a49a2073b04eade2e6fcd29c9cec934580688 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-#include "solvate.h"
+#include "gmxpre.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "solvate.h"
 
+#include <string.h>
 
-#include "sysstuff.h"
-#include "typedefs.h"
-#include "smalloc.h"
-#include "string2.h"
+#include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/fileio/confio.h"
-#include "macros.h"
-#include "gromacs/fileio/futil.h"
-#include "atomprop.h"
-#include "names.h"
-#include "vec.h"
-#include "gmx_fatal.h"
-#include "gromacs/commandline/pargs.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/legacyheaders/names.h"
 #include "gromacs/gmxlib/conformation-utilities.h"
 #include "addconf.h"
 #include "read-conformation.h"
 #include "gromacs/fileio/pdbio.h"
-#include "pbc.h"
+
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/topology/atomprop.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 #ifdef DEBUG
 static void print_stat(rvec *x, int natoms, matrix box)
@@ -116,8 +114,10 @@ static void sort_molecule(t_atoms **atoms_solvt, rvec *x, rvec *v, real *r)
             moltp = NOTSET;
             for (j = 0; (j < nrmoltypes) && (moltp == NOTSET); j++)
             {
-                if (strcmp(*(atoms->resinfo[atoms->atom[i].resind].name),
-                           moltypes[j].name) == 0)
+                /* cppcheck-suppress nullPointer
+                 * moltypes is guaranteed to be allocated because otherwise
+                 * nrmoltypes is 0. */
+                if (strcmp(*(atoms->resinfo[atoms->atom[i].resind].name), moltypes[j].name) == 0)
                 {
                     moltp = j;
                 }
@@ -525,8 +525,8 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
     if (ftp2bSet(efTOP, NFILE, fnm) )
     {
         fprintf(stderr, "Processing topology\n");
-        fpin    = ffopen(topinout, "r");
-        fpout   = ffopen(TEMP_FILENM, "w");
+        fpin    = gmx_ffopen(topinout, "r");
+        fpout   = gmx_ffopen(TEMP_FILENM, "w");
         line    = 0;
         bSystem = bMolecules = FALSE;
         while (fgets(buf, STRLEN, fpin))
@@ -595,17 +595,17 @@ static void update_top(t_atoms *atoms, matrix box, int NFILE, t_filenm fnm[],
                 fprintf(fpout, "%s", buf);
             }
         }
-        ffclose(fpin);
+        gmx_ffclose(fpin);
         if (nsol)
         {
             fprintf(stdout, "Adding line for %d solvent molecules to "
                     "topology file (%s)\n", nsol, topinout);
             fprintf(fpout, "%-15s %5d\n", "SOL", nsol);
         }
-        ffclose(fpout);
-        /* use ffopen to generate backup of topinout */
-        fpout = ffopen(topinout, "w");
-        ffclose(fpout);
+        gmx_ffclose(fpout);
+        /* use gmx_ffopen to generate backup of topinout */
+        fpout = gmx_ffopen(topinout, "w");
+        gmx_ffclose(fpout);
         rename(TEMP_FILENM, topinout);
     }
 #undef TEMP_FILENM
@@ -720,7 +720,7 @@ int gmx_solvate(int argc, char *argv[])
           "Keep velocities from input solute and solvent" },
     };
 
-    if (!parse_common_args(&argc, argv, PCA_BE_NICE, NFILE, fnm, asize(pa), pa,
+    if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
                            asize(desc), desc, asize(bugs), bugs, &oenv))
     {
         return 0;