Split txtdump.*, part 1
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 3 Dec 2015 19:22:37 +0000 (21:22 +0200)
committerDavid van der Spoel <davidvanderspoel@gmail.com>
Wed, 9 Dec 2015 12:59:43 +0000 (13:59 +0100)
- Move routines to print various data structures to the file that
  declares the data structure, mostly to topology/.
- Rename pr_header() to pr_tpxheader() to clarify its use.
- Remove unused pr_commrec() and some commented-out code.
- Remove unnecessary uses of txtdump.h.

This helps avoiding dependency cycles coming from this (because in its
old form, any code that wanted to use these routines for, e.g., debug
output, would need to be above all the data structures for which this
printing was supported).  Also, it makes it easier to find the code that
needs changing because of a data structure change easier when it is
close to the declaration of the data structure.

Follow-up commit will move txtdump.* out of fileio to resolve existing
cyclic dependencies, but split that into a separate commit to keep the
size manageable.

Change-Id: I2665f6d25cd095f4c7d11d32bcaec38601ff8d8b

56 files changed:
src/gromacs/ewald/pme-only.cpp
src/gromacs/fileio/tpxio.cpp
src/gromacs/fileio/tpxio.h
src/gromacs/fileio/trrio.cpp
src/gromacs/fileio/txtdump.cpp
src/gromacs/fileio/txtdump.h
src/gromacs/gmxana/gmx_anaeig.cpp
src/gromacs/gmxana/gmx_analyze.cpp
src/gromacs/gmxana/gmx_chi.cpp
src/gromacs/gmxana/gmx_confrms.cpp
src/gromacs/gmxana/gmx_covar.cpp
src/gromacs/gmxana/gmx_densmap.cpp
src/gromacs/gmxana/gmx_dos.cpp
src/gromacs/gmxana/gmx_editconf.cpp
src/gromacs/gmxana/gmx_hbond.cpp
src/gromacs/gmxana/gmx_helix.cpp
src/gromacs/gmxana/gmx_lie.cpp
src/gromacs/gmxana/gmx_make_edi.cpp
src/gromacs/gmxana/gmx_nmeig.cpp
src/gromacs/gmxana/gmx_nmens.cpp
src/gromacs/gmxana/gmx_nmtraj.cpp
src/gromacs/gmxana/gmx_principal.cpp
src/gromacs/gmxana/gmx_sham.cpp
src/gromacs/gmxana/gmx_sigeps.cpp
src/gromacs/gmxana/gmx_tcaf.cpp
src/gromacs/gmxana/gmx_trjorder.cpp
src/gromacs/gmxana/gmx_velacc.cpp
src/gromacs/gmxana/princ.cpp
src/gromacs/gmxlib/nonbonded/nonbonded.cpp
src/gromacs/gmxpreprocess/genconf.cpp
src/gromacs/gmxpreprocess/grompp.cpp
src/gromacs/gmxpreprocess/nm2type.cpp
src/gromacs/gmxpreprocess/topio.cpp
src/gromacs/mdlib/expanded.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/minimize.cpp
src/gromacs/mdlib/qm_gamess.cpp
src/gromacs/mdlib/qm_gaussian.cpp
src/gromacs/mdlib/qm_mopac.cpp
src/gromacs/mdlib/qm_orca.cpp
src/gromacs/mdlib/qmmm.cpp
src/gromacs/mdlib/shakef.cpp
src/gromacs/mdlib/stat.cpp
src/gromacs/mdlib/tpi.cpp
src/gromacs/tools/check.cpp
src/gromacs/tools/compare.cpp
src/gromacs/tools/dump.cpp
src/gromacs/topology/atoms.cpp
src/gromacs/topology/atoms.h
src/gromacs/topology/block.cpp
src/gromacs/topology/block.h
src/gromacs/topology/idef.cpp [new file with mode: 0644]
src/gromacs/topology/idef.h
src/gromacs/topology/index.cpp
src/gromacs/topology/topology.cpp
src/gromacs/topology/topology.h

index 2cd8aca5da50828535657a24915e3527f2dcef48..bec779fc7a24a1a1561111aa4448d4b354d874de 100644 (file)
@@ -68,7 +68,6 @@
 #include "gromacs/ewald/pme.h"
 #include "gromacs/fft/parallel_3dfft.h"
 #include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/gmxcomplex.h"
index 78640e8738ecdd11caa68a151ebfe9ee7bf1068a..37b8b6056def7e8edd7547708e949c35cf5fb921 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "tpxio.h"
 
+#include <cstdio>
 #include <cstdlib>
 #include <cstring>
 
@@ -49,6 +50,7 @@
 #include "gromacs/fileio/filetypes.h"
 #include "gromacs/fileio/gmxfio.h"
 #include "gromacs/fileio/gmxfio-xdr.h"
+#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/mdtypes/inputrec.h"
@@ -3687,3 +3689,28 @@ gmx_bool fn2bTPX(const char *file)
 {
     return (efTPR == fn2ftp(file));
 }
+
+void pr_tpxheader(FILE *fp, int indent, const char *title, const t_tpxheader *sh)
+{
+    if (available(fp, sh, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "bIr    = %spresent\n", sh->bIr ? "" : "not ");
+        pr_indent(fp, indent);
+        fprintf(fp, "bBox   = %spresent\n", sh->bBox ? "" : "not ");
+        pr_indent(fp, indent);
+        fprintf(fp, "bTop   = %spresent\n", sh->bTop ? "" : "not ");
+        pr_indent(fp, indent);
+        fprintf(fp, "bX     = %spresent\n", sh->bX ? "" : "not ");
+        pr_indent(fp, indent);
+        fprintf(fp, "bV     = %spresent\n", sh->bV ? "" : "not ");
+        pr_indent(fp, indent);
+        fprintf(fp, "bF     = %spresent\n", sh->bF ? "" : "not ");
+
+        pr_indent(fp, indent);
+        fprintf(fp, "natoms = %d\n", sh->natoms);
+        pr_indent(fp, indent);
+        fprintf(fp, "lambda = %e\n", sh->lambda);
+    }
+}
index e213783a8dbb2b8f7cf455a8b3b9286bd8e28a12..3a3f2042b525b962ba198c7d7a9ec99e1c07dbd9 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.
  */
-
 #ifndef GMX_FILEIO_TPXIO_H
 #define GMX_FILEIO_TPXIO_H
 
+#include <cstdio>
 
-/**************************************************************
- *
- * The routines in the corresponding c-file tpxio.c
- * are based on the lower level routines in gmxfio.c
- *
- **************************************************************/
 #include "gromacs/mdtypes/inputrec.h"
 #include "gromacs/mdtypes/state.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 struct gmx_mtop_t;
 struct t_atoms;
 struct t_block;
@@ -124,8 +114,6 @@ int read_tpx_top(const char *fn,
 gmx_bool fn2bTPX(const char *file);
 /* return if *file is one of the TPX file types */
 
-#ifdef __cplusplus
-}
-#endif
+void pr_tpxheader(FILE *fp, int indent, const char *title, const t_tpxheader *sh);
 
 #endif
index ee4145bae3ab2d829586d3ed1b569ef164c5676b..6b4c392216fd83eb89acc11264d0b48f938db503 100644 (file)
@@ -42,7 +42,6 @@
 
 #include "gromacs/fileio/gmxfio.h"
 #include "gromacs/fileio/gmxfio-xdr.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
index e5789d75e81483b0f578319cd366017ed8ac3a46..b0c0217ca74e77320c80202f6a0c0a7cee21afc2 100644 (file)
 #include <cstdio>
 #include <cstdlib>
 
-#include <algorithm>
-
-#include "gromacs/fileio/tpxio.h"
-#include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/math/vec.h"
-#include "gromacs/mdtypes/commrec.h"
+#include "gromacs/mdtypes/inputrec.h"
 #include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/mdtypes/pull-params.h"
 #include "gromacs/pbcutil/pbc.h"
-#include "gromacs/topology/topology.h"
 #include "gromacs/utility/cstringutil.h"
-#include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/snprintf.h"
 #include "gromacs/utility/stringutil.h"
 
@@ -233,22 +226,6 @@ void pr_dvec(FILE *fp, int indent, const char *title, const double vec[], int n,
 }
 
 
-/*
-   void pr_mat(FILE *fp,int indent,char *title,matrix m)
-   {
-   int i,j;
-
-   if (available(fp,m,indent,title)) {
-    indent=pr_title_n(fp,indent,title,n);
-    for(i=0; i<n; i++) {
-      pr_indent(fp,indent);
-      fprintf(fp,"%s[%d]=%12.5e %12.5e %12.5e\n",
-          title,bShowNumbers?i:-1,m[i][XX],m[i][YY],m[i][ZZ]);
-    }
-   }
-   }
- */
-
 void pr_rvecs_len(FILE *fp, int indent, const char *title, const rvec vec[], int n)
 {
     int i, j;
@@ -414,7 +391,7 @@ void pr_reals_of_dim(FILE *fp, int indent, const char *title, const real *vec, i
     }
 }
 
-static void pr_int(FILE *fp, int indent, const char *title, int i)
+void pr_int(FILE *fp, int indent, const char *title, int i)
 {
     pr_indent(fp, indent);
     fprintf(fp, "%-30s = %d\n", title, i);
@@ -428,19 +405,19 @@ static void pr_int64(FILE *fp, int indent, const char *title, gmx_int64_t i)
     fprintf(fp, "%-30s = %s\n", title, gmx_step_str(i, buf));
 }
 
-static void pr_real(FILE *fp, int indent, const char *title, real r)
+void pr_real(FILE *fp, int indent, const char *title, real r)
 {
     pr_indent(fp, indent);
     fprintf(fp, "%-30s = %g\n", title, r);
 }
 
-static void pr_double(FILE *fp, int indent, const char *title, double d)
+void pr_double(FILE *fp, int indent, const char *title, double d)
 {
     pr_indent(fp, indent);
     fprintf(fp, "%-30s = %g\n", title, d);
 }
 
