Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / x2top.c
index c5b75e99e42c10c45f5032007719c25765c602da..f0ae9ad8d8bdcaddfa266c2615d3b98fca20c598 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 "gmxpre.h"
+
 #include "x2top.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <assert.h>
 
-#include "copyrite.h"
+#include "gromacs/legacyheaders/copyrite.h"
 #include "gromacs/math/utilities.h"
-#include "macros.h"
-#include "bondf.h"
+#include "gromacs/legacyheaders/macros.h"
 #include "gromacs/fileio/gmxfio.h"
-#include "string2.h"
-#include "smalloc.h"
-#include "sysstuff.h"
 #include "gromacs/fileio/confio.h"
-#include "physics.h"
-#include "gromacs/commandline/pargs.h"
-#include "vec.h"
-#include "gromacs/math/3dview.h"
-#include "txtdump.h"
-#include "readinp.h"
-#include "names.h"
+#include "gromacs/math/units.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/readinp.h"
+#include "gromacs/legacyheaders/names.h"
 #include "toppush.h"
 #include "pdb2top.h"
 #include "gen_ad.h"
 #include "gpp_nextnb.h"
-#include "vec.h"
-#include "atomprop.h"
 #include "hackblock.h"
-
 #include "nm2type.h"
 
+#include "gromacs/bonded/bonded.h"
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/topology/symtab.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+
 char atp[7] = "HCNOSX";
 #define NATP (asize(atp)-1)
 
@@ -265,6 +264,7 @@ void lo_set_force_const(t_params *plist, real c[], int nrfp, gmx_bool bRound,
                 c[0] += 180;
             }
         }
+        assert(nrfp <= MAXFORCEPARAM/2);
         for (j = 0; (j < nrfp); j++)
         {
             plist->param[i].c[j]      = c[j];
@@ -538,7 +538,7 @@ int gmx_x2top(int argc, char *argv[])
     bOPLS = (strcmp(forcefield, "oplsaa") == 0);
 
 
-    mymol.name = strdup(molnm);
+    mymol.name = gmx_strdup(molnm);
     mymol.nr   = 1;
 
     /* Init parameter lists */
@@ -618,7 +618,7 @@ int gmx_x2top(int argc, char *argv[])
                   cgnr, rtp_header_settings.nrexcl);
         print_top_mols(fp, mymol.name, ffdir, NULL, 0, NULL, 1, &mymol);
 
-        ffclose(fp);
+        gmx_ffclose(fp);
     }
     if (bRTP)
     {
@@ -631,10 +631,10 @@ int gmx_x2top(int argc, char *argv[])
         dump_hybridization(debug, atoms, nbonds);
     }
     close_symtab(&symtab);
-    free(mymol.name);
+    sfree(mymol.name);
 
     printf("\nWARNING: topologies generated by %s can not be trusted at face value.\n",
-           ShortProgram());
+           output_env_get_program_display_name(oenv));
     printf("         Please verify atomtypes and charges by comparison to other\n");
     printf("         topologies.\n");