Remove .tpa, .tpb, .tpx, .trj files. Part of #1500.
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_dipoles.cpp
index 2d1094ff20ce741713b27df7fa38700bb3699f34..68e338fe04be79a85f0791000612763be85e6277 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.
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
 #include <string.h>
 #include <math.h>
 
 #include <algorithm>
 
-#include "macros.h"
-#include "gromacs/commandline/pargs.h"
-#include "sysstuff.h"
-#include "smalloc.h"
-#include "vec.h"
-#include "pbc.h"
-#include "bondf.h"
-#include "gromacs/fileio/futil.h"
-#include "xvgr.h"
-#include "txtdump.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/legacyheaders/viewit.h"
+#include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/statistics/statistics.h"
 #include "gstat.h"
-#include "index.h"
-#include "random.h"
-#include "names.h"
-#include "physics.h"
-#include "calcmu.h"
+#include "gromacs/topology/index.h"
+#include "gromacs/random/random.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/math/units.h"
+#include "gromacs/legacyheaders/calcmu.h"
 #include "gromacs/fileio/enxio.h"
-#include "nrjac.h"
-#include "gromacs/fileio/matio.h"
 #include "gmx_ana.h"
-#include "copyrite.h"
+#include "gromacs/legacyheaders/copyrite.h"
 #include "gromacs/fileio/trxio.h"
 
+#include "gromacs/bonded/bonded.h"
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/fileio/matio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/linearalgebra/nrjac.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/rmpbc.h"
 #include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/programinfo.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 #define e2d(x) ENM2DEBYE*(x)
 #define EANG2CM  E_CHARGE*1.0e-10       /* e Angstrom to Coulomb meter */
@@ -91,7 +91,7 @@ static t_gkrbin *mk_gkrbin(real radius, real rcmax, gmx_bool bPhi, int ndegrees)
 
     snew(gb, 1);
 
-    if ((ptr = getenv("GKRWIDTH")) != NULL)
+    if ((ptr = getenv("GMX_DIPOLE_SPACING")) != NULL)
     {
         double bw = strtod(ptr, NULL);
         gb->spacing = bw;
@@ -320,13 +320,13 @@ static void print_cmap(const char *cmap, t_gkrbin *gb, int *nlevels)
         }
         /*2.0*j/(gb->ny-1.0)-1.0;*/
     }
-    out = ffopen(cmap, "w");
+    out = gmx_ffopen(cmap, "w");
     write_xpm(out, 0,
               "Dipole Orientation Distribution", "Fraction", "r (nm)",
               gb->bPhi ? "Phi" : "Alpha",
               gb->nx, gb->ny, xaxis, yaxis,
               gb->cmap, 0, hi, rlo, rhi, nlevels);
-    ffclose(out);
+    gmx_ffclose(out);
     sfree(xaxis);
     sfree(yaxis);
 }
@@ -405,7 +405,7 @@ static void print_gkrbin(const char *fn, t_gkrbin *gb,
         /* Swap x0 and x1 */
         x0 = x1;
     }
-    ffclose(fp);
+    gmx_ffclose(fp);
 }
 
 gmx_bool read_mu_from_enx(ener_file_t fmu, int Vol, ivec iMu, rvec mu, real *vol,
@@ -687,7 +687,7 @@ static void dump_slab_dipoles(const char *fn, int idim, int nslice,
                 slab_dipole[i][ZZ]/nframes,
                 mutot);
     }
-    ffclose(fp);
+    gmx_ffclose(fp);
     do_view(oenv, fn, "-autoscale xy -nxy");
 }
 
@@ -943,17 +943,17 @@ static void do_dip(t_topology *top, int ePBC, real volume,
         snew(dipsp, gnx_tot);
 
         /* we need a dummy file for gnuplot */
-        dip3d = (FILE *)ffopen("dummy.dat", "w");
+        dip3d = (FILE *)gmx_ffopen("dummy.dat", "w");
         fprintf(dip3d, "%f %f %f", 0.0, 0.0, 0.0);
-        ffclose(dip3d);
+        gmx_ffclose(dip3d);
 
-        dip3d = (FILE *)ffopen(fndip3d, "w");
+        dip3d = (FILE *)gmx_ffopen(fndip3d, "w");
         try
         {
             gmx::BinaryInformationSettings settings;
             settings.generatedByHeader(true);
             settings.linePrefix("# ");
-            gmx::printBinaryInformation(dip3d, gmx::ProgramInfo::getInstance(),
+            gmx::printBinaryInformation(dip3d, output_env_get_program_context(oenv),
                                         settings);
         }
         GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
@@ -1337,18 +1337,18 @@ static void do_dip(t_topology *top, int ePBC, real volume,
         close_trj(status);
     }
 
-    ffclose(outmtot);
-    ffclose(outaver);
-    ffclose(outeps);
+    gmx_ffclose(outmtot);
+    gmx_ffclose(outaver);
+    gmx_ffclose(outeps);
 
     if (fnadip)
     {
-        ffclose(adip);
+        gmx_ffclose(adip);
     }
 
     if (cosaver)
     {
-        ffclose(caver);
+        gmx_ffclose(caver);
     }
 
     if (dip3d)
@@ -1358,7 +1358,7 @@ static void do_dip(t_topology *top, int ePBC, real volume,
         fprintf(dip3d, "set zrange [0.0:%4.2f]\n\n", box[ZZ][ZZ]);
         fprintf(dip3d, "splot 'dummy.dat' using 1:2:3 w vec\n");
         fprintf(dip3d, "pause -1 'Hit return to continue'\n");
-        ffclose(dip3d);
+        gmx_ffclose(dip3d);
     }
 
     if (bSlab)
@@ -1457,7 +1457,7 @@ static void do_dip(t_topology *top, int ePBC, real volume,
             fprintf(outdd, "%10g  %10f\n",
                     (i*mu_max)/ndipbin, dipole_bin[i]/(double)teller);
         }
-        ffclose(outdd);
+        gmx_ffclose(outdd);
         sfree(dipole_bin);
     }
     if (bGkr)
@@ -1590,7 +1590,7 @@ int gmx_dipoles(int argc, char *argv[])
     t_filenm       fnm[] = {
         { efEDR, "-en", NULL,         ffOPTRD },
         { efTRX, "-f", NULL,           ffREAD },
-        { efTPX, NULL, NULL,           ffREAD },
+        { efTPR, NULL, NULL,           ffREAD },
         { efNDX, NULL, NULL,           ffOPTRD },
         { efXVG, "-o",   "Mtot",       ffWRITE },
         { efXVG, "-eps", "epsilon",    ffWRITE },
@@ -1614,7 +1614,7 @@ int gmx_dipoles(int argc, char *argv[])
 
     npargs = asize(pa);
     ppa    = add_acf_pargs(&npargs, pa);
-    if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW | PCA_BE_NICE,
+    if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
                            NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
     {
         return 0;
@@ -1664,7 +1664,7 @@ int gmx_dipoles(int argc, char *argv[])
     }
 
     snew(top, 1);
-    ePBC = read_tpx_top(ftp2fn(efTPX, NFILE, fnm), NULL, box,
+    ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), NULL, box,
                         &natoms, NULL, NULL, NULL, top);
 
     snew(gnx, ncos);