-static void pr_str(FILE *fp, int indent, const char *title, const char *s)
+void pr_str(FILE *fp, int indent, const char *title, const char *s)
 {
     pr_indent(fp, indent);
     fprintf(fp, "%-30s = %s\n", title, s);
@@ -1149,533 +1126,7 @@ void pr_inputrec(FILE *fp, int indent, const char *title, const t_inputrec *ir,
 #undef PR
 #undef PI
 
-static void pr_harm(FILE *fp, const t_iparams *iparams, const char *r, const char *kr)
-{
-    fprintf(fp, "%sA=%12.5e, %sA=%12.5e, %sB=%12.5e, %sB=%12.5e\n",
-            r, iparams->harmonic.rA, kr, iparams->harmonic.krA,
-            r, iparams->harmonic.rB, kr, iparams->harmonic.krB);
-}
-
-void pr_iparams(FILE *fp, t_functype ftype, const t_iparams *iparams)
-{
-    switch (ftype)
-    {
-        case F_ANGLES:
-        case F_G96ANGLES:
-            pr_harm(fp, iparams, "th", "ct");
-            break;
-        case F_CROSS_BOND_BONDS:
-            fprintf(fp, "r1e=%15.8e, r2e=%15.8e, krr=%15.8e\n",
-                    iparams->cross_bb.r1e, iparams->cross_bb.r2e,
-                    iparams->cross_bb.krr);
-            break;
-        case F_CROSS_BOND_ANGLES:
-            fprintf(fp, "r1e=%15.8e, r1e=%15.8e, r3e=%15.8e, krt=%15.8e\n",
-                    iparams->cross_ba.r1e, iparams->cross_ba.r2e,
-                    iparams->cross_ba.r3e, iparams->cross_ba.krt);
-            break;
-        case F_LINEAR_ANGLES:
-            fprintf(fp, "klinA=%15.8e, aA=%15.8e, klinB=%15.8e, aB=%15.8e\n",
-                    iparams->linangle.klinA, iparams->linangle.aA,
-                    iparams->linangle.klinB, iparams->linangle.aB);
-            break;
-        case F_UREY_BRADLEY:
-            fprintf(fp, "thetaA=%15.8e, kthetaA=%15.8e, r13A=%15.8e, kUBA=%15.8e, thetaB=%15.8e, kthetaB=%15.8e, r13B=%15.8e, kUBB=%15.8e\n", iparams->u_b.thetaA, iparams->u_b.kthetaA, iparams->u_b.r13A, iparams->u_b.kUBA, iparams->u_b.thetaB, iparams->u_b.kthetaB, iparams->u_b.r13B, iparams->u_b.kUBB);
-            break;
-        case F_QUARTIC_ANGLES:
-            fprintf(fp, "theta=%15.8e", iparams->qangle.theta);
-            for (int i = 0; i < 5; i++)
-            {
-                fprintf(fp, ", c%c=%15.8e", '0'+i, iparams->qangle.c[i]);
-            }
-            fprintf(fp, "\n");
-            break;
-        case F_BHAM:
-            fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
-                    iparams->bham.a, iparams->bham.b, iparams->bham.c);
-            break;
-        case F_BONDS:
-        case F_G96BONDS:
-        case F_HARMONIC:
-            pr_harm(fp, iparams, "b0", "cb");
-            break;
-        case F_IDIHS:
-            pr_harm(fp, iparams, "xi", "cx");
-            break;
-        case F_MORSE:
-            fprintf(fp, "b0A=%15.8e, cbA=%15.8e, betaA=%15.8e, b0B=%15.8e, cbB=%15.8e, betaB=%15.8e\n",
-                    iparams->morse.b0A, iparams->morse.cbA, iparams->morse.betaA,
-                    iparams->morse.b0B, iparams->morse.cbB, iparams->morse.betaB);
-            break;
-        case F_CUBICBONDS:
-            fprintf(fp, "b0=%15.8e, kb=%15.8e, kcub=%15.8e\n",
-                    iparams->cubic.b0, iparams->cubic.kb, iparams->cubic.kcub);
-            break;
-        case F_CONNBONDS:
-            fprintf(fp, "\n");
-            break;
-        case F_FENEBONDS:
-            fprintf(fp, "bm=%15.8e, kb=%15.8e\n", iparams->fene.bm, iparams->fene.kb);
-            break;
-        case F_RESTRBONDS:
-            fprintf(fp, "lowA=%15.8e, up1A=%15.8e, up2A=%15.8e, kA=%15.8e, lowB=%15.8e, up1B=%15.8e, up2B=%15.8e, kB=%15.8e,\n",
-                    iparams->restraint.lowA, iparams->restraint.up1A,
-                    iparams->restraint.up2A, iparams->restraint.kA,
-                    iparams->restraint.lowB, iparams->restraint.up1B,
-                    iparams->restraint.up2B, iparams->restraint.kB);
-            break;
-        case F_TABBONDS:
-        case F_TABBONDSNC:
-        case F_TABANGLES:
-        case F_TABDIHS:
-            fprintf(fp, "tab=%d, kA=%15.8e, kB=%15.8e\n",
-                    iparams->tab.table, iparams->tab.kA, iparams->tab.kB);
-            break;
-        case F_POLARIZATION:
-            fprintf(fp, "alpha=%15.8e\n", iparams->polarize.alpha);
-            break;
-        case F_ANHARM_POL:
-            fprintf(fp, "alpha=%15.8e drcut=%15.8e khyp=%15.8e\n",
-                    iparams->anharm_polarize.alpha,
-                    iparams->anharm_polarize.drcut,
-                    iparams->anharm_polarize.khyp);
-            break;
-        case F_THOLE_POL:
-            fprintf(fp, "a=%15.8e, alpha1=%15.8e, alpha2=%15.8e, rfac=%15.8e\n",
-                    iparams->thole.a, iparams->thole.alpha1, iparams->thole.alpha2,
-                    iparams->thole.rfac);
-            break;
-        case F_WATER_POL:
-            fprintf(fp, "al_x=%15.8e, al_y=%15.8e, al_z=%15.8e, rOH=%9.6f, rHH=%9.6f, rOD=%9.6f\n",
-                    iparams->wpol.al_x, iparams->wpol.al_y, iparams->wpol.al_z,
-                    iparams->wpol.rOH, iparams->wpol.rHH, iparams->wpol.rOD);
-            break;
-        case F_LJ:
-            fprintf(fp, "c6=%15.8e, c12=%15.8e\n", iparams->lj.c6, iparams->lj.c12);
-            break;
-        case F_LJ14:
-            fprintf(fp, "c6A=%15.8e, c12A=%15.8e, c6B=%15.8e, c12B=%15.8e\n",
-                    iparams->lj14.c6A, iparams->lj14.c12A,
-                    iparams->lj14.c6B, iparams->lj14.c12B);
-            break;
-        case F_LJC14_Q:
-            fprintf(fp, "fqq=%15.8e, qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
-                    iparams->ljc14.fqq,
-                    iparams->ljc14.qi, iparams->ljc14.qj,
-                    iparams->ljc14.c6, iparams->ljc14.c12);
-            break;
-        case F_LJC_PAIRS_NB:
-            fprintf(fp, "qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
-                    iparams->ljcnb.qi, iparams->ljcnb.qj,
-                    iparams->ljcnb.c6, iparams->ljcnb.c12);
-            break;
-        case F_PDIHS:
-        case F_PIDIHS:
-        case F_ANGRES:
-        case F_ANGRESZ:
-            fprintf(fp, "phiA=%15.8e, cpA=%15.8e, phiB=%15.8e, cpB=%15.8e, mult=%d\n",
-                    iparams->pdihs.phiA, iparams->pdihs.cpA,
-                    iparams->pdihs.phiB, iparams->pdihs.cpB,
-                    iparams->pdihs.mult);
-            break;
-        case F_DISRES:
-            fprintf(fp, "label=%4d, type=%1d, low=%15.8e, up1=%15.8e, up2=%15.8e, fac=%15.8e)\n",
-                    iparams->disres.label, iparams->disres.type,
-                    iparams->disres.low, iparams->disres.up1,
-                    iparams->disres.up2, iparams->disres.kfac);
-            break;
-        case F_ORIRES:
-            fprintf(fp, "ex=%4d, label=%d, power=%4d, c=%15.8e, obs=%15.8e, kfac=%15.8e)\n",
-                    iparams->orires.ex, iparams->orires.label, iparams->orires.power,
-                    iparams->orires.c, iparams->orires.obs, iparams->orires.kfac);
-            break;
-        case F_DIHRES:
-            fprintf(fp, "phiA=%15.8e, dphiA=%15.8e, kfacA=%15.8e, phiB=%15.8e, dphiB=%15.8e, kfacB=%15.8e\n",
-                    iparams->dihres.phiA, iparams->dihres.dphiA, iparams->dihres.kfacA,
-                    iparams->dihres.phiB, iparams->dihres.dphiB, iparams->dihres.kfacB);
-            break;
-        case F_POSRES:
-            fprintf(fp, "pos0A=(%15.8e,%15.8e,%15.8e), fcA=(%15.8e,%15.8e,%15.8e), pos0B=(%15.8e,%15.8e,%15.8e), fcB=(%15.8e,%15.8e,%15.8e)\n",
-                    iparams->posres.pos0A[XX], iparams->posres.pos0A[YY],
-                    iparams->posres.pos0A[ZZ], iparams->posres.fcA[XX],
-                    iparams->posres.fcA[YY], iparams->posres.fcA[ZZ],
-                    iparams->posres.pos0B[XX], iparams->posres.pos0B[YY],
-                    iparams->posres.pos0B[ZZ], iparams->posres.fcB[XX],
-                    iparams->posres.fcB[YY], iparams->posres.fcB[ZZ]);
-            break;
-        case F_FBPOSRES:
-            fprintf(fp, "pos0=(%15.8e,%15.8e,%15.8e), geometry=%d, r=%15.8e, k=%15.8e\n",
-                    iparams->fbposres.pos0[XX], iparams->fbposres.pos0[YY],
-                    iparams->fbposres.pos0[ZZ], iparams->fbposres.geom,
-                    iparams->fbposres.r,        iparams->fbposres.k);
-            break;
-        case F_RBDIHS:
-            for (int i = 0; i < NR_RBDIHS; i++)
-            {
-                fprintf(fp, "%srbcA[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcA[i]);
-            }
-            fprintf(fp, "\n");
-            for (int i = 0; i < NR_RBDIHS; i++)
-            {
-                fprintf(fp, "%srbcB[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcB[i]);
-            }
-            fprintf(fp, "\n");
-            break;
-        case F_FOURDIHS:
-        {
-            /* Use the OPLS -> Ryckaert-Bellemans formula backwards to get
-             * the OPLS potential constants back.
-             */
-            const real *rbcA = iparams->rbdihs.rbcA;
-            const real *rbcB = iparams->rbdihs.rbcB;
-            real        VA[4], VB[4];
-
-            VA[3] = -0.25*rbcA[4];
-            VA[2] = -0.5*rbcA[3];
-            VA[1] = 4.0*VA[3]-rbcA[2];
-            VA[0] = 3.0*VA[2]-2.0*rbcA[1];
-
-            VB[3] = -0.25*rbcB[4];
-            VB[2] = -0.5*rbcB[3];
-            VB[1] = 4.0*VB[3]-rbcB[2];
-            VB[0] = 3.0*VB[2]-2.0*rbcB[1];
-
-            for (int i = 0; i < NR_FOURDIHS; i++)
-            {
-                fprintf(fp, "%sFourA[%d]=%15.8e", i == 0 ? "" : ", ", i, VA[i]);
-            }
-            fprintf(fp, "\n");
-            for (int i = 0; i < NR_FOURDIHS; i++)
-            {
-                fprintf(fp, "%sFourB[%d]=%15.8e", i == 0 ? "" : ", ", i, VB[i]);
-            }
-            fprintf(fp, "\n");
-        }
-        break;
-
-        case F_CONSTR:
-        case F_CONSTRNC:
-            fprintf(fp, "dA=%15.8e, dB=%15.8e\n", iparams->constr.dA, iparams->constr.dB);
-            break;
-        case F_SETTLE:
-            fprintf(fp, "doh=%15.8e, dhh=%15.8e\n", iparams->settle.doh,
-                    iparams->settle.dhh);
-            break;
-        case F_VSITE2:
-            fprintf(fp, "a=%15.8e\n", iparams->vsite.a);
-            break;
-        case F_VSITE3:
-        case F_VSITE3FD:
-        case F_VSITE3FAD:
-            fprintf(fp, "a=%15.8e, b=%15.8e\n", iparams->vsite.a, iparams->vsite.b);
-            break;
-        case F_VSITE3OUT:
-        case F_VSITE4FD:
-        case F_VSITE4FDN:
-            fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
-                    iparams->vsite.a, iparams->vsite.b, iparams->vsite.c);
-            break;
-        case F_VSITEN:
-            fprintf(fp, "n=%2d, a=%15.8e\n", iparams->vsiten.n, iparams->vsiten.a);
-            break;
-        case F_GB12:
-        case F_GB13:
-        case F_GB14:
-            fprintf(fp, "sar=%15.8e, st=%15.8e, pi=%15.8e, gbr=%15.8e, bmlt=%15.8e\n", iparams->gb.sar, iparams->gb.st, iparams->gb.pi, iparams->gb.gbr, iparams->gb.bmlt);
-            break;
-        case F_CMAP:
-            fprintf(fp, "cmapA=%1d, cmapB=%1d\n", iparams->cmap.cmapA, iparams->cmap.cmapB);
-            break;
-        case  F_RESTRANGLES:
-            pr_harm(fp, iparams, "ktheta", "costheta0");
-            break;
-        case  F_RESTRDIHS:
-            fprintf(fp, "phiA=%15.8e, cpA=%15.8e",
-                    iparams->pdihs.phiA, iparams->pdihs.cpA);
-            break;
-        case  F_CBTDIHS:
-            fprintf(fp, "kphi=%15.8e", iparams->cbtdihs.cbtcA[0]);
-            for (int i = 1; i < NR_CBTDIHS; i++)
-            {
-                fprintf(fp, ", cbtcA[%d]=%15.8e", i-1, iparams->cbtdihs.cbtcA[i]);
-            }
-            fprintf(fp, "\n");
-            break;
-        default:
-            gmx_fatal(FARGS, "unknown function type %d (%s) in %s line %d",
-                      ftype, interaction_function[ftype].name, __FILE__, __LINE__);
-    }
-}
-
-void pr_ilist(FILE *fp, int indent, const char *title,
-              const t_functype *functype, const t_ilist *ilist, gmx_bool bShowNumbers)
-{
-    int      i, j, k, type, ftype;
-    t_iatom *iatoms;
-
-    if (available(fp, ilist, indent, title) && ilist->nr > 0)
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "nr: %d\n", ilist->nr);
-        if (ilist->nr > 0)
-        {
-            pr_indent(fp, indent);
-            fprintf(fp, "iatoms:\n");
-            iatoms = ilist->iatoms;
-            for (i = j = 0; i < ilist->nr; )
-            {
-#ifndef DEBUG
-                pr_indent(fp, indent+INDENT);
-                type  = *(iatoms++);
-                ftype = functype[type];
-                fprintf(fp, "%d type=%d (%s)",
-                        bShowNumbers ? j : -1, bShowNumbers ? type : -1,
-                        interaction_function[ftype].name);
-                j++;
-                for (k = 0; k < interaction_function[ftype].nratoms; k++)
-                {
-                    fprintf(fp, " %d", *(iatoms++));
-                }
-                fprintf(fp, "\n");
-                i += 1+interaction_function[ftype].nratoms;
-#else
-                fprintf(fp, "%5d%5d\n", i, iatoms[i]);
-                i++;
-#endif
-            }
-        }
-    }
-}
-
-static void pr_cmap(FILE *fp, int indent, const char *title,
-                    const gmx_cmap_t *cmap_grid, gmx_bool bShowNumbers)
-{
-    int  i, j, nelem;
-    real dx, idx;
-
-    dx    = 360.0 / cmap_grid->grid_spacing;
-    nelem = cmap_grid->grid_spacing*cmap_grid->grid_spacing;
-
-    if (available(fp, cmap_grid, indent, title))
-    {
-        fprintf(fp, "%s\n", title);
-
-        for (i = 0; i < cmap_grid->ngrid; i++)
-        {
-            idx = -180.0;
-            fprintf(fp, "%8s %8s %8s %8s\n", "V", "dVdx", "dVdy", "d2dV");
-
-            fprintf(fp, "grid[%3d]={\n", bShowNumbers ? i : -1);
-
-            for (j = 0; j < nelem; j++)
-            {
-                if ( (j%cmap_grid->grid_spacing) == 0)
-                {
-                    fprintf(fp, "%8.1f\n", idx);
-                    idx += dx;
-                }
-
-                fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4]);
-                fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+1]);
-                fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+2]);
-                fprintf(fp, "%8.3f\n", cmap_grid->cmapdata[i].cmap[j*4+3]);
-            }
-            fprintf(fp, "\n");
-        }
-    }
-
-}
-
-void pr_ffparams(FILE *fp, int indent, const char *title,
-                 const gmx_ffparams_t *ffparams,
-                 gmx_bool bShowNumbers)
-{
-    int i;
-
-    indent = pr_title(fp, indent, title);
-    pr_indent(fp, indent);
-    fprintf(fp, "atnr=%d\n", ffparams->atnr);
-    pr_indent(fp, indent);
-    fprintf(fp, "ntypes=%d\n", ffparams->ntypes);
-    for (i = 0; i < ffparams->ntypes; i++)
-    {
-        pr_indent(fp, indent+INDENT);
-        fprintf(fp, "functype[%d]=%s, ",
-                bShowNumbers ? i : -1,
-                interaction_function[ffparams->functype[i]].name);
-        pr_iparams(fp, ffparams->functype[i], &ffparams->iparams[i]);
-    }
-    pr_double(fp, indent, "reppow", ffparams->reppow);
-    pr_real(fp, indent, "fudgeQQ", ffparams->fudgeQQ);
-    pr_cmap(fp, indent, "cmap", &ffparams->cmap_grid, bShowNumbers);
-}
-
-void pr_idef(FILE *fp, int indent, const char *title, const t_idef *idef, gmx_bool bShowNumbers)
-{
-    int i, j;
-
-    if (available(fp, idef, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "atnr=%d\n", idef->atnr);
-        pr_indent(fp, indent);
-        fprintf(fp, "ntypes=%d\n", idef->ntypes);
-        for (i = 0; i < idef->ntypes; i++)
-        {
-            pr_indent(fp, indent+INDENT);
-            fprintf(fp, "functype[%d]=%s, ",
-                    bShowNumbers ? i : -1,
-                    interaction_function[idef->functype[i]].name);
-            pr_iparams(fp, idef->functype[i], &idef->iparams[i]);
-        }
-        pr_real(fp, indent, "fudgeQQ", idef->fudgeQQ);
-
-        for (j = 0; (j < F_NRE); j++)
-        {
-            pr_ilist(fp, indent, interaction_function[j].longname,
-                     idef->functype, &idef->il[j], bShowNumbers);
-        }
-    }
-}
-
-static int pr_block_title(FILE *fp, int indent, const char *title, const t_block *block)
-{
-    if (available(fp, block, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "nr=%d\n", block->nr);
-    }
-    return indent;
-}
-
-static int pr_blocka_title(FILE *fp, int indent, const char *title, const t_blocka *block)
-{
-    if (available(fp, block, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "nr=%d\n", block->nr);
-        pr_indent(fp, indent);
-        fprintf(fp, "nra=%d\n", block->nra);
-    }
-    return indent;
-}
-
-static void low_pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, gmx_bool bShowNumbers)
-{
-    int i;
-
-    if (available(fp, block, indent, title))
-    {
-        indent = pr_blocka_title(fp, indent, title, block);
-        for (i = 0; i <= block->nr; i++)
-        {
-            pr_indent(fp, indent+INDENT);
-            fprintf(fp, "%s->index[%d]=%d\n",
-                    title, bShowNumbers ? i : -1, block->index[i]);
-        }
-        for (i = 0; i < block->nra; i++)
-        {
-            pr_indent(fp, indent+INDENT);
-            fprintf(fp, "%s->a[%d]=%d\n",
-                    title, bShowNumbers ? i : -1, block->a[i]);
-        }
-    }
-}
-
-void pr_block(FILE *fp, int indent, const char *title, const t_block *block, gmx_bool bShowNumbers)
-{
-    int i, start;
-
-    if (available(fp, block, indent, title))
-    {
-        indent = pr_block_title(fp, indent, title, block);
-        start  = 0;
-        if (block->index[start] != 0)
-        {
-            fprintf(fp, "block->index[%d] should be 0\n", start);
-        }
-        else
-        {
-            for (i = 0; i < block->nr; i++)
-            {
-                int end  = block->index[i+1];
-                pr_indent(fp, indent);
-                if (end <= start)
-                {
-                    fprintf(fp, "%s[%d]={}\n", title, i);
-                }
-                else
-                {
-                    fprintf(fp, "%s[%d]={%d..%d}\n",
-                            title, bShowNumbers ? i : -1,
-                            bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
-                }
-                start = end;
-            }
-        }
-    }
-}
-
-void pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, gmx_bool bShowNumbers)
-{
-    int i, j, ok, size, start, end;
-
-    if (available(fp, block, indent, title))
-    {
-        indent = pr_blocka_title(fp, indent, title, block);
-        start  = 0;
-        end    = start;
-        if ((ok = (block->index[start] == 0)) == 0)
-        {
-            fprintf(fp, "block->index[%d] should be 0\n", start);
-        }
-        else
-        {
-            for (i = 0; i < block->nr; i++)
-            {
-                end  = block->index[i+1];
-                size = pr_indent(fp, indent);
-                if (end <= start)
-                {
-                    size += fprintf(fp, "%s[%d]={", title, i);
-                }
-                else
-                {
-                    size += fprintf(fp, "%s[%d][%d..%d]={",
-                                    title, bShowNumbers ? i : -1,
-                                    bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
-                }
-                for (j = start; j < end; j++)
-                {
-                    if (j > start)
-                    {
-                        size += fprintf(fp, ", ");
-                    }
-                    if ((size) > (USE_WIDTH))
-                    {
-                        fprintf(fp, "\n");
-                        size = pr_indent(fp, indent+INDENT);
-                    }
-                    size += fprintf(fp, "%d", block->a[j]);
-                }
-                fprintf(fp, "}\n");
-                start = end;
-            }
-        }
-        if ((end != block->nra) || (!ok))
-        {
-            pr_indent(fp, indent);
-            fprintf(fp, "tables inconsistent, dumping complete tables:\n");
-            low_pr_blocka(fp, indent, title, block, bShowNumbers);
-        }
-    }
-}
-
-static void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int n, gmx_bool bShowNumbers)
+void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int n, gmx_bool bShowNumbers)
 {
     int i;
 
@@ -1690,298 +1141,3 @@ static void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int
         }
     }
 }
