Apply re-formatting to C++ in src/ tree.
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_order.cpp
index aa97af5f97d8b4a63cc17e1f475a8eef32838a6b..bbf61e90b3118a3309d0c30b319af2c779cdc972 100644 (file)
@@ -328,8 +328,8 @@ static void calc_tetra_order_parm(const char*             fnNDX,
     nframes = 0;
     do
     {
-        find_nearest_neighbours(pbcType, natoms, box, x, isize[0], index[0], &sg, &sk, nslice,
-                                slice_dim, sg_slice, sk_slice, gpbc);
+        find_nearest_neighbours(
+                pbcType, natoms, box, x, isize[0], index[0], &sg, &sk, nslice, slice_dim, sg_slice, sk_slice, gpbc);
         for (i = 0; (i < nslice); i++)
         {
             sg_slice_tot[i] += sg_slice[i];
@@ -353,9 +353,13 @@ static void calc_tetra_order_parm(const char*             fnNDX,
     fpsk = xvgropen(skslfn, "S\\sk\\N Distance Order Parameter / Slab", "(nm)", "S\\sk\\N", oenv);
     for (i = 0; (i < nslice); i++)
     {
-        fprintf(fpsg, "%10g  %10g\n", (i + 0.5) * box[slice_dim][slice_dim] / nslice,
+        fprintf(fpsg,
+                "%10g  %10g\n",
+                (i + 0.5) * box[slice_dim][slice_dim] / nslice,
                 sg_slice_tot[i] / static_cast<real>(nframes));
-        fprintf(fpsk, "%10g  %10g\n", (i + 0.5) * box[slice_dim][slice_dim] / nslice,
+        fprintf(fpsk,
+                "%10g  %10g\n",
+                (i + 0.5) * box[slice_dim][slice_dim] / nslice,
                 sk_slice_tot[i] / static_cast<real>(nframes));
     }
     xvgrclose(fpsg);
@@ -371,8 +375,11 @@ static void print_types(const int index[], int a[], int ngrps, char* groups[], c
     fprintf(stderr, "Using following groups: \n");
     for (i = 0; i < ngrps; i++)
     {
-        fprintf(stderr, "Groupname: %s First atomname: %s First atomnr %d\n", groups[i],
-                *(top->atoms.atomname[a[index[i]]]), a[index[i]]);
+        fprintf(stderr,
+                "Groupname: %s First atomname: %s First atomnr %d\n",
+                groups[i],
+                *(top->atoms.atomname[a[index[i]]]),
+                a[index[i]]);
     }
     fprintf(stderr, "\n");
 }
@@ -384,7 +391,9 @@ static void check_length(real length, int a, int b)
         fprintf(stderr,
                 "WARNING: distance between atoms %d and "
                 "%d > 0.3 nm (%f). Index file might be corrupt.\n",
-                a, b, length);
+                a,
+                b,
+                length);
     }
 }
 
@@ -746,7 +755,11 @@ static void calc_order(const char*             fn,
     for (i = 1; i < ngrps - 1; i++)
     {
         svmul(1.0 / nr_frames, (*order)[i], (*order)[i]);
-        fprintf(stderr, "Atom %d Tensor: x=%g , y=%g, z=%g\n", i, (*order)[i][XX], (*order)[i][YY],
+        fprintf(stderr,
+                "Atom %d Tensor: x=%g , y=%g, z=%g\n",
+                i,
+                (*order)[i][XX],
+                (*order)[i][YY],
                 (*order)[i][ZZ]);
         if (bSliced || permolecule)
         {
@@ -766,7 +779,8 @@ static void calc_order(const char*             fn,
 
     if (bUnsat)
     {
-        fprintf(stderr, "Average angle between double bond and normal: %f\n",
+        fprintf(stderr,
+                "Average angle between double bond and normal: %f\n",
                 180 * sdbangle / (nr_frames * static_cast<real>(size) * M_PI));
     }
 
@@ -813,7 +827,9 @@ static void order_plot(rvec                    order[],
         slOrd = xvgropen(bfile, buf, "Molecule", "S", oenv);
         for (atom = 1; atom < ngrps - 1; atom++)
         {
-            fprintf(ord, "%12d   %12g\n", atom,
+            fprintf(ord,
+                    "%12d   %12g\n",
+                    atom,
                     -1.0 * (2.0 / 3.0 * order[atom][XX] + 1.0 / 3.0 * order[atom][YY]));
         }
 
@@ -852,8 +868,7 @@ static void order_plot(rvec                    order[],
             {
                 S += slOrder[slice][atom];
             }
-            fprintf(slOrd, "%12g     %12g\n", static_cast<real>(slice) * slWidth,
-                    S / static_cast<real>(atom));
+            fprintf(slOrd, "%12g     %12g\n", static_cast<real>(slice) * slWidth, S / static_cast<real>(atom));
         }
     }
     else
@@ -865,9 +880,10 @@ static void order_plot(rvec                    order[],
 
         for (atom = 1; atom < ngrps - 1; atom++)
         {
-            fprintf(ord, "%12d   %12g   %12g   %12g\n", atom, order[atom][XX], order[atom][YY],
-                    order[atom][ZZ]);
-            fprintf(slOrd, "%12d   %12g\n", atom,
+            fprintf(ord, "%12d   %12g   %12g   %12g\n", atom, order[atom][XX], order[atom][YY], order[atom][ZZ]);
+            fprintf(slOrd,
+                    "%12d   %12g\n",
+                    atom,
                     -1.0 * (2.0 / 3.0 * order[atom][XX] + 1.0 / 3.0 * order[atom][YY]));
         }
     }
@@ -937,8 +953,8 @@ static void write_bfactors(t_filenm*         fnm,
         }
     }
 
-    write_sto_conf(opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, nullptr,
-                   frout.pbcType, frout.box);
+    write_sto_conf(
+            opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, nullptr, frout.pbcType, frout.box);
 
     sfree(frout.x);
     done_atom(&useatoms);
@@ -1034,8 +1050,8 @@ int gmx_order(int argc, char* argv[])
     const char *      sgfnm, *skfnm, *ndxfnm, *tpsfnm, *trxfnm;
     gmx_output_env_t* oenv;
 
-    if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, NFILE, fnm, asize(pa), pa,
-                           asize(desc), desc, 0, nullptr, &oenv))
+    if (!parse_common_args(
+                &argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
     {
         return 0;
     }
@@ -1081,8 +1097,16 @@ int gmx_order(int argc, char* argv[])
         /* If either of theoptions is set we compute both */
         sgfnm = opt2fn("-Sg", NFILE, fnm);
         skfnm = opt2fn("-Sk", NFILE, fnm);
-        calc_tetra_order_parm(ndxfnm, tpsfnm, trxfnm, sgfnm, skfnm, nslices, axis,
-                              opt2fn("-Sgsl", NFILE, fnm), opt2fn("-Sksl", NFILE, fnm), oenv);
+        calc_tetra_order_parm(ndxfnm,
+                              tpsfnm,
+                              trxfnm,
+                              sgfnm,
+                              skfnm,
+                              nslices,
+                              axis,
+                              opt2fn("-Sgsl", NFILE, fnm),
+                              opt2fn("-Sksl", NFILE, fnm),
+                              oenv);
         /* view xvgr files */
         do_view(oenv, opt2fn("-Sg", NFILE, fnm), nullptr);
         do_view(oenv, opt2fn("-Sk", NFILE, fnm), nullptr);
@@ -1136,18 +1160,43 @@ int gmx_order(int argc, char* argv[])
         /* show atomtypes, to check if index file is correct */
         print_types(index, a, ngrps, grpname, top);
 
-        calc_order(ftp2fn(efTRX, NFILE, fnm), index, a, &order, &slOrder, &slWidth, nslices,
-                   bSliced, bUnsat, top, pbcType, ngrps, axis, permolecule, radial, distcalc,
-                   opt2fn_null("-nr", NFILE, fnm), &distvals, oenv);
+        calc_order(ftp2fn(efTRX, NFILE, fnm),
+                   index,
+                   a,
+                   &order,
+                   &slOrder,
+                   &slWidth,
+                   nslices,
+                   bSliced,
+                   bUnsat,
+                   top,
+                   pbcType,
+                   ngrps,
+                   axis,
+                   permolecule,
+                   radial,
+                   distcalc,
+                   opt2fn_null("-nr", NFILE, fnm),
+                   &distvals,
+                   oenv);
 
         if (radial)
         {
             ngrps--; /*don't print the last group--was used for
                                center-of-mass determination*/
         }
-        order_plot(order, slOrder, opt2fn("-o", NFILE, fnm), opt2fn("-os", NFILE, fnm),
-                   opt2fn("-od", NFILE, fnm), ngrps, nslices, slWidth, bSzonly, permolecule,
-                   distvals, oenv);
+        order_plot(order,
+                   slOrder,
+                   opt2fn("-o", NFILE, fnm),
+                   opt2fn("-os", NFILE, fnm),
+                   opt2fn("-od", NFILE, fnm),
+                   ngrps,
+                   nslices,
+                   slWidth,
+                   bSzonly,
+                   permolecule,
+                   distvals,
+                   oenv);
 
         if (opt2bSet("-ob", NFILE, fnm))
         {