Merge remote-tracking branch 'origin/release-2021' into merge-2021-into-master
[alexxy/gromacs.git] / src / gromacs / gmxana / anadih.cpp
index 5489ffac6f4ee0e0bb392491ef8dbd91e9306b4a..7238fa320f9bd253ee694eddac64ea6944803329 100644 (file)
@@ -51,6 +51,7 @@
 #include "gromacs/listed_forces/bonded.h"
 #include "gromacs/math/functions.h"
 #include "gromacs/math/units.h"
+#include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/math/vecdump.h"
 #include "gromacs/pbcutil/pbc.h"
@@ -107,7 +108,7 @@ static int calc_RBbin(real phi, int gmx_unused multiplicity, real gmx_unused cor
 
 static int calc_Nbin(real phi, int multiplicity, real core_frac)
 {
-    static const real r360 = 360 * DEG2RAD;
+    static const real r360 = 360 * gmx::c_deg2Rad;
     real              rot_width, core_width, core_offset, low, hi;
     int               bin;
     /* with multiplicity 3 and core_frac 0.5
@@ -127,8 +128,8 @@ static int calc_Nbin(real phi, int multiplicity, real core_frac)
     {
         low = ((bin - 1) * rot_width) + core_offset;
         hi  = ((bin - 1) * rot_width) + core_offset + core_width;
-        low *= DEG2RAD;
-        hi *= DEG2RAD;
+        low *= gmx::c_deg2Rad;
+        hi *= gmx::c_deg2Rad;
         if ((phi > low) && (phi < hi))
         {
             return bin;
@@ -161,8 +162,8 @@ void ana_dih_trans(const char*             fn_trans,
         multiplicity[k] = 3;
     }
 
-    low_ana_dih_trans(TRUE, fn_trans, TRUE, fn_histo, maxchi, dih, nlist, dlist, nframes, nangles,
-                      grpname, multiplicity, time, bRb, 0.5, oenv);
+    low_ana_dih_trans(
+            TRUE, fn_trans, TRUE, fn_histo, maxchi, dih, nlist, dlist, nframes, nangles, grpname, multiplicity, time, bRb, 0.5, oenv);
     sfree(dlist);
     sfree(multiplicity);
 }
@@ -575,8 +576,7 @@ void get_chi_product_traj(real**                  dih,
             if (bAll)
             {
                 /* print cuml rotamer vs time */
-                print_one(oenv, "chiproduct", dlist[i].name, "chi product for",
-                          "cumulative rotamer", nframes, time, chi_prtrj);
+                print_one(oenv, "chiproduct", dlist[i].name, "chi product for", "cumulative rotamer", nframes, time, chi_prtrj);
             }
 
             /* make a histogram pf culm. rotamer occupancy too */
@@ -698,13 +698,12 @@ static void calc_angles(struct t_pbc* pbc, int n3, int index[], real ang[], rvec
 
     for (i = ix = 0; (ix < n3); i++, ix += 3)
     {
-        ang[i] = bond_angle(x_s[index[ix]], x_s[index[ix + 1]], x_s[index[ix + 2]], pbc, r_ij, r_kj,
-                            &costh, &t1, &t2);
+        ang[i] = bond_angle(
+                x_s[index[ix]], x_s[index[ix + 1]], x_s[index[ix + 2]], pbc, r_ij, r_kj, &costh, &t1, &t2);
     }
     if (debug)
     {
-        fprintf(debug, "Angle[0]=%g, costh=%g, index0 = %d, %d, %d\n", ang[0], costh, index[0],
-                index[1], index[2]);
+        fprintf(debug, "Angle[0]=%g, costh=%g, index0 = %d, %d, %d\n", ang[0], costh, index[0], index[1], index[2]);
         pr_rvec(debug, 0, "rij", r_ij, DIM, TRUE);
         pr_rvec(debug, 0, "rkj", r_kj, DIM, TRUE);
     }
@@ -718,7 +717,7 @@ static real calc_fraction(const real angles[], int nangles)
 
     for (i = 0; i < nangles; i++)
     {
-        angle = angles[i] * RAD2DEG;
+        angle = angles[i] * gmx::c_rad2Deg;
 
         if (angle > 135 && angle < 225)
         {
@@ -747,8 +746,19 @@ static void calc_dihs(struct t_pbc* pbc, int n4, const int index[], real ang[],
 
     for (i = ix = 0; (ix < n4); i++, ix += 4)
     {
-        aaa = dih_angle(x_s[index[ix]], x_s[index[ix + 1]], x_s[index[ix + 2]], x_s[index[ix + 3]],
-                        pbc, r_ij, r_kj, r_kl, m, n, &t1, &t2, &t3);
+        aaa = dih_angle(x_s[index[ix]],
+                        x_s[index[ix + 1]],
+                        x_s[index[ix + 2]],
+                        x_s[index[ix + 3]],
+                        pbc,
+                        r_ij,
+                        r_kj,
+                        r_kl,
+                        m,
+                        n,
+                        &t1,
+                        &t2,
+                        &t3);
 
         ang[i] = aaa; /* not taking into account ryckaert bellemans yet */
     }
@@ -772,8 +782,7 @@ void make_histo(FILE* log, int ndata, real data[], int npoints, int histo[], rea
     dx = npoints / (maxx - minx);
     if (debug)
     {
-        fprintf(debug, "Histogramming: ndata=%d, nhisto=%d, minx=%g,maxx=%g,dx=%g\n", ndata,
-                npoints, minx, maxx, dx);
+        fprintf(debug, "Histogramming: ndata=%d, nhisto=%d, minx=%g,maxx=%g,dx=%g\n", ndata, npoints, minx, maxx, dx);
     }
     for (i = 0; (i < ndata); i++)
     {