-
-static void pr_strings2(FILE *fp, int indent, const char *title,
-                        char ***nm, char ***nmB, int n, gmx_bool bShowNumbers)
-{
-    int i;
-
-    if (available(fp, nm, indent, title))
-    {
-        indent = pr_title_n(fp, indent, title, n);
-        for (i = 0; i < n; i++)
-        {
-            pr_indent(fp, indent);
-            fprintf(fp, "%s[%d]={name=\"%s\",nameB=\"%s\"}\n",
-                    title, bShowNumbers ? i : -1, *(nm[i]), *(nmB[i]));
-        }
-    }
-}
-
-static void pr_resinfo(FILE *fp, int indent, const char *title, t_resinfo *resinfo, int n, gmx_bool bShowNumbers)
-{
-    int i;
-
-    if (available(fp, resinfo, indent, title))
-    {
-        indent = pr_title_n(fp, indent, title, n);
-        for (i = 0; i < n; i++)
-        {
-            pr_indent(fp, indent);
-            fprintf(fp, "%s[%d]={name=\"%s\", nr=%d, ic='%c'}\n",
-                    title, bShowNumbers ? i : -1,
-                    *(resinfo[i].name), resinfo[i].nr,
-                    (resinfo[i].ic == '\0') ? ' ' : resinfo[i].ic);
-        }
-    }
-}
-
-static void pr_atom(FILE *fp, int indent, const char *title, const t_atom *atom, int n)
-{
-    int i;
-
-    if (available(fp, atom, indent, title))
-    {
-        indent = pr_title_n(fp, indent, title, n);
-        for (i = 0; i < n; i++)
-        {
-            pr_indent(fp, indent);
-            fprintf(fp, "%s[%6d]={type=%3d, typeB=%3d, ptype=%8s, m=%12.5e, "
-                    "q=%12.5e, mB=%12.5e, qB=%12.5e, resind=%5d, atomnumber=%3d}\n",
-                    title, i, atom[i].type, atom[i].typeB, ptype_str[atom[i].ptype],
-                    atom[i].m, atom[i].q, atom[i].mB, atom[i].qB,
-                    atom[i].resind, atom[i].atomnumber);
-        }
-    }
-}
-
-static void pr_grps(FILE *fp, const char *title, const t_grps grps[], char **grpname[])
-{
-    int i, j;
-
-    for (i = 0; (i < egcNR); i++)
-    {
-        fprintf(fp, "%s[%-12s] nr=%d, name=[", title, gtypes[i], grps[i].nr);
-        for (j = 0; (j < grps[i].nr); j++)
-        {
-            fprintf(fp, " %s", *(grpname[grps[i].nm_ind[j]]));
-        }
-        fprintf(fp, "]\n");
-    }
-}
-
-static void pr_groups(FILE *fp, int indent,
-                      const gmx_groups_t *groups,
-                      gmx_bool bShowNumbers)
-{
-    int nat_max, i, g;
-
-    pr_grps(fp, "grp", groups->grps, groups->grpname);
-    pr_strings(fp, indent, "grpname", groups->grpname, groups->ngrpname, bShowNumbers);
-
-    pr_indent(fp, indent);
-    fprintf(fp, "groups          ");
-    for (g = 0; g < egcNR; g++)
-    {
-        printf(" %5.5s", gtypes[g]);
-    }
-    printf("\n");
-
-    pr_indent(fp, indent);
-    fprintf(fp, "allocated       ");
-    nat_max = 0;
-    for (g = 0; g < egcNR; g++)
-    {
-        printf(" %5d", groups->ngrpnr[g]);
-        nat_max = std::max(nat_max, groups->ngrpnr[g]);
-    }
-    printf("\n");
-
-    if (nat_max == 0)
-    {
-        pr_indent(fp, indent);
-        fprintf(fp, "groupnr[%5s] =", "*");
-        for (g = 0; g < egcNR; g++)
-        {
-            fprintf(fp, "  %3d ", 0);
-        }
-        fprintf(fp, "\n");
-    }
-    else
-    {
-        for (i = 0; i < nat_max; i++)
-        {
-            pr_indent(fp, indent);
-            fprintf(fp, "groupnr[%5d] =", i);
-            for (g = 0; g < egcNR; g++)
-            {
-                fprintf(fp, "  %3d ",
-                        groups->grpnr[g] ? groups->grpnr[g][i] : 0);
-            }
-            fprintf(fp, "\n");
-        }
-    }
-}
-
-void pr_atoms(FILE *fp, int indent, const char *title, const t_atoms *atoms,
-              gmx_bool bShownumbers)
-{
-    if (available(fp, atoms, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_atom(fp, indent, "atom", atoms->atom, atoms->nr);
-        pr_strings(fp, indent, "atom", atoms->atomname, atoms->nr, bShownumbers);
-        pr_strings2(fp, indent, "type", atoms->atomtype, atoms->atomtypeB, atoms->nr, bShownumbers);
-        pr_resinfo(fp, indent, "residue", atoms->resinfo, atoms->nres, bShownumbers);
-    }
-}
-
-
-void pr_atomtypes(FILE *fp, int indent, const char *title, const t_atomtypes *atomtypes,
-                  gmx_bool bShowNumbers)
-{
-    int i;
-    if (available(fp, atomtypes, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        for (i = 0; i < atomtypes->nr; i++)
-        {
-            pr_indent(fp, indent);
-            fprintf(fp,
-                    "atomtype[%3d]={radius=%12.5e, volume=%12.5e, gb_radius=%12.5e, surftens=%12.5e, atomnumber=%4d, S_hct=%12.5e)}\n",
-                    bShowNumbers ? i : -1, atomtypes->radius[i], atomtypes->vol[i],
-                    atomtypes->gb_radius[i],
-                    atomtypes->surftens[i], atomtypes->atomnumber[i], atomtypes->S_hct[i]);
-        }
-    }
-}
-
-static void pr_moltype(FILE *fp, int indent, const char *title,
-                       const gmx_moltype_t *molt, int n,
-                       const gmx_ffparams_t *ffparams,
-                       gmx_bool bShowNumbers)
-{
-    int j;
-
-    indent = pr_title_n(fp, indent, title, n);
-    pr_indent(fp, indent);
-    fprintf(fp, "name=\"%s\"\n", *(molt->name));
-    pr_atoms(fp, indent, "atoms", &(molt->atoms), bShowNumbers);
-    pr_block(fp, indent, "cgs", &molt->cgs, bShowNumbers);
-    pr_blocka(fp, indent, "excls", &molt->excls, bShowNumbers);
-    for (j = 0; (j < F_NRE); j++)
-    {
-        pr_ilist(fp, indent, interaction_function[j].longname,
-                 ffparams->functype, &molt->ilist[j], bShowNumbers);
-    }
-}
-
-static void pr_molblock(FILE *fp, int indent, const char *title,
-                        const gmx_molblock_t *molb, int n,
-                        const gmx_moltype_t *molt)
-{
-    indent = pr_title_n(fp, indent, title, n);
-    pr_indent(fp, indent);
-    fprintf(fp, "%-20s = %d \"%s\"\n",
-            "moltype", molb->type, *(molt[molb->type].name));
-    pr_int(fp, indent, "#molecules", molb->nmol);
-    pr_int(fp, indent, "#atoms_mol", molb->natoms_mol);
-    pr_int(fp, indent, "#posres_xA", molb->nposres_xA);
-    if (molb->nposres_xA > 0)
-    {
-        pr_rvecs(fp, indent, "posres_xA", molb->posres_xA, molb->nposres_xA);
-    }
-    pr_int(fp, indent, "#posres_xB", molb->nposres_xB);
-    if (molb->nposres_xB > 0)
-    {
-        pr_rvecs(fp, indent, "posres_xB", molb->posres_xB, molb->nposres_xB);
-    }
-}
-
-void pr_mtop(FILE *fp, int indent, const char *title, const gmx_mtop_t *mtop,
-             gmx_bool bShowNumbers)
-{
-    int mt, mb, j;
-
-    if (available(fp, mtop, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "name=\"%s\"\n", *(mtop->name));
-        pr_int(fp, indent, "#atoms", mtop->natoms);
-        pr_int(fp, indent, "#molblock", mtop->nmolblock);
-        for (mb = 0; mb < mtop->nmolblock; mb++)
-        {
-            pr_molblock(fp, indent, "molblock", &mtop->molblock[mb], mb, mtop->moltype);
-        }
-        pr_str(fp, indent, "bIntermolecularInteractions", EBOOL(mtop->bIntermolecularInteractions));
-        if (mtop->bIntermolecularInteractions)
-        {
-            for (j = 0; (j < F_NRE); j++)
-            {
-                pr_ilist(fp, indent, interaction_function[j].longname,
-                         mtop->ffparams.functype,
-                         &mtop->intermolecular_ilist[j], bShowNumbers);
-            }
-        }
-        pr_ffparams(fp, indent, "ffparams", &(mtop->ffparams), bShowNumbers);
-        pr_atomtypes(fp, indent, "atomtypes", &(mtop->atomtypes), bShowNumbers);
-        for (mt = 0; mt < mtop->nmoltype; mt++)
-        {
-            pr_moltype(fp, indent, "moltype", &mtop->moltype[mt], mt,
-                       &mtop->ffparams, bShowNumbers);
-        }
-        pr_groups(fp, indent, &mtop->groups, bShowNumbers);
-    }
-}
-
-void pr_top(FILE *fp, int indent, const char *title, const t_topology *top, gmx_bool bShowNumbers)
-{
-    if (available(fp, top, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "name=\"%s\"\n", *(top->name));
-        pr_atoms(fp, indent, "atoms", &(top->atoms), bShowNumbers);
-        pr_atomtypes(fp, indent, "atomtypes", &(top->atomtypes), bShowNumbers);
-        pr_block(fp, indent, "cgs", &top->cgs, bShowNumbers);
-        pr_block(fp, indent, "mols", &top->mols, bShowNumbers);
-        pr_str(fp, indent, "bIntermolecularInteractions", EBOOL(top->bIntermolecularInteractions));
-        pr_blocka(fp, indent, "excls", &top->excls, bShowNumbers);
-        pr_idef(fp, indent, "idef", &top->idef, bShowNumbers);
-    }
-}
-
-void pr_header(FILE *fp, int indent, const char *title, const t_tpxheader *sh)
-{
-    if (available(fp, sh, indent, title))
-    {
-        indent = pr_title(fp, indent, title);
-        pr_indent(fp, indent);
-        fprintf(fp, "bIr    = %spresent\n", sh->bIr ? "" : "not ");
-        pr_indent(fp, indent);
-        fprintf(fp, "bBox   = %spresent\n", sh->bBox ? "" : "not ");
-        pr_indent(fp, indent);
-        fprintf(fp, "bTop   = %spresent\n", sh->bTop ? "" : "not ");
-        pr_indent(fp, indent);
-        fprintf(fp, "bX     = %spresent\n", sh->bX ? "" : "not ");
-        pr_indent(fp, indent);
-        fprintf(fp, "bV     = %spresent\n", sh->bV ? "" : "not ");
-        pr_indent(fp, indent);
-        fprintf(fp, "bF     = %spresent\n", sh->bF ? "" : "not ");
-
-        pr_indent(fp, indent);
-        fprintf(fp, "natoms = %d\n", sh->natoms);
-        pr_indent(fp, indent);
-        fprintf(fp, "lambda = %e\n", sh->lambda);
-    }
-}
-
-void pr_commrec(FILE *fp, int indent, const t_commrec *cr)
-{
-    pr_indent(fp, indent);
-    fprintf(fp, "commrec:\n");
-    indent += 2;
-    pr_indent(fp, indent);
-    fprintf(fp, "rank      = %d\n", cr->nodeid);
-    pr_indent(fp, indent);
-    fprintf(fp, "number of ranks = %d\n", cr->nnodes);
-    pr_indent(fp, indent);
-    fprintf(fp, "PME-only ranks = %d\n", cr->npmenodes);
-    /*
-       pr_indent(fp,indent);
-       fprintf(fp,"threadid  = %d\n",cr->threadid);
-       pr_indent(fp,indent);
-       fprintf(fp,"nthreads  = %d\n",cr->nthreads);
-     */
-}
index 0e0cc2770096c17933523135ae62675ed22b1d57..6bd954c1694317e42a110442a4e997552867df21 100644 (file)
 
 #include <cstdio>
 
-#include "gromacs/topology/idef.h"
+#include "gromacs/math/vectypes.h"
 #include "gromacs/utility/basedefinitions.h"
 
-struct gmx_mtop_t;
-struct t_atoms;
-struct t_atomtypes;
-struct t_block;
-struct t_blocka;
-struct t_commrec;
-struct t_idef;
 struct t_inputrec;
-struct t_topology;
-struct t_tpxheader;
 
 #define LINE_WIDTH  80
 #define RMARGIN     10
@@ -67,41 +58,19 @@ void pr_ivec(FILE *fp, int indent, const char *title, const int vec[], int n, gm
 void pr_ivecs(FILE *fp, int indent, const char *title, const ivec vec[], int n, gmx_bool bShowNumbers);
 void pr_bvec(FILE *fp, int indent, const char *title, const gmx_bool vec[], int n, gmx_bool bShowNnumbers);
 void pr_rvec(FILE *fp, int indent, const char *title, const real vec[], int n, gmx_bool bShowNumbers);
-void pr_rvecs_of_dim(FILE *fp, int indent, const char *title, rvec vec[], int n, int dim);
+void pr_rvecs_of_dim(FILE *fp, int indent, const char *title, const rvec vec[], int n, int dim);
 void pr_dvec(FILE *fp, int indent, const char *title, const double vec[], int n, gmx_bool bShowNumbers);
 void pr_rvecs(FILE *fp, int indent, const char *title, const rvec vec[], int n);
 void pr_rvecs_len(FILE *fp, int indent, const char *title, const rvec vec[], int n);
 void pr_reals(FILE *fp, int indent, const char *title, const real vec[], int n);
 void pr_doubles(FILE *fp, int indent, const char *title, const double *vec, int n);
 void pr_reals_of_dim(FILE *fp, int indent, const char *title, const real *vec, int n, int dim);
-void pr_block(FILE *fp, int indent, const char *title, const t_block *block, gmx_bool bShowNumbers);
-void pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, gmx_bool bShowNumbers);
-void pr_ilist(FILE *fp, int indent, const char *title,
-              const t_functype *functype, const t_ilist *ilist, gmx_bool bShowNumbers);
-void pr_iparams(FILE *fp, t_functype ftype, const t_iparams *iparams);
-void pr_idef(FILE *fp, int indent, const char *title, const t_idef *idef, gmx_bool bShowNumbers);
+void pr_int(FILE *fp, int indent, const char *title, int i);
+void pr_real(FILE *fp, int indent, const char *title, real r);
+void pr_double(FILE *fp, int indent, const char *title, double d);
+void pr_str(FILE *fp, int indent, const char *title, const char *s);
+void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int n, gmx_bool bShowNumbers);
 void pr_inputrec(FILE *fp, int indent, const char *title, const t_inputrec *ir,
                  gmx_bool bMDPformat);
-void pr_atoms(FILE *fp, int indent, const char *title, const t_atoms *atoms,
-              gmx_bool bShownumbers);
-void pr_atomtypes(FILE *fp, int indent, const char *title,
-                  t_atomtypes *atomtypes, gmx_bool bShowNumbers);
-void pr_mtop(FILE *fp, int indent, const char *title, const gmx_mtop_t *mtop,
-             gmx_bool bShowNumbers);
-void pr_top(FILE *fp, int indent, const char *title, const t_topology *top, gmx_bool bShowNumbers);
-/*
- * This routine prints out a (human) readable representation of
- * the topology to the file fp. Ident specifies the number of
- * spaces the text should be indented. Title is used to print a
- * header text.
- */
-void pr_header(FILE *fp, int indent, const char *title, const t_tpxheader *sh);
-/*
- * This routine prints out a (human) readable representation of
- * a header to the file fp. Ident specifies the number of spaces
- * the text should be indented. Title is used to print a header text.
- */
-
-void pr_commrec(FILE *fp, int indent, const struct t_commrec *cr);
 
-#endif  /* GMX_FILEIO_TXTDUMP_H */
+#endif
index 73ca2c4157cc68afede46c4c29d7ff5912755a9f..3035f1f772b88984550b985cc7aa5f2f32871d59 100644 (file)
@@ -49,7 +49,6 @@
 #include "gromacs/fileio/pdbio.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/eigio.h"
 #include "gromacs/gmxana/gmx_ana.h"
index 308efc61fc6544e5a7ab114a965b12ad77d9631f..2c4d9051bd382447650d183f6d92d51b23591d08 100644 (file)
@@ -46,7 +46,6 @@
 #include "gromacs/correlationfunctions/expfit.h"
 #include "gromacs/correlationfunctions/integrate.h"
 #include "gromacs/fileio/copyrite.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index d4126b2d6647d07ba3da4ab4caf9b06d5cee30e2..af4fce1bb08a8a5afef1d2481a41ee2b7bb27b35 100644 (file)
@@ -48,7 +48,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/matio.h"
 #include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index 02f568bc23a6257717a5f75017c4cc20c8c47bd5..8331050f469f4673b882b9ac8065b7bdcb56340e 100644 (file)
@@ -47,7 +47,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/groio.h"
 #include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/math/do_fit.h"
 #include "gromacs/math/vec.h"
index be52559b317f2171c8f08695d57ac179f0ca6062..b7ee514a5697bfc952d34f2463949ae537b7e774 100644 (file)
@@ -43,7 +43,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/matio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/eigio.h"
 #include "gromacs/gmxana/gmx_ana.h"
index 6fcfcdb5d649bb101ba5a21c6b997ae7abddf0f7..1fba1d92c92b2681036bf7f8458c4b075f8a7b86 100644 (file)
@@ -44,7 +44,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/matio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
 #include "gromacs/math/vec.h"
index e6629a7864ee4746bed82c19ae0136e3789915f0..d94899a28c1c162cb8b4c27138425ae45f481008 100644 (file)
@@ -49,7 +49,6 @@
 #include "gromacs/fileio/gmxfio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/math/units.h"
index 0003636d7142e8095817a66268dd6e0ced1cd221..4ce459f3679f62a2367a132cc7fb9fe6c9652c09 100644 (file)
@@ -47,7 +47,6 @@
 #include "gromacs/fileio/pdbio.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/princ.h"
 #include "gromacs/gmxlib/conformation-utilities.h"
index 07eafbd87db7a945256f41c13b82519a0107acd6..548b6c4d51b3dab34b927c60caac6c41d62c45e0 100644 (file)
@@ -54,7 +54,6 @@
 #include "gromacs/fileio/matio.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index a6e813e5df154a2ec892bcfef2e2627ef9d68075..10854e2a92cf2a4221509a9ca0e7255bdb3a26fe 100644 (file)
@@ -44,7 +44,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/fitahx.h"
 #include "gromacs/gmxana/gmx_ana.h"
index 50b98ed6a425dd64d04af95e288cfed6ffa77103..5f5c2ac33622eec47c3e86deb3000a0fd4a33a02 100644 (file)
@@ -45,7 +45,6 @@
 #include "gromacs/commandline/viewit.h"
 #include "gromacs/fileio/enxio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index ce0cdb69acdf51cb9940047d2b360e013f65e984..f92fba58955cb39b938e9baad1ba1c1b1c073994 100644 (file)
@@ -46,7 +46,6 @@
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/eigio.h"
 #include "gromacs/gmxana/gmx_ana.h"
index 725bce3b37449b46af2882fc889d2904937c6f60..1fc7e3caa5498a54192dabcfd1c27d763aa1ec74 100644 (file)
@@ -43,7 +43,6 @@
 #include "gromacs/fileio/copyrite.h"
 #include "gromacs/fileio/mtxio.h"
 #include "gromacs/fileio/tpxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/eigio.h"
 #include "gromacs/gmxana/gmx_ana.h"
index e7a3852e55818dc39e30014c866a2a0847041ad4..b4e9b0f922a0f588cf88c72dad5c425f3276356b 100644 (file)
@@ -43,7 +43,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/pdbio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxana/eigio.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/math/units.h"
index 1078454e64a6e3ba6a6d008372bd5ca57d14e4fe..e48aaba91cad3b432a681163e3e35d6832433339 100644 (file)
@@ -45,7 +45,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/pdbio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxana/eigio.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/math/units.h"
index 05f95fb693a42ae4df7267c98ad8d725907226d1..4ee39c9836e43879c3030e214e5c3e42404ba8ed 100644 (file)
@@ -42,7 +42,6 @@
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index f4b731a0e5112c6d8b3592f0b06461863e2b64ea..749a211888e76e4c4b826de35c56418a3a938290 100644 (file)
@@ -45,7 +45,6 @@
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/matio.h"
 #include "gromacs/fileio/pdbio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index 35ff26694c92dc7197696ed4801d6cd619cd2162..d92120eddce7dcfec1408cfbd1ff9b046d67cd00 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/commandline/viewit.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/math/units.h"
index 7919a52903af3d845141b5164dfaeefee01ab90a..09295d85e4f0a677edc6582d245efaaa5c87d06c 100644 (file)
@@ -47,7 +47,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index c9767a9ece3a6ee2b4a039606bdfc508744ad117..1a4799edd9996e7484c260bf7b72d8c7926fbbac 100644 (file)
@@ -44,7 +44,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/math/vec.h"
index 7fcc9f31b360eaa09adecc04c99bb8d848bb4749..62d14b9449b9ec6c823c63fd34d945010efd8305 100644 (file)
@@ -47,7 +47,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxana/gmx_ana.h"
 #include "gromacs/gmxana/gstat.h"
index 223189103601b33b0b9f3bfee11227113d709306..2e50f914c5accd0db82d0cd548df263257679c25 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <cmath>
 
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/linearalgebra/nrjac.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/topology/topology.h"
index 890601cec924a77160217e70c5d1e06b23fd91f7..9abe418d64d0656633bd65246d7c0bd79c14cae1 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "thread_mpi/threads.h"
 
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/gmxlib/nonbonded/nb_free_energy.h"
 #include "gromacs/gmxlib/nonbonded/nb_generic.h"
index 3f6636519cb6c1089145a2f4132e851e0794ae37..a9bf81d310b55e249928c1b13e61606d968ef67c 100644 (file)
@@ -41,7 +41,6 @@
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/readinp.h"
 #include "gromacs/math/3dtransforms.h"
 #include "gromacs/math/utilities.h"
index d4e9a2a0006a1f6ec2e568110865bf43901067b9..53aa3136c42d9e8b1347e85088072e7cd3c7ead8 100644 (file)
@@ -54,7 +54,6 @@
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/calcgrid.h"
 #include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/gmxlib/splitter.h"
index 9c69c9f2ce2e78f02d659330eb58235b09515299..3f14d74c55d3a6c434404d2724c47ce98c373581 100644 (file)
@@ -44,7 +44,6 @@
 #include <algorithm>
 
 #include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/readinp.h"
 #include "gromacs/gmxpreprocess/fflibutil.h"
 #include "gromacs/gmxpreprocess/gpp_atomtype.h"
index 303bb9775f3b2662bdf525aec016a14cc985b8bf..c9c4e9877e88d67ba6692b580664f952a5a61c4d 100644 (file)
@@ -49,7 +49,6 @@
 #include <sys/types.h>
 
 #include "gromacs/fileio/gmxfio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/gmxlib/warninp.h"
 #include "gromacs/gmxpreprocess/gmxcpp.h"
index 4ba5d93ff0a0eacb6389a3a6777239b76745acba..f79f9f375599b6dd039a6cc6c6f0a0201d92e30a 100644 (file)
@@ -43,7 +43,6 @@
 #include "gromacs/domdec/domdec.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/gmxfio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xtcio.h"
 #include "gromacs/gmxlib/chargegroup.h"
 #include "gromacs/gmxlib/disre.h"
index 342654d906eb47f82959de7a5cf39180963785d8..225acfd0c1c6e38483868e77ef3ee3389d528312 100644 (file)
@@ -54,7 +54,6 @@
 #include "gromacs/fileio/copyrite.h"
 #include "gromacs/fileio/filetypes.h"
 #include "gromacs/fileio/trx.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/gmx_detect_hardware.h"
 #include "gromacs/gmxlib/gmx_omp_nthreads.h"
 #include "gromacs/gmxlib/md_logging.h"
index 2e660666d426c825dc627f24dd2f1a820d65dfef..2b64a8c6f7bfa301c93f0dd93413a51322b59409 100644 (file)
@@ -60,7 +60,6 @@
 #include "gromacs/ewald/pme.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/mtxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/gmx_omp_nthreads.h"
 #include "gromacs/gmxlib/md_logging.h"
 #include "gromacs/gmxlib/network.h"
index f657aa43c2f26bc175a490735cf197264dc03979..0063929c7ac3514ac1355cd236e9aa5ae03d1f60 100644 (file)
@@ -46,7 +46,6 @@
 #include <string.h>
 
 #include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/units.h"
index ede5fb8da40e39ff7b56211813b351cefa9d89ac..76cbd9fe481f33d3415422ae236f482849c732ec 100644 (file)
@@ -46,7 +46,6 @@
 #include <string.h>
 
 #include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/units.h"
index 74fdfada88a85aa2fb7c7b9b5b00dbd53e5dc1da..525fcc02380a616ce9039d5b0594a04dd4c68800 100644 (file)
@@ -46,7 +46,6 @@
 #include <string.h>
 
 #include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/units.h"
index 5293f90c9cf49ad6666d98a8d4a77975eb09a248..b0cf841c9ff063e7ce52ac18d56e870e3a39a5a4 100644 (file)
@@ -42,7 +42,6 @@
 #include <string.h>
 
 #include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/units.h"
index 268168a96a6f1e348f4472072e6c02068be972fd..ab15075f9bea95d8bb5a3d86a41201ee3d48f549 100644 (file)
@@ -51,7 +51,6 @@
 
 #include "gromacs/domdec/domdec_struct.h"
 #include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/units.h"
index c84fe5ced7e3e943a666b6197868da17925d2b45..5dad928503d4fbb45464b1dfc973f8bb6575c9d6 100644 (file)
@@ -38,7 +38,6 @@
 
 #include <math.h>
 
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/nrnb.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/mdlib/constr.h"
index af79635b1a271495c9ad1f24da8b32c281f087b4..521f380512971f23e38007d11f1002d8b454bf62 100644 (file)
@@ -42,7 +42,6 @@
 #include "gromacs/domdec/domdec.h"
 #include "gromacs/domdec/domdec_struct.h"
 #include "gromacs/fileio/checkpoint.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xtcio.h"
 #include "gromacs/gmxlib/network.h"
 #include "gromacs/math/utilities.h"
index baca4d60f7dcaab67f4bb645b8c93dd3cc4ead14..b94c823d6e35c156917a1fe845439afd9d8b63e3 100644 (file)
@@ -58,7 +58,6 @@
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xvgr.h"
 #include "gromacs/gmxlib/chargegroup.h"
 #include "gromacs/gmxlib/conformation-utilities.h"
index 920f2c9606c60ffe776913a45d7b22602f3cd9e6..14d1f3ebc79fd44cc4c728a29a7dca23c335143e 100644 (file)
@@ -47,7 +47,6 @@
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/fileio/xtcio.h"
 #include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/math/units.h"
index 7a5d327edd7af7e1ee66d1b7242b99c84dc9ce8e..5c7bf3491f1c3fffae142ca8d345486aa68c56c9 100644 (file)
@@ -48,7 +48,6 @@
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trx.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/mdtypes/pull-params.h"
index a01a87e277d4708d9d5fcde8f096f8fbde0c9723..30309902c2332f9d4b16726e3454043092f1cf2b 100644 (file)
@@ -107,7 +107,7 @@ static void list_tpx(const char *fn, gmx_bool bShowNumbers, const char *mdpfn,
             pr_title(stdout, indent, fn);
             pr_inputrec(stdout, 0, "inputrec", tpx.bIr ? &(ir) : NULL, FALSE);
 
-            pr_header(stdout, indent, "header", &(tpx));
+            pr_tpxheader(stdout, indent, "header", &(tpx));
 
             if (!bSysTop)
             {
index f252ffde6612bb9531057e50c34ed4370d26c582..1721ea65b8e0ea15c9ac8a2871415e7351c08c09 100644 (file)
 
 #include "atoms.h"
 
+#include <cstdio>
 #include <cstring>
 
+#include "gromacs/fileio/txtdump.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/smalloc.h"
 
@@ -222,3 +224,91 @@ void t_atoms_set_resinfo(t_atoms *atoms, int atom_ind, t_symtab *symtab,
     ri->chainnum = chainnum;
     ri->chainid  = chainid;
 }
+
+static void pr_atom(FILE *fp, int indent, const char *title, const t_atom *atom, int n)
+{
+    int i;
+
+    if (available(fp, atom, indent, title))
+    {
+        indent = pr_title_n(fp, indent, title, n);
+        for (i = 0; i < n; i++)
+        {
+            pr_indent(fp, indent);
+            fprintf(fp, "%s[%6d]={type=%3d, typeB=%3d, ptype=%8s, m=%12.5e, "
+                    "q=%12.5e, mB=%12.5e, qB=%12.5e, resind=%5d, atomnumber=%3d}\n",
+                    title, i, atom[i].type, atom[i].typeB, ptype_str[atom[i].ptype],
+                    atom[i].m, atom[i].q, atom[i].mB, atom[i].qB,
+                    atom[i].resind, atom[i].atomnumber);
+        }
+    }
+}
+
+static void pr_strings2(FILE *fp, int indent, const char *title,
+                        char ***nm, char ***nmB, int n, gmx_bool bShowNumbers)
+{
+    int i;
+
+    if (available(fp, nm, indent, title))
+    {
+        indent = pr_title_n(fp, indent, title, n);
+        for (i = 0; i < n; i++)
+        {
+            pr_indent(fp, indent);
+            fprintf(fp, "%s[%d]={name=\"%s\",nameB=\"%s\"}\n",
+                    title, bShowNumbers ? i : -1, *(nm[i]), *(nmB[i]));
+        }
+    }
+}
+
+static void pr_resinfo(FILE *fp, int indent, const char *title, const t_resinfo *resinfo, int n,
+                       gmx_bool bShowNumbers)
+{
+    int i;
+
+    if (available(fp, resinfo, indent, title))
+    {
+        indent = pr_title_n(fp, indent, title, n);
+        for (i = 0; i < n; i++)
+        {
+            pr_indent(fp, indent);
+            fprintf(fp, "%s[%d]={name=\"%s\", nr=%d, ic='%c'}\n",
+                    title, bShowNumbers ? i : -1,
+                    *(resinfo[i].name), resinfo[i].nr,
+                    (resinfo[i].ic == '\0') ? ' ' : resinfo[i].ic);
+        }
+    }
+}
+
+void pr_atoms(FILE *fp, int indent, const char *title, const t_atoms *atoms,
+              gmx_bool bShownumbers)
+{
+    if (available(fp, atoms, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_atom(fp, indent, "atom", atoms->atom, atoms->nr);
+        pr_strings(fp, indent, "atom", atoms->atomname, atoms->nr, bShownumbers);
+        pr_strings2(fp, indent, "type", atoms->atomtype, atoms->atomtypeB, atoms->nr, bShownumbers);
+        pr_resinfo(fp, indent, "residue", atoms->resinfo, atoms->nres, bShownumbers);
+    }
+}
+
+
+void pr_atomtypes(FILE *fp, int indent, const char *title, const t_atomtypes *atomtypes,
+                  gmx_bool bShowNumbers)
+{
+    int i;
+    if (available(fp, atomtypes, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        for (i = 0; i < atomtypes->nr; i++)
+        {
+            pr_indent(fp, indent);
+            fprintf(fp,
+                    "atomtype[%3d]={radius=%12.5e, volume=%12.5e, gb_radius=%12.5e, surftens=%12.5e, atomnumber=%4d, S_hct=%12.5e)}\n",
+                    bShowNumbers ? i : -1, atomtypes->radius[i], atomtypes->vol[i],
+                    atomtypes->gb_radius[i],
+                    atomtypes->surftens[i], atomtypes->atomnumber[i], atomtypes->S_hct[i]);
+        }
+    }
+}
index 764acf5f502b5d55436fa73e29d093db3d703479..fa317bc29a8186828432e827a0f8562fb1ae49aa 100644 (file)
@@ -37,6 +37,8 @@
 #ifndef GMX_TOPOLOGY_ATOMS_H
 #define GMX_TOPOLOGY_ATOMS_H
 
+#include <stdio.h>
+
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
 
@@ -146,6 +148,11 @@ void t_atoms_set_resinfo(t_atoms *atoms, int atom_ind, struct t_symtab *symtab,
  * of atom index atom_ind.
  */
 
+void pr_atoms(FILE *fp, int indent, const char *title, const t_atoms *atoms,
+              gmx_bool bShownumbers);
+void pr_atomtypes(FILE *fp, int indent, const char *title,
+                  const t_atomtypes *atomtypes, gmx_bool bShowNumbers);
+
 #ifdef __cplusplus
 }
 #endif
index c4b2e51c27d4c9484129b0b1a8a642190d2a2100..c8cb2acce4add418600231e653a6767ed8270aa6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
 
 #include "block.h"
 
+#include <cstdio>
+
 #include <algorithm>
 
+#include "gromacs/fileio/txtdump.h"
 #include "gromacs/utility/smalloc.h"
 
 void init_block(t_block *block)
@@ -154,3 +157,138 @@ void copy_blocka(const t_blocka *src, t_blocka *dest)
         dest->a[i] = src->a[i];
     }
 }
+
+static int pr_block_title(FILE *fp, int indent, const char *title, const t_block *block)
+{
+    if (available(fp, block, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "nr=%d\n", block->nr);
+    }
+    return indent;
+}
+
+static int pr_blocka_title(FILE *fp, int indent, const char *title, const t_blocka *block)
+{
+    if (available(fp, block, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "nr=%d\n", block->nr);
+        pr_indent(fp, indent);
+        fprintf(fp, "nra=%d\n", block->nra);
+    }
+    return indent;
+}
+
+static void low_pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, gmx_bool bShowNumbers)
+{
+    int i;
+
+    if (available(fp, block, indent, title))
+    {
+        indent = pr_blocka_title(fp, indent, title, block);
+        for (i = 0; i <= block->nr; i++)
+        {
+            pr_indent(fp, indent+INDENT);
+            fprintf(fp, "%s->index[%d]=%d\n",
+                    title, bShowNumbers ? i : -1, block->index[i]);
+        }
+        for (i = 0; i < block->nra; i++)
+        {
+            pr_indent(fp, indent+INDENT);
+            fprintf(fp, "%s->a[%d]=%d\n",
+                    title, bShowNumbers ? i : -1, block->a[i]);
+        }
+    }
+}
+
+void pr_block(FILE *fp, int indent, const char *title, const t_block *block, gmx_bool bShowNumbers)
+{
+    int i, start;
+
+    if (available(fp, block, indent, title))
+    {
+        indent = pr_block_title(fp, indent, title, block);
+        start  = 0;
+        if (block->index[start] != 0)
+        {
+            fprintf(fp, "block->index[%d] should be 0\n", start);
+        }
+        else
+        {
+            for (i = 0; i < block->nr; i++)
+            {
+                int end  = block->index[i+1];
+                pr_indent(fp, indent);
+                if (end <= start)
+                {
+                    fprintf(fp, "%s[%d]={}\n", title, i);
+                }
+                else
+                {
+                    fprintf(fp, "%s[%d]={%d..%d}\n",
+                            title, bShowNumbers ? i : -1,
+                            bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
+                }
+                start = end;
+            }
+        }
+    }
+}
+
+void pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, gmx_bool bShowNumbers)
+{
+    int i, j, ok, size, start, end;
+
+    if (available(fp, block, indent, title))
+    {
+        indent = pr_blocka_title(fp, indent, title, block);
+        start  = 0;
+        end    = start;
+        if ((ok = (block->index[start] == 0)) == 0)
+        {
+            fprintf(fp, "block->index[%d] should be 0\n", start);
+        }
+        else
+        {
+            for (i = 0; i < block->nr; i++)
+            {
+                end  = block->index[i+1];
+                size = pr_indent(fp, indent);
+                if (end <= start)
+                {
+                    size += fprintf(fp, "%s[%d]={", title, i);
+                }
+                else
+                {
+                    size += fprintf(fp, "%s[%d][%d..%d]={",
+                                    title, bShowNumbers ? i : -1,
+                                    bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
+                }
+                for (j = start; j < end; j++)
+                {
+                    if (j > start)
+                    {
+                        size += fprintf(fp, ", ");
+                    }
+                    if ((size) > (USE_WIDTH))
+                    {
+                        fprintf(fp, "\n");
+                        size = pr_indent(fp, indent+INDENT);
+                    }
+                    size += fprintf(fp, "%d", block->a[j]);
+                }
+                fprintf(fp, "}\n");
+                start = end;
+            }
+        }
+        if ((end != block->nra) || (!ok))
+        {
+            pr_indent(fp, indent);
+            fprintf(fp, "tables inconsistent, dumping complete tables:\n");
+            low_pr_blocka(fp, indent, title, block, bShowNumbers);
+        }
+    }
+}
index 196c661b7b25769cb0771d11a721d28020aa358d..d4bbe40c1321b87c463c994855000104f9f5e895 100644 (file)
@@ -37,6 +37,8 @@
 #ifndef GMX_TOPOLOGY_BLOCK_H
 #define GMX_TOPOLOGY_BLOCK_H
 
+#include <stdio.h>
+
 #include "gromacs/utility/basedefinitions.h"
 
 #ifdef __cplusplus
@@ -96,6 +98,9 @@ void stupid_fill_blocka(t_blocka *grp, int natom);
  * There is one atom per index entry
  */
 
+void pr_block(FILE *fp, int indent, const char *title, const t_block *block, gmx_bool bShowNumbers);
+void pr_blocka(FILE *fp, int indent, const char *title, const t_blocka *block, gmx_bool bShowNumbers);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gromacs/topology/idef.cpp b/src/gromacs/topology/idef.cpp
new file mode 100644 (file)
index 0000000..32d2142
--- /dev/null
@@ -0,0 +1,436 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#include "gmxpre.h"
+
+#include "idef.h"
+
+#include <cstdio>
+
+#include "gromacs/fileio/txtdump.h"
+#include "gromacs/gmxlib/ifunc.h"
+#include "gromacs/utility/fatalerror.h"
+
+static void pr_harm(FILE *fp, const t_iparams *iparams, const char *r, const char *kr)
+{
+    fprintf(fp, "%sA=%12.5e, %sA=%12.5e, %sB=%12.5e, %sB=%12.5e\n",
+            r, iparams->harmonic.rA, kr, iparams->harmonic.krA,
+            r, iparams->harmonic.rB, kr, iparams->harmonic.krB);
+}
+
+void pr_iparams(FILE *fp, t_functype ftype, const t_iparams *iparams)
+{
+    switch (ftype)
+    {
+        case F_ANGLES:
+        case F_G96ANGLES:
+            pr_harm(fp, iparams, "th", "ct");
+            break;
+        case F_CROSS_BOND_BONDS:
+            fprintf(fp, "r1e=%15.8e, r2e=%15.8e, krr=%15.8e\n",
+                    iparams->cross_bb.r1e, iparams->cross_bb.r2e,
+                    iparams->cross_bb.krr);
+            break;
+        case F_CROSS_BOND_ANGLES:
+            fprintf(fp, "r1e=%15.8e, r1e=%15.8e, r3e=%15.8e, krt=%15.8e\n",
+                    iparams->cross_ba.r1e, iparams->cross_ba.r2e,
+                    iparams->cross_ba.r3e, iparams->cross_ba.krt);
+            break;
+        case F_LINEAR_ANGLES:
+            fprintf(fp, "klinA=%15.8e, aA=%15.8e, klinB=%15.8e, aB=%15.8e\n",
+                    iparams->linangle.klinA, iparams->linangle.aA,
+                    iparams->linangle.klinB, iparams->linangle.aB);
+            break;
+        case F_UREY_BRADLEY:
+            fprintf(fp, "thetaA=%15.8e, kthetaA=%15.8e, r13A=%15.8e, kUBA=%15.8e, thetaB=%15.8e, kthetaB=%15.8e, r13B=%15.8e, kUBB=%15.8e\n", iparams->u_b.thetaA, iparams->u_b.kthetaA, iparams->u_b.r13A, iparams->u_b.kUBA, iparams->u_b.thetaB, iparams->u_b.kthetaB, iparams->u_b.r13B, iparams->u_b.kUBB);
+            break;
+        case F_QUARTIC_ANGLES:
+            fprintf(fp, "theta=%15.8e", iparams->qangle.theta);
+            for (int i = 0; i < 5; i++)
+            {
+                fprintf(fp, ", c%c=%15.8e", '0'+i, iparams->qangle.c[i]);
+            }
+            fprintf(fp, "\n");
+            break;
+        case F_BHAM:
+            fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
+                    iparams->bham.a, iparams->bham.b, iparams->bham.c);
+            break;
+        case F_BONDS:
+        case F_G96BONDS:
+        case F_HARMONIC:
+            pr_harm(fp, iparams, "b0", "cb");
+            break;
+        case F_IDIHS:
+            pr_harm(fp, iparams, "xi", "cx");
+            break;
+        case F_MORSE:
+            fprintf(fp, "b0A=%15.8e, cbA=%15.8e, betaA=%15.8e, b0B=%15.8e, cbB=%15.8e, betaB=%15.8e\n",
+                    iparams->morse.b0A, iparams->morse.cbA, iparams->morse.betaA,
+                    iparams->morse.b0B, iparams->morse.cbB, iparams->morse.betaB);
+            break;
+        case F_CUBICBONDS:
+            fprintf(fp, "b0=%15.8e, kb=%15.8e, kcub=%15.8e\n",
+                    iparams->cubic.b0, iparams->cubic.kb, iparams->cubic.kcub);
+            break;
+        case F_CONNBONDS:
+            fprintf(fp, "\n");
+            break;
+        case F_FENEBONDS:
+            fprintf(fp, "bm=%15.8e, kb=%15.8e\n", iparams->fene.bm, iparams->fene.kb);
+            break;
+        case F_RESTRBONDS:
+            fprintf(fp, "lowA=%15.8e, up1A=%15.8e, up2A=%15.8e, kA=%15.8e, lowB=%15.8e, up1B=%15.8e, up2B=%15.8e, kB=%15.8e,\n",
+                    iparams->restraint.lowA, iparams->restraint.up1A,
+                    iparams->restraint.up2A, iparams->restraint.kA,
+                    iparams->restraint.lowB, iparams->restraint.up1B,
+                    iparams->restraint.up2B, iparams->restraint.kB);
+            break;
+        case F_TABBONDS:
+        case F_TABBONDSNC:
+        case F_TABANGLES:
+        case F_TABDIHS:
+            fprintf(fp, "tab=%d, kA=%15.8e, kB=%15.8e\n",
+                    iparams->tab.table, iparams->tab.kA, iparams->tab.kB);
+            break;
+        case F_POLARIZATION:
+            fprintf(fp, "alpha=%15.8e\n", iparams->polarize.alpha);
+            break;
+        case F_ANHARM_POL:
+            fprintf(fp, "alpha=%15.8e drcut=%15.8e khyp=%15.8e\n",
+                    iparams->anharm_polarize.alpha,
+                    iparams->anharm_polarize.drcut,
+                    iparams->anharm_polarize.khyp);
+            break;
+        case F_THOLE_POL:
+            fprintf(fp, "a=%15.8e, alpha1=%15.8e, alpha2=%15.8e, rfac=%15.8e\n",
+                    iparams->thole.a, iparams->thole.alpha1, iparams->thole.alpha2,
+                    iparams->thole.rfac);
+            break;
+        case F_WATER_POL:
+            fprintf(fp, "al_x=%15.8e, al_y=%15.8e, al_z=%15.8e, rOH=%9.6f, rHH=%9.6f, rOD=%9.6f\n",
+                    iparams->wpol.al_x, iparams->wpol.al_y, iparams->wpol.al_z,
+                    iparams->wpol.rOH, iparams->wpol.rHH, iparams->wpol.rOD);
+            break;
+        case F_LJ:
+            fprintf(fp, "c6=%15.8e, c12=%15.8e\n", iparams->lj.c6, iparams->lj.c12);
+            break;
+        case F_LJ14:
+            fprintf(fp, "c6A=%15.8e, c12A=%15.8e, c6B=%15.8e, c12B=%15.8e\n",
+                    iparams->lj14.c6A, iparams->lj14.c12A,
+                    iparams->lj14.c6B, iparams->lj14.c12B);
+            break;
+        case F_LJC14_Q:
+            fprintf(fp, "fqq=%15.8e, qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
+                    iparams->ljc14.fqq,
+                    iparams->ljc14.qi, iparams->ljc14.qj,
+                    iparams->ljc14.c6, iparams->ljc14.c12);
+            break;
+        case F_LJC_PAIRS_NB:
+            fprintf(fp, "qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
+                    iparams->ljcnb.qi, iparams->ljcnb.qj,
+                    iparams->ljcnb.c6, iparams->ljcnb.c12);
+            break;
+        case F_PDIHS:
+        case F_PIDIHS:
+        case F_ANGRES:
+        case F_ANGRESZ:
+            fprintf(fp, "phiA=%15.8e, cpA=%15.8e, phiB=%15.8e, cpB=%15.8e, mult=%d\n",
+                    iparams->pdihs.phiA, iparams->pdihs.cpA,
+                    iparams->pdihs.phiB, iparams->pdihs.cpB,
+                    iparams->pdihs.mult);
+            break;
+        case F_DISRES:
+            fprintf(fp, "label=%4d, type=%1d, low=%15.8e, up1=%15.8e, up2=%15.8e, fac=%15.8e)\n",
+                    iparams->disres.label, iparams->disres.type,
+                    iparams->disres.low, iparams->disres.up1,
+                    iparams->disres.up2, iparams->disres.kfac);
+            break;
+        case F_ORIRES:
+            fprintf(fp, "ex=%4d, label=%d, power=%4d, c=%15.8e, obs=%15.8e, kfac=%15.8e)\n",
+                    iparams->orires.ex, iparams->orires.label, iparams->orires.power,
+                    iparams->orires.c, iparams->orires.obs, iparams->orires.kfac);
+            break;
+        case F_DIHRES:
+            fprintf(fp, "phiA=%15.8e, dphiA=%15.8e, kfacA=%15.8e, phiB=%15.8e, dphiB=%15.8e, kfacB=%15.8e\n",
+                    iparams->dihres.phiA, iparams->dihres.dphiA, iparams->dihres.kfacA,
+                    iparams->dihres.phiB, iparams->dihres.dphiB, iparams->dihres.kfacB);
+            break;
+        case F_POSRES:
+            fprintf(fp, "pos0A=(%15.8e,%15.8e,%15.8e), fcA=(%15.8e,%15.8e,%15.8e), pos0B=(%15.8e,%15.8e,%15.8e), fcB=(%15.8e,%15.8e,%15.8e)\n",
+                    iparams->posres.pos0A[XX], iparams->posres.pos0A[YY],
+                    iparams->posres.pos0A[ZZ], iparams->posres.fcA[XX],
+                    iparams->posres.fcA[YY], iparams->posres.fcA[ZZ],
+                    iparams->posres.pos0B[XX], iparams->posres.pos0B[YY],
+                    iparams->posres.pos0B[ZZ], iparams->posres.fcB[XX],
+                    iparams->posres.fcB[YY], iparams->posres.fcB[ZZ]);
+            break;
+        case F_FBPOSRES:
+            fprintf(fp, "pos0=(%15.8e,%15.8e,%15.8e), geometry=%d, r=%15.8e, k=%15.8e\n",
+                    iparams->fbposres.pos0[XX], iparams->fbposres.pos0[YY],
+                    iparams->fbposres.pos0[ZZ], iparams->fbposres.geom,
+                    iparams->fbposres.r,        iparams->fbposres.k);
+            break;
+        case F_RBDIHS:
+            for (int i = 0; i < NR_RBDIHS; i++)
+            {
+                fprintf(fp, "%srbcA[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcA[i]);
+            }
+            fprintf(fp, "\n");
+            for (int i = 0; i < NR_RBDIHS; i++)
+            {
+                fprintf(fp, "%srbcB[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcB[i]);
+            }
+            fprintf(fp, "\n");
+            break;
+        case F_FOURDIHS:
+        {
+            /* Use the OPLS -> Ryckaert-Bellemans formula backwards to get
+             * the OPLS potential constants back.
+             */
+            const real *rbcA = iparams->rbdihs.rbcA;
+            const real *rbcB = iparams->rbdihs.rbcB;
+            real        VA[4], VB[4];
+
+            VA[3] = -0.25*rbcA[4];
+            VA[2] = -0.5*rbcA[3];
+            VA[1] = 4.0*VA[3]-rbcA[2];
+            VA[0] = 3.0*VA[2]-2.0*rbcA[1];
+
+            VB[3] = -0.25*rbcB[4];
+            VB[2] = -0.5*rbcB[3];
+            VB[1] = 4.0*VB[3]-rbcB[2];
+            VB[0] = 3.0*VB[2]-2.0*rbcB[1];
+
+            for (int i = 0; i < NR_FOURDIHS; i++)
+            {
+                fprintf(fp, "%sFourA[%d]=%15.8e", i == 0 ? "" : ", ", i, VA[i]);
+            }
+            fprintf(fp, "\n");
+            for (int i = 0; i < NR_FOURDIHS; i++)
+            {
+                fprintf(fp, "%sFourB[%d]=%15.8e", i == 0 ? "" : ", ", i, VB[i]);
+            }
+            fprintf(fp, "\n");
+            break;
+        }
+
+        case F_CONSTR:
+        case F_CONSTRNC:
+            fprintf(fp, "dA=%15.8e, dB=%15.8e\n", iparams->constr.dA, iparams->constr.dB);
+            break;
+        case F_SETTLE:
+            fprintf(fp, "doh=%15.8e, dhh=%15.8e\n", iparams->settle.doh,
+                    iparams->settle.dhh);
+            break;
+        case F_VSITE2:
+            fprintf(fp, "a=%15.8e\n", iparams->vsite.a);
+            break;
+        case F_VSITE3:
+        case F_VSITE3FD:
+        case F_VSITE3FAD:
+            fprintf(fp, "a=%15.8e, b=%15.8e\n", iparams->vsite.a, iparams->vsite.b);
+            break;
+        case F_VSITE3OUT:
+        case F_VSITE4FD:
+        case F_VSITE4FDN:
+            fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
+                    iparams->vsite.a, iparams->vsite.b, iparams->vsite.c);
+            break;
+        case F_VSITEN:
+            fprintf(fp, "n=%2d, a=%15.8e\n", iparams->vsiten.n, iparams->vsiten.a);
+            break;
+        case F_GB12:
+        case F_GB13:
+        case F_GB14:
+            fprintf(fp, "sar=%15.8e, st=%15.8e, pi=%15.8e, gbr=%15.8e, bmlt=%15.8e\n", iparams->gb.sar, iparams->gb.st, iparams->gb.pi, iparams->gb.gbr, iparams->gb.bmlt);
+            break;
+        case F_CMAP:
+            fprintf(fp, "cmapA=%1d, cmapB=%1d\n", iparams->cmap.cmapA, iparams->cmap.cmapB);
+            break;
+        case  F_RESTRANGLES:
+            pr_harm(fp, iparams, "ktheta", "costheta0");
+            break;
+        case  F_RESTRDIHS:
+            fprintf(fp, "phiA=%15.8e, cpA=%15.8e",
+                    iparams->pdihs.phiA, iparams->pdihs.cpA);
+            break;
+        case  F_CBTDIHS:
+            fprintf(fp, "kphi=%15.8e", iparams->cbtdihs.cbtcA[0]);
+            for (int i = 1; i < NR_CBTDIHS; i++)
+            {
+                fprintf(fp, ", cbtcA[%d]=%15.8e", i-1, iparams->cbtdihs.cbtcA[i]);
+            }
+            fprintf(fp, "\n");
+            break;
+        default:
+            gmx_fatal(FARGS, "unknown function type %d (%s) in %s line %d",
+                      ftype, interaction_function[ftype].name, __FILE__, __LINE__);
+    }
+}
+
+void pr_ilist(FILE *fp, int indent, const char *title,
+              const t_functype *functype, const t_ilist *ilist, gmx_bool bShowNumbers)
+{
+    int      i, j, k, type, ftype;
+    t_iatom *iatoms;
+
+    if (available(fp, ilist, indent, title) && ilist->nr > 0)
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "nr: %d\n", ilist->nr);
+        if (ilist->nr > 0)
+        {
+            pr_indent(fp, indent);
+            fprintf(fp, "iatoms:\n");
+            iatoms = ilist->iatoms;
+            for (i = j = 0; i < ilist->nr; )
+            {
+#ifndef DEBUG
+                pr_indent(fp, indent+INDENT);
+                type  = *(iatoms++);
+                ftype = functype[type];
+                fprintf(fp, "%d type=%d (%s)",
+                        bShowNumbers ? j : -1, bShowNumbers ? type : -1,
+                        interaction_function[ftype].name);
+                j++;
+                for (k = 0; k < interaction_function[ftype].nratoms; k++)
+                {
+                    fprintf(fp, " %d", *(iatoms++));
+                }
+                fprintf(fp, "\n");
+                i += 1+interaction_function[ftype].nratoms;
+#else
+                fprintf(fp, "%5d%5d\n", i, iatoms[i]);
+                i++;
+#endif
+            }
+        }
+    }
+}
+
+static void pr_cmap(FILE *fp, int indent, const char *title,
+                    const gmx_cmap_t *cmap_grid, gmx_bool bShowNumbers)
+{
+    int  i, j, nelem;
+    real dx, idx;
+
+    dx    = 360.0 / cmap_grid->grid_spacing;
+    nelem = cmap_grid->grid_spacing*cmap_grid->grid_spacing;
+
+    if (available(fp, cmap_grid, indent, title))
+    {
+        fprintf(fp, "%s\n", title);
+
+        for (i = 0; i < cmap_grid->ngrid; i++)
+        {
+            idx = -180.0;
+            fprintf(fp, "%8s %8s %8s %8s\n", "V", "dVdx", "dVdy", "d2dV");
+
+            fprintf(fp, "grid[%3d]={\n", bShowNumbers ? i : -1);
+
+            for (j = 0; j < nelem; j++)
+            {
+                if ( (j%cmap_grid->grid_spacing) == 0)
+                {
+                    fprintf(fp, "%8.1f\n", idx);
+                    idx += dx;
+                }
+
+                fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4]);
+                fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+1]);
+                fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+2]);
+                fprintf(fp, "%8.3f\n", cmap_grid->cmapdata[i].cmap[j*4+3]);
+            }
+            fprintf(fp, "\n");
+        }
+    }
+
+}
+
+void pr_ffparams(FILE *fp, int indent, const char *title,
+                 const gmx_ffparams_t *ffparams,
+                 gmx_bool bShowNumbers)
+{
+    int i;
+
+    indent = pr_title(fp, indent, title);
+    pr_indent(fp, indent);
+    fprintf(fp, "atnr=%d\n", ffparams->atnr);
+    pr_indent(fp, indent);
+    fprintf(fp, "ntypes=%d\n", ffparams->ntypes);
+    for (i = 0; i < ffparams->ntypes; i++)
+    {
+        pr_indent(fp, indent+INDENT);
+        fprintf(fp, "functype[%d]=%s, ",
+                bShowNumbers ? i : -1,
+                interaction_function[ffparams->functype[i]].name);
+        pr_iparams(fp, ffparams->functype[i], &ffparams->iparams[i]);
+    }
+    pr_double(fp, indent, "reppow", ffparams->reppow);
+    pr_real(fp, indent, "fudgeQQ", ffparams->fudgeQQ);
+    pr_cmap(fp, indent, "cmap", &ffparams->cmap_grid, bShowNumbers);
+}
+
+void pr_idef(FILE *fp, int indent, const char *title, const t_idef *idef, gmx_bool bShowNumbers)
+{
+    int i, j;
+
+    if (available(fp, idef, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "atnr=%d\n", idef->atnr);
+        pr_indent(fp, indent);
+        fprintf(fp, "ntypes=%d\n", idef->ntypes);
+        for (i = 0; i < idef->ntypes; i++)
+        {
+            pr_indent(fp, indent+INDENT);
+            fprintf(fp, "functype[%d]=%s, ",
+                    bShowNumbers ? i : -1,
+                    interaction_function[idef->functype[i]].name);
+            pr_iparams(fp, idef->functype[i], &idef->iparams[i]);
+        }
+        pr_real(fp, indent, "fudgeQQ", idef->fudgeQQ);
+
+        for (j = 0; (j < F_NRE); j++)
+        {
+            pr_ilist(fp, indent, interaction_function[j].longname,
+                     idef->functype, &idef->il[j], bShowNumbers);
+        }
+    }
+}
index 4f0a68b2a40fbe006f69954d376e6670844f2249..4446a3f170b3dc82e71ae49dae99bd3d38de18c1 100644 (file)
 #ifndef GMX_TOPOLOGY_IDEF_H
 #define GMX_TOPOLOGY_IDEF_H
 
