Apply re-formatting to C++ in src/ tree.
[alexxy/gromacs.git] / src / gromacs / fileio / pdbio.cpp
index c3f6810bcbca812089508caa5719ca586a6399a9..d2f373c63d78b88e0e0497ac394ee0d82a04232b 100644 (file)
@@ -120,14 +120,30 @@ void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box)
     fprintf(out, "REMARK    THIS IS A SIMULATION BOX\n");
     if (pbcType != PbcType::Screw)
     {
-        fprintf(out, "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d\n", 10 * norm(box[XX]),
-                10 * norm(box[YY]), 10 * norm(box[ZZ]), alpha, beta, gamma, "P 1", 1);
+        fprintf(out,
+                "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d\n",
+                10 * norm(box[XX]),
+                10 * norm(box[YY]),
+                10 * norm(box[ZZ]),
+                alpha,
+                beta,
+                gamma,
+                "P 1",
+                1);
     }
     else
     {
         /* Double the a-vector length and write the correct space group */
-        fprintf(out, "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d\n", 20 * norm(box[XX]),
-                10 * norm(box[YY]), 10 * norm(box[ZZ]), alpha, beta, gamma, "P 21 1 1", 1);
+        fprintf(out,
+                "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f %-11s%4d\n",
+                20 * norm(box[XX]),
+                10 * norm(box[YY]),
+                10 * norm(box[ZZ]),
+                alpha,
+                beta,
+                gamma,
+                "P 21 1 1",
+                1);
     }
 }
 
@@ -245,9 +261,19 @@ static int gmx_fprintf_pqr_atomline(FILE*           fp,
     atom_seq_number = atom_seq_number % 100000;
     res_seq_number  = res_seq_number % 10000;
 
-    int n = fprintf(fp, "%-6s%5d %-4.4s%4.4s%c%4d %8.3f %8.3f %8.3f %6.2f %6.2f\n", pdbtp[record],
-                    atom_seq_number, atom_name, res_name, chain_id, res_seq_number, x, y, z,
-                    occupancy, b_factor);
+    int n = fprintf(fp,
+                    "%-6s%5d %-4.4s%4.4s%c%4d %8.3f %8.3f %8.3f %6.2f %6.2f\n",
+                    pdbtp[record],
+                    atom_seq_number,
+                    atom_name,
+                    res_name,
+                    chain_id,
+                    res_seq_number,
+                    x,
+                    y,
+                    z,
+                    occupancy,
+                    b_factor);
 
     return n;
 }
@@ -343,22 +369,54 @@ void write_pdbfile_indexed(FILE*          out,
         bfac  = pdbinfo.bfac;
         if (!usePqrFormat)
         {
-            gmx_fprintf_pdb_atomline(out, type, i + 1, nm.c_str(), altloc, resnm.c_str(), ch, resnr,
-                                     resic, 10 * x[i][XX], 10 * x[i][YY], 10 * x[i][ZZ], occup,
-                                     bfac, atoms->atom[i].elem);
+            gmx_fprintf_pdb_atomline(out,
+                                     type,
+                                     i + 1,
+                                     nm.c_str(),
+                                     altloc,
+                                     resnm.c_str(),
+                                     ch,
+                                     resnr,
+                                     resic,
+                                     10 * x[i][XX],
+                                     10 * x[i][YY],
+                                     10 * x[i][ZZ],
+                                     occup,
+                                     bfac,
+                                     atoms->atom[i].elem);
 
             if (atoms->pdbinfo && atoms->pdbinfo[i].bAnisotropic)
             {
-                fprintf(out, "ANISOU%5d  %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n", (i + 1) % 100000,
-                        nm.c_str(), resnm.c_str(), ch, resnr, (resic == '\0') ? ' ' : resic,
-                        atoms->pdbinfo[i].uij[0], atoms->pdbinfo[i].uij[1], atoms->pdbinfo[i].uij[2],
-                        atoms->pdbinfo[i].uij[3], atoms->pdbinfo[i].uij[4], atoms->pdbinfo[i].uij[5]);
+                fprintf(out,
+                        "ANISOU%5d  %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n",
+                        (i + 1) % 100000,
+                        nm.c_str(),
+                        resnm.c_str(),
+                        ch,
+                        resnr,
+                        (resic == '\0') ? ' ' : resic,
+                        atoms->pdbinfo[i].uij[0],
+                        atoms->pdbinfo[i].uij[1],
+                        atoms->pdbinfo[i].uij[2],
+                        atoms->pdbinfo[i].uij[3],
+                        atoms->pdbinfo[i].uij[4],
+                        atoms->pdbinfo[i].uij[5]);
             }
         }
         else
         {
-            gmx_fprintf_pqr_atomline(out, type, i + 1, nm.c_str(), resnm.c_str(), ch, resnr,
-                                     10 * x[i][XX], 10 * x[i][YY], 10 * x[i][ZZ], occup, bfac);
+            gmx_fprintf_pqr_atomline(out,
+                                     type,
+                                     i + 1,
+                                     nm.c_str(),
+                                     resnm.c_str(),
+                                     ch,
+                                     resnr,
+                                     10 * x[i][XX],
+                                     10 * x[i][YY],
+                                     10 * x[i][ZZ],
+                                     occup,
+                                     bfac);
         }
     }
 
