Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxana / anadih.c
index 8ae35c8ee16757aee2801d25434ebcedecbec3c6..c967c601c85b036aab9128d755a2531fc43dd813 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 <math.h>
 #include <stdio.h>
 #include <string.h>
-#include "physics.h"
-#include "smalloc.h"
-#include "macros.h"
-#include "txtdump.h"
-#include "bondf.h"
-#include "xvgr.h"
-#include "typedefs.h"
-#include "vec.h"
-#include "gstat.h"
+
+#include "gromacs/bonded/bonded.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trxio.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/gmxana/gstat.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 void print_one(const output_env_t oenv, const char *base, const char *name,
                const char *title, const char *ylabel, int nf, real time[],
@@ -417,7 +418,8 @@ void mk_chi_lookup (int **lookup, int maxchi,
     int i, j, Dih, Chi;
 
     j = 0;
-    for (Dih = 0; (Dih < NONCHI+maxchi); Dih++)
+    /* NONCHI points to chi1, therefore we have to start counting there. */
+    for (Dih = NONCHI; (Dih < NONCHI+maxchi); Dih++)
     {
         for (i = 0; (i < nlist); i++)
         {
@@ -568,9 +570,12 @@ void get_chi_product_traj (real **dih, int nframes, int nlist,
                 sprintf(histitle, "cumulative rotamer distribution for %s", dlist[i].name);
                 fprintf(stderr, "  and %s  ", hisfile);
                 fp = xvgropen(hisfile, histitle, "number", "", oenv);
-                fprintf(fp, "@ xaxis tick on\n");
-                fprintf(fp, "@ xaxis tick major 1\n");
-                fprintf(fp, "@ type xy\n");
+                if (output_env_get_print_xvgr_codes(oenv))
+                {
+                    fprintf(fp, "@ xaxis tick on\n");
+                    fprintf(fp, "@ xaxis tick major 1\n");
+                    fprintf(fp, "@ type xy\n");
+                }
                 for (k = 0; (k < nbin); k++)
                 {
                     if (bNormalize)
@@ -582,7 +587,7 @@ void get_chi_product_traj (real **dih, int nframes, int nlist,
                         fprintf(fp, "%5d  %10d\n", k, chi_prhist[k]);
                     }
                 }
-                fprintf(fp, "&\n");
+                fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
                 gmx_ffclose(fp);
             }
 
@@ -670,7 +675,7 @@ void calc_distribution_props(int nh, int histo[], real start,
     *S2 = tdc*tdc+tds*tds;
 }
 
-static void calc_angles(t_pbc *pbc,
+static void calc_angles(struct t_pbc *pbc,
                         int n3, atom_id index[], real ang[], rvec x_s[])
 {
     int  i, ix, t1, t2;
@@ -724,7 +729,7 @@ static real calc_fraction(real angles[], int nangles)
     }
 }
 
-static void calc_dihs(t_pbc *pbc,
+static void calc_dihs(struct t_pbc *pbc,
                       int n4, atom_id index[], real ang[], rvec x_s[])
 {
     int  i, ix, t1, t2, t3;
@@ -812,15 +817,15 @@ void read_ang_dih(const char *trj_fn,
                   real *dih[],
                   const output_env_t oenv)
 {
-    t_pbc       *pbc;
-    t_trxstatus *status;
-    int          i, angind, natoms, total, teller;
-    int          nangles, n_alloc;
-    real         t, fraction, pifac, aa, angle;
-    real        *angles[2];
-    matrix       box;
-    rvec        *x;
-    int          cur = 0;
+    struct t_pbc *pbc;
+    t_trxstatus  *status;
+    int           i, angind, natoms, total, teller;
+    int           nangles, n_alloc;
+    real          t, fraction, pifac, aa, angle;
+    real         *angles[2];
+    matrix        box;
+    rvec         *x;
+    int           cur = 0;
 #define prev (1-cur)
 
     snew(pbc, 1);