+#include <stdio.h>
+
 #include "gromacs/math/vectypes.h"
+#include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-
 /* check kernel/toppush.c when you change these numbers */
 #define MAXATOMLIST 6
 #define MAXFORCEPARAM   12
@@ -402,6 +404,13 @@ typedef struct t_idef
  *      should be at least F_NRE*(nthreads+1).
  */
 
+void pr_iparams(FILE *fp, t_functype ftype, const t_iparams *iparams);
+void pr_ilist(FILE *fp, int indent, const char *title,
+              const t_functype *functype, const t_ilist *ilist, gmx_bool bShowNumbers);
+void pr_ffparams(FILE *fp, int indent, const char *title,
+                 const gmx_ffparams_t *ffparams, gmx_bool bShowNumbers);
+void pr_idef(FILE *fp, int indent, const char *title, const t_idef *idef, gmx_bool bShowNumbers);
+
 #ifdef __cplusplus
 }
 #endif
index 6ddd8d8b27342ff5d0e4dec061cb44d4f6774b2a..0474cd1488722bca61f52764092ef253827c5721 100644 (file)
@@ -46,7 +46,6 @@
 #include <algorithm>
 
 #include "gromacs/fileio/gmxfio.h"
-#include "gromacs/fileio/txtdump.h"
 #include "gromacs/topology/atoms.h"
 #include "gromacs/topology/block.h"
 #include "gromacs/topology/invblock.h"