@@ -392,8 +450,8 @@ void write_pdbfile(FILE*          out,
     {
         index[i] = i;
     }
-    write_pdbfile_indexed(out, title, atoms, x, pbcType, box, chainid, model_nr, atoms->nr, index,
-                          conect, false);
+    write_pdbfile_indexed(
+            out, title, atoms, x, pbcType, box, chainid, model_nr, atoms->nr, index, conect, false);
     sfree(index);
 }
 
@@ -458,9 +516,14 @@ static void read_anisou(char line[], int natom, t_atoms* atoms)
     }
     else
     {
-        if (sscanf(line + 29, "%d%d%d%d%d%d", &atoms->pdbinfo[i].uij[U11], &atoms->pdbinfo[i].uij[U22],
-                   &atoms->pdbinfo[i].uij[U33], &atoms->pdbinfo[i].uij[U12],
-                   &atoms->pdbinfo[i].uij[U13], &atoms->pdbinfo[i].uij[U23])
+        if (sscanf(line + 29,
+                   "%d%d%d%d%d%d",
+                   &atoms->pdbinfo[i].uij[U11],
+                   &atoms->pdbinfo[i].uij[U22],
+                   &atoms->pdbinfo[i].uij[U33],
+                   &atoms->pdbinfo[i].uij[U12],
+                   &atoms->pdbinfo[i].uij[U13],
+                   &atoms->pdbinfo[i].uij[U23])
             == 6)
         {
             atoms->pdbinfo[i].bAnisotropic = TRUE;
@@ -1055,9 +1118,21 @@ int gmx_fprintf_pdb_atomline(FILE*           fp,
     atom_seq_number = atom_seq_number % 100000;
     res_seq_number  = res_seq_number % 10000;
 
-    n = fprintf(fp, "%-6s%5d %-4.4s%c%4.4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f          %2s\n",
-                pdbtp[record], atom_seq_number, tmp_atomname, alternate_location, tmp_resname,
-                chain_id, res_seq_number, res_insertion_code, x, y, z, occupancy, b_factor,
+    n = fprintf(fp,
+                "%-6s%5d %-4.4s%c%4.4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f          %2s\n",
+                pdbtp[record],
+                atom_seq_number,
+                tmp_atomname,
+                alternate_location,
+                tmp_resname,
+                chain_id,
+                res_seq_number,
+                res_insertion_code,
+                x,
+                y,
+                z,
+                occupancy,
+                b_factor,
                 (element != nullptr) ? element : "");
 
     return n;