index f9d2ff5b36be6da353be037379f25e12ea3c780b..a421368e03b4a37334d60f5bd24d6b3762dcff48 100644 (file)
 
 #include "topology.h"
 
+#include <cstdio>
+
+#include <algorithm>
+
+#include "gromacs/fileio/txtdump.h"
+#include "gromacs/gmxlib/ifunc.h"
 #include "gromacs/topology/symtab.h"
 #include "gromacs/utility/smalloc.h"
+#include "gromacs/utility/stringutil.h"
 
 const char *gtypes[egcNR+1] = {
     "T-Coupling", "Energy Mon.", "Acceleration", "Freeze",
@@ -156,3 +163,169 @@ void done_top(t_topology *top)
     done_block(&(top->mols));
     done_blocka(&(top->excls));
 }
+
+static void pr_grps(FILE *fp, const char *title, const t_grps grps[], char **grpname[])
+{
+    int i, j;
+
+    for (i = 0; (i < egcNR); i++)
+    {
+        fprintf(fp, "%s[%-12s] nr=%d, name=[", title, gtypes[i], grps[i].nr);
+        for (j = 0; (j < grps[i].nr); j++)
+        {
+            fprintf(fp, " %s", *(grpname[grps[i].nm_ind[j]]));
+        }
+        fprintf(fp, "]\n");
+    }
+}
+
+static void pr_groups(FILE *fp, int indent,
+                      const gmx_groups_t *groups,
+                      gmx_bool bShowNumbers)
+{
+    int nat_max, i, g;
+
+    pr_grps(fp, "grp", groups->grps, groups->grpname);
+    pr_strings(fp, indent, "grpname", groups->grpname, groups->ngrpname, bShowNumbers);
+
+    pr_indent(fp, indent);
+    fprintf(fp, "groups          ");
+    for (g = 0; g < egcNR; g++)
+    {
+        printf(" %5.5s", gtypes[g]);
+    }
+    printf("\n");
+
+    pr_indent(fp, indent);
+    fprintf(fp, "allocated       ");
+    nat_max = 0;
+    for (g = 0; g < egcNR; g++)
+    {
+        printf(" %5d", groups->ngrpnr[g]);
+        nat_max = std::max(nat_max, groups->ngrpnr[g]);
+    }
+    printf("\n");
+
+    if (nat_max == 0)
+    {
+        pr_indent(fp, indent);
+        fprintf(fp, "groupnr[%5s] =", "*");
+        for (g = 0; g < egcNR; g++)
+        {
+            fprintf(fp, "  %3d ", 0);
+        }
+        fprintf(fp, "\n");
+    }
+    else
+    {
+        for (i = 0; i < nat_max; i++)
+        {
+            pr_indent(fp, indent);
+            fprintf(fp, "groupnr[%5d] =", i);
+            for (g = 0; g < egcNR; g++)
+            {
+                fprintf(fp, "  %3d ",
+                        groups->grpnr[g] ? groups->grpnr[g][i] : 0);
+            }
+            fprintf(fp, "\n");
+        }
+    }
+}
+
+static void pr_moltype(FILE *fp, int indent, const char *title,
+                       const gmx_moltype_t *molt, int n,
+                       const gmx_ffparams_t *ffparams,
+                       gmx_bool bShowNumbers)
+{
+    int j;
+
+    indent = pr_title_n(fp, indent, title, n);
+    pr_indent(fp, indent);
+    fprintf(fp, "name=\"%s\"\n", *(molt->name));
+    pr_atoms(fp, indent, "atoms", &(molt->atoms), bShowNumbers);
+    pr_block(fp, indent, "cgs", &molt->cgs, bShowNumbers);
+    pr_blocka(fp, indent, "excls", &molt->excls, bShowNumbers);
+    for (j = 0; (j < F_NRE); j++)
+    {
+        pr_ilist(fp, indent, interaction_function[j].longname,
+                 ffparams->functype, &molt->ilist[j], bShowNumbers);
+    }
+}
+
+static void pr_molblock(FILE *fp, int indent, const char *title,
+                        const gmx_molblock_t *molb, int n,
+                        const gmx_moltype_t *molt)
+{
+    indent = pr_title_n(fp, indent, title, n);
+    pr_indent(fp, indent);
+    fprintf(fp, "%-20s = %d \"%s\"\n",
+            "moltype", molb->type, *(molt[molb->type].name));
+    pr_int(fp, indent, "#molecules", molb->nmol);
+    pr_int(fp, indent, "#atoms_mol", molb->natoms_mol);
+    pr_int(fp, indent, "#posres_xA", molb->nposres_xA);
+    if (molb->nposres_xA > 0)
+    {
+        pr_rvecs(fp, indent, "posres_xA", molb->posres_xA, molb->nposres_xA);
+    }
+    pr_int(fp, indent, "#posres_xB", molb->nposres_xB);
+    if (molb->nposres_xB > 0)
+    {
+        pr_rvecs(fp, indent, "posres_xB", molb->posres_xB, molb->nposres_xB);
+    }
+}
+
+void pr_mtop(FILE *fp, int indent, const char *title, const gmx_mtop_t *mtop,
+             gmx_bool bShowNumbers)
+{
+    int mt, mb, j;
+
+    if (available(fp, mtop, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "name=\"%s\"\n", *(mtop->name));
+        pr_int(fp, indent, "#atoms", mtop->natoms);
+        pr_int(fp, indent, "#molblock", mtop->nmolblock);
+        for (mb = 0; mb < mtop->nmolblock; mb++)
+        {
+            pr_molblock(fp, indent, "molblock", &mtop->molblock[mb], mb, mtop->moltype);
+        }
+        pr_str(fp, indent, "bIntermolecularInteractions",
+               gmx::boolToString(mtop->bIntermolecularInteractions));
+        if (mtop->bIntermolecularInteractions)
+        {
+            for (j = 0; (j < F_NRE); j++)
+            {
+                pr_ilist(fp, indent, interaction_function[j].longname,
+                         mtop->ffparams.functype,
+                         &mtop->intermolecular_ilist[j], bShowNumbers);
+            }
+        }
+        pr_ffparams(fp, indent, "ffparams", &(mtop->ffparams), bShowNumbers);
+        pr_atomtypes(fp, indent, "atomtypes", &(mtop->atomtypes), bShowNumbers);
+        for (mt = 0; mt < mtop->nmoltype; mt++)
+        {
+            pr_moltype(fp, indent, "moltype", &mtop->moltype[mt], mt,
+                       &mtop->ffparams, bShowNumbers);
+        }
+        pr_groups(fp, indent, &mtop->groups, bShowNumbers);
+    }
+}
+
+void pr_top(FILE *fp, int indent, const char *title, const t_topology *top, gmx_bool bShowNumbers)
+{
+    if (available(fp, top, indent, title))
+    {
+        indent = pr_title(fp, indent, title);
+        pr_indent(fp, indent);
+        fprintf(fp, "name=\"%s\"\n", *(top->name));
+        pr_atoms(fp, indent, "atoms", &(top->atoms), bShowNumbers);
+        pr_atomtypes(fp, indent, "atomtypes", &(top->atomtypes), bShowNumbers);
+        pr_block(fp, indent, "cgs", &top->cgs, bShowNumbers);
+        pr_block(fp, indent, "mols", &top->mols, bShowNumbers);
+        pr_str(fp, indent, "bIntermolecularInteractions",
+               gmx::boolToString(top->bIntermolecularInteractions));
+        pr_blocka(fp, indent, "excls", &top->excls, bShowNumbers);
+        pr_idef(fp, indent, "idef", &top->idef, bShowNumbers);
+    }
+}
index 3504763dea15dae085afaac34b8d73f82eefc740..5d3426ccaffa827e17fee744425b31564e3f7b91 100644 (file)
@@ -37,6 +37,8 @@
 #ifndef GMX_TOPOLOGY_TOPOLOGY_H
 #define GMX_TOPOLOGY_TOPOLOGY_H
 
+#include <cstdio>
+
 #include "gromacs/math/vectypes.h"
 #include "gromacs/topology/atoms.h"
 #include "gromacs/topology/block.h"
@@ -148,6 +150,10 @@ void done_top(t_topology *top);
 t_atoms *mtop2atoms(gmx_mtop_t *mtop);
 /* generate a t_atoms struct for the system from gmx_mtop_t */
 
+void pr_mtop(FILE *fp, int indent, const char *title, const gmx_mtop_t *mtop,
+             gmx_bool bShowNumbers);
+void pr_top(FILE *fp, int indent, const char *title, const t_topology *top, gmx_bool bShowNumbers);
+
 #ifdef __cplusplus
 }
 #endif