2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
41 /* This file is completely threadsafe - please keep it that way! */
53 int pr_indent(FILE *fp, int n)
57 for (i = 0; i < n; i++)
59 (void) fprintf(fp, " ");
64 int available(FILE *fp, void *p, int indent, const char *title)
70 pr_indent(fp, indent);
72 (void) fprintf(fp, "%s: not available\n", title);
77 int pr_title(FILE *fp, int indent, const char *title)
79 (void) pr_indent(fp, indent);
80 (void) fprintf(fp, "%s:\n", title);
81 return (indent+INDENT);
84 int pr_title_n(FILE *fp, int indent, const char *title, int n)
86 (void) pr_indent(fp, indent);
87 (void) fprintf(fp, "%s (%d):\n", title, n);
88 return (indent+INDENT);
91 int pr_title_nxn(FILE *fp, int indent, const char *title, int n1, int n2)
93 (void) pr_indent(fp, indent);
94 (void) fprintf(fp, "%s (%dx%d):\n", title, n1, n2);
95 return (indent+INDENT);
98 void pr_ivec(FILE *fp, int indent, const char *title, int vec[], int n, gmx_bool bShowNumbers)
102 if (available(fp, vec, indent, title))
104 indent = pr_title_n(fp, indent, title, n);
105 for (i = 0; i < n; i++)
107 (void) pr_indent(fp, indent);
108 (void) fprintf(fp, "%s[%d]=%d\n", title, bShowNumbers ? i : -1, vec[i]);
113 void pr_ivec_block(FILE *fp, int indent, const char *title, int vec[], int n, gmx_bool bShowNumbers)
117 if (available(fp, vec, indent, title))
119 indent = pr_title_n(fp, indent, title, n);
124 while (j < n && vec[j] == vec[j-1]+1)
128 /* Print consecutive groups of 3 or more as blocks */
133 (void) pr_indent(fp, indent);
134 (void) fprintf(fp, "%s[%d]=%d\n",
135 title, bShowNumbers ? i : -1, vec[i]);
141 (void) pr_indent(fp, indent);
142 (void) fprintf(fp, "%s[%d,...,%d] = {%d,...,%d}\n",
144 bShowNumbers ? i : -1,
145 bShowNumbers ? j-1 : -1,
153 void pr_bvec(FILE *fp, int indent, const char *title, gmx_bool vec[], int n, gmx_bool bShowNumbers)
157 if (available(fp, vec, indent, title))
159 indent = pr_title_n(fp, indent, title, n);
160 for (i = 0; i < n; i++)
162 (void) pr_indent(fp, indent);
163 (void) fprintf(fp, "%s[%d]=%s\n", title, bShowNumbers ? i : -1,
169 void pr_ivecs(FILE *fp, int indent, const char *title, ivec vec[], int n, gmx_bool bShowNumbers)
173 if (available(fp, vec, indent, title))
175 indent = pr_title_nxn(fp, indent, title, n, DIM);
176 for (i = 0; i < n; i++)
178 (void) pr_indent(fp, indent);
179 (void) fprintf(fp, "%s[%d]={", title, bShowNumbers ? i : -1);
180 for (j = 0; j < DIM; j++)
184 (void) fprintf(fp, ", ");
186 fprintf(fp, "%d", vec[i][j]);
188 (void) fprintf(fp, "}\n");
193 void pr_rvec(FILE *fp, int indent, const char *title, real vec[], int n, gmx_bool bShowNumbers)
197 if (available(fp, vec, indent, title))
199 indent = pr_title_n(fp, indent, title, n);
200 for (i = 0; i < n; i++)
202 pr_indent(fp, indent);
203 fprintf(fp, "%s[%d]=%12.5e\n", title, bShowNumbers ? i : -1, vec[i]);
208 void pr_dvec(FILE *fp, int indent, const char *title, double vec[], int n, gmx_bool bShowNumbers)
212 if (available(fp, vec, indent, title))
214 indent = pr_title_n(fp, indent, title, n);
215 for (i = 0; i < n; i++)
217 pr_indent(fp, indent);
218 fprintf(fp, "%s[%d]=%12.5e\n", title, bShowNumbers ? i : -1, vec[i]);
225 void pr_mat(FILE *fp,int indent,char *title,matrix m)
229 if (available(fp,m,indent,title)) {
230 indent=pr_title_n(fp,indent,title,n);
232 pr_indent(fp,indent);
233 fprintf(fp,"%s[%d]=%12.5e %12.5e %12.5e\n",
234 title,bShowNumbers?i:-1,m[i][XX],m[i][YY],m[i][ZZ]);
240 void pr_rvecs_len(FILE *fp, int indent, const char *title, rvec vec[], int n)
244 if (available(fp, vec, indent, title))
246 indent = pr_title_nxn(fp, indent, title, n, DIM);
247 for (i = 0; i < n; i++)
249 (void) pr_indent(fp, indent);
250 (void) fprintf(fp, "%s[%5d]={", title, i);
251 for (j = 0; j < DIM; j++)
255 (void) fprintf(fp, ", ");
257 (void) fprintf(fp, "%12.5e", vec[i][j]);
259 (void) fprintf(fp, "} len=%12.5e\n", norm(vec[i]));
264 void pr_rvecs(FILE *fp, int indent, const char *title, rvec vec[], int n)
266 const char *fshort = "%12.5e";
267 const char *flong = "%15.8e";
271 if (getenv("LONGFORMAT") != NULL)
280 if (available(fp, vec, indent, title))
282 indent = pr_title_nxn(fp, indent, title, n, DIM);
283 for (i = 0; i < n; i++)
285 (void) pr_indent(fp, indent);
286 (void) fprintf(fp, "%s[%5d]={", title, i);
287 for (j = 0; j < DIM; j++)
291 (void) fprintf(fp, ", ");
293 (void) fprintf(fp, format, vec[i][j]);
295 (void) fprintf(fp, "}\n");
301 void pr_reals(FILE *fp, int indent, const char *title, real *vec, int n)
305 if (available(fp, vec, indent, title))
307 (void) pr_indent(fp, indent);
308 (void) fprintf(fp, "%s:\t", title);
309 for (i = 0; i < n; i++)
311 fprintf(fp, " %10g", vec[i]);
313 (void) fprintf(fp, "\n");
317 void pr_doubles(FILE *fp, int indent, const char *title, double *vec, int n)
321 if (available(fp, vec, indent, title))
323 (void) pr_indent(fp, indent);
324 (void) fprintf(fp, "%s:\t", title);
325 for (i = 0; i < n; i++)
327 fprintf(fp, " %10g", vec[i]);
329 (void) fprintf(fp, "\n");
333 static void pr_int(FILE *fp, int indent, const char *title, int i)
335 pr_indent(fp, indent);
336 fprintf(fp, "%-20s = %d\n", title, i);
339 static void pr_gmx_large_int(FILE *fp, int indent, const char *title, gmx_large_int_t i)
341 char buf[STEPSTRSIZE];
343 pr_indent(fp, indent);
344 fprintf(fp, "%-20s = %s\n", title, gmx_step_str(i, buf));
347 static void pr_real(FILE *fp, int indent, const char *title, real r)
349 pr_indent(fp, indent);
350 fprintf(fp, "%-20s = %g\n", title, r);
353 static void pr_double(FILE *fp, int indent, const char *title, double d)
355 pr_indent(fp, indent);
356 fprintf(fp, "%-20s = %g\n", title, d);
359 static void pr_str(FILE *fp, int indent, const char *title, const char *s)
361 pr_indent(fp, indent);
362 fprintf(fp, "%-20s = %s\n", title, s);
365 void pr_qm_opts(FILE *fp, int indent, const char *title, t_grpopts *opts)
369 fprintf(fp, "%s:\n", title);
371 pr_int(fp, indent, "ngQM", opts->ngQM);
374 pr_ivec(fp, indent, "QMmethod", opts->QMmethod, opts->ngQM, FALSE);
375 pr_ivec(fp, indent, "QMbasis", opts->QMbasis, opts->ngQM, FALSE);
376 pr_ivec(fp, indent, "QMcharge", opts->QMcharge, opts->ngQM, FALSE);
377 pr_ivec(fp, indent, "QMmult", opts->QMmult, opts->ngQM, FALSE);
378 pr_bvec(fp, indent, "bSH", opts->bSH, opts->ngQM, FALSE);
379 pr_ivec(fp, indent, "CASorbitals", opts->CASorbitals, opts->ngQM, FALSE);
380 pr_ivec(fp, indent, "CASelectrons", opts->CASelectrons, opts->ngQM, FALSE);
381 pr_rvec(fp, indent, "SAon", opts->SAon, opts->ngQM, FALSE);
382 pr_rvec(fp, indent, "SAon", opts->SAon, opts->ngQM, FALSE);
383 pr_ivec(fp, indent, "SAsteps", opts->SAsteps, opts->ngQM, FALSE);
384 pr_bvec(fp, indent, "bOPT", opts->bOPT, opts->ngQM, FALSE);
385 pr_bvec(fp, indent, "bTS", opts->bTS, opts->ngQM, FALSE);
389 static void pr_grp_opts(FILE *out, int indent, const char *title, t_grpopts *opts,
396 fprintf(out, "%s:\n", title);
399 pr_indent(out, indent);
400 fprintf(out, "nrdf%s", bMDPformat ? " = " : ":");
401 for (i = 0; (i < opts->ngtc); i++)
403 fprintf(out, " %10g", opts->nrdf[i]);
407 pr_indent(out, indent);
408 fprintf(out, "ref-t%s", bMDPformat ? " = " : ":");
409 for (i = 0; (i < opts->ngtc); i++)
411 fprintf(out, " %10g", opts->ref_t[i]);
415 pr_indent(out, indent);
416 fprintf(out, "tau-t%s", bMDPformat ? " = " : ":");
417 for (i = 0; (i < opts->ngtc); i++)
419 fprintf(out, " %10g", opts->tau_t[i]);
423 /* Pretty-print the simulated annealing info */
424 fprintf(out, "anneal%s", bMDPformat ? " = " : ":");
425 for (i = 0; (i < opts->ngtc); i++)
427 fprintf(out, " %10s", EANNEAL(opts->annealing[i]));
431 fprintf(out, "ann-npoints%s", bMDPformat ? " = " : ":");
432 for (i = 0; (i < opts->ngtc); i++)
434 fprintf(out, " %10d", opts->anneal_npoints[i]);
438 for (i = 0; (i < opts->ngtc); i++)
440 if (opts->anneal_npoints[i] > 0)
442 fprintf(out, "ann. times [%d]:\t", i);
443 for (j = 0; (j < opts->anneal_npoints[i]); j++)
445 fprintf(out, " %10.1f", opts->anneal_time[i][j]);
448 fprintf(out, "ann. temps [%d]:\t", i);
449 for (j = 0; (j < opts->anneal_npoints[i]); j++)
451 fprintf(out, " %10.1f", opts->anneal_temp[i][j]);
457 pr_indent(out, indent);
458 fprintf(out, "acc:\t");
459 for (i = 0; (i < opts->ngacc); i++)
461 for (m = 0; (m < DIM); m++)
463 fprintf(out, " %10g", opts->acc[i][m]);
468 pr_indent(out, indent);
469 fprintf(out, "nfreeze:");
470 for (i = 0; (i < opts->ngfrz); i++)
472 for (m = 0; (m < DIM); m++)
474 fprintf(out, " %10s", opts->nFreeze[i][m] ? "Y" : "N");
480 for (i = 0; (i < opts->ngener); i++)
482 pr_indent(out, indent);
483 fprintf(out, "energygrp-flags[%3d]:", i);
484 for (m = 0; (m < opts->ngener); m++)
486 fprintf(out, " %d", opts->egp_flags[opts->ngener*i+m]);
494 static void pr_matrix(FILE *fp, int indent, const char *title, rvec *m,
499 fprintf(fp, "%-10s = %g %g %g %g %g %g\n", title,
500 m[XX][XX], m[YY][YY], m[ZZ][ZZ], m[XX][YY], m[XX][ZZ], m[YY][ZZ]);
504 pr_rvecs(fp, indent, title, m, DIM);
508 static void pr_cosine(FILE *fp, int indent, const char *title, t_cosines *cos,
515 fprintf(fp, "%s = %d\n", title, cos->n);
519 indent = pr_title(fp, indent, title);
520 (void) pr_indent(fp, indent);
521 fprintf(fp, "n = %d\n", cos->n);
524 (void) pr_indent(fp, indent+2);
526 for (j = 0; (j < cos->n); j++)
528 fprintf(fp, " %e", cos->a[j]);
531 (void) pr_indent(fp, indent+2);
532 fprintf(fp, "phi =");
533 for (j = 0; (j < cos->n); j++)
535 fprintf(fp, " %e", cos->phi[j]);
542 #define PS(t, s) pr_str(fp, indent, t, s)
543 #define PI(t, s) pr_int(fp, indent, t, s)
544 #define PSTEP(t, s) pr_gmx_large_int(fp, indent, t, s)
545 #define PR(t, s) pr_real(fp, indent, t, s)
546 #define PD(t, s) pr_double(fp, indent, t, s)
548 static void pr_pullgrp(FILE *fp, int indent, int g, t_pullgrp *pg)
550 pr_indent(fp, indent);
551 fprintf(fp, "pull-group %d:\n", g);
553 pr_ivec_block(fp, indent, "atom", pg->ind, pg->nat, TRUE);
554 pr_rvec(fp, indent, "weight", pg->weight, pg->nweight, TRUE);
555 PI("pbcatom", pg->pbcatom);
556 pr_rvec(fp, indent, "vec", pg->vec, DIM, TRUE);
557 pr_rvec(fp, indent, "init", pg->init, DIM, TRUE);
558 PR("rate", pg->rate);
563 static void pr_simtempvals(FILE *fp, int indent, t_simtemp *simtemp, int n_lambda)
565 PR("simtemp_low", simtemp->simtemp_low);
566 PR("simtemp_high", simtemp->simtemp_high);
567 PS("simulated-tempering-scaling", ESIMTEMP(simtemp->eSimTempScale));
568 pr_rvec(fp, indent, "simulated tempering temperatures", simtemp->temperatures, n_lambda, TRUE);
571 static void pr_expandedvals(FILE *fp, int indent, t_expanded *expand, int n_lambda)
574 PI("nstexpanded", expand->nstexpanded);
575 PS("lambda-stats", elamstats_names[expand->elamstats]);
576 PS("lambda-mc-move", elmcmove_names[expand->elmcmove]);
577 PI("lmc-repeats", expand->lmc_repeats);
578 PI("lmc-gibbsdelta", expand->gibbsdeltalam);
579 PI("lmc-nstart", expand->lmc_forced_nstart);
580 PS("symmetrized-transition-matrix", EBOOL(expand->bSymmetrizedTMatrix));
581 PI("nst-transition-matrix", expand->nstTij);
582 PI("mininum-var-min", expand->minvarmin); /*default is reasonable */
583 PI("weight-c-range", expand->c_range); /* default is just C=0 */
584 PR("wl-scale", expand->wl_scale);
585 PR("init-wl-delta", expand->init_wl_delta);
586 PR("wl-ratio", expand->wl_ratio);
587 PS("bWLoneovert", EBOOL(expand->bWLoneovert));
588 PI("lmc-seed", expand->lmc_seed);
589 PR("mc-temperature", expand->mc_temp);
590 PS("lmc-weights-equil", elmceq_names[expand->elmceq]);
591 if (expand->elmceq == elmceqNUMATLAM)
593 PI("weight-equil-number-all-lambda", expand->equil_n_at_lam);
595 if (expand->elmceq == elmceqSAMPLES)
597 PI("weight-equil-number-samples", expand->equil_samples);
599 if (expand->elmceq == elmceqSTEPS)
601 PI("weight-equil-number-steps", expand->equil_steps);
603 if (expand->elmceq == elmceqWLDELTA)
605 PR("weight-equil-wl-delta", expand->equil_wl_delta);
607 if (expand->elmceq == elmceqRATIO)
609 PR("weight-equil-count-ratio", expand->equil_ratio);
612 pr_indent(fp, indent);
613 pr_rvec(fp, indent, "init-lambda-weights", expand->init_lambda_weights, n_lambda, TRUE);
614 PS("init-weights", EBOOL(expand->bInit_weights));
617 static void pr_fepvals(FILE *fp, int indent, t_lambda *fep, gmx_bool bMDPformat)
621 PI("nstdhdl", fep->nstdhdl);
622 PI("init-lambda-state", fep->init_fep_state);
623 PR("init-lambda", fep->init_lambda);
624 PR("delta-lambda", fep->delta_lambda);
627 PI("n-lambdas", fep->n_lambda);
629 if (fep->n_lambda > 0)
631 pr_indent(fp, indent);
632 fprintf(fp, "separate-dvdl%s\n", bMDPformat ? " = " : ":");
633 for (i = 0; i < efptNR; i++)
635 fprintf(fp, "%18s = ", efpt_names[i]);
636 if (fep->separate_dvdl[i])
638 fprintf(fp, " TRUE");
642 fprintf(fp, " FALSE");
646 fprintf(fp, "all-lambdas%s\n", bMDPformat ? " = " : ":");
647 for (i = 0; i < efptNR; i++)
649 fprintf(fp, "%18s = ", efpt_names[i]);
650 for (j = 0; j < fep->n_lambda; j++)
652 fprintf(fp, " %10g", fep->all_lambda[i][j]);
657 PI("calc-lambda-neighbors", fep->lambda_neighbors);
659 PR("sc-alpha", fep->sc_alpha);
660 PS("bScCoul", EBOOL(fep->bScCoul));
661 PS("bScPrintEnergy", EBOOL(fep->bPrintEnergy));
662 PI("sc-power", fep->sc_power);
663 PR("sc-r-power", fep->sc_r_power);
664 PR("sc-sigma", fep->sc_sigma);
665 PR("sc-sigma-min", fep->sc_sigma_min);
666 PS("separate-dhdl-file", SEPDHDLFILETYPE(fep->separate_dhdl_file));
667 PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(fep->dhdl_derivatives));
668 PI("dh-hist-size", fep->dh_hist_size);
669 PD("dh-hist-spacing", fep->dh_hist_spacing);
672 static void pr_pull(FILE *fp, int indent, t_pull *pull)
676 PS("pull-geometry", EPULLGEOM(pull->eGeom));
677 pr_ivec(fp, indent, "pull-dim", pull->dim, DIM, TRUE);
678 PR("pull-r1", pull->cyl_r1);
679 PR("pull-r0", pull->cyl_r0);
680 PR("pull-constr-tol", pull->constr_tol);
681 PI("pull-nstxout", pull->nstxout);
682 PI("pull-nstfout", pull->nstfout);
683 PI("pull-ngrp", pull->ngrp);
684 for (g = 0; g < pull->ngrp+1; g++)
686 pr_pullgrp(fp, indent, g, &pull->grp[g]);
690 static void pr_rotgrp(FILE *fp, int indent, int g, t_rotgrp *rotg)
692 pr_indent(fp, indent);
693 fprintf(fp, "rotation_group %d:\n", g);
695 PS("type", EROTGEOM(rotg->eType));
696 PS("massw", EBOOL(rotg->bMassW));
697 pr_ivec_block(fp, indent, "atom", rotg->ind, rotg->nat, TRUE);
698 pr_rvecs(fp, indent, "x_ref", rotg->x_ref, rotg->nat);
699 pr_rvec(fp, indent, "vec", rotg->vec, DIM, TRUE);
700 pr_rvec(fp, indent, "pivot", rotg->pivot, DIM, TRUE);
701 PR("rate", rotg->rate);
703 PR("slab_dist", rotg->slab_dist);
704 PR("min_gaussian", rotg->min_gaussian);
705 PR("epsilon", rotg->eps);
706 PS("fit_method", EROTFIT(rotg->eFittype));
707 PI("potfitangle_nstep", rotg->PotAngle_nstep);
708 PR("potfitangle_step", rotg->PotAngle_step);
711 static void pr_rot(FILE *fp, int indent, t_rot *rot)
715 PI("rot_nstrout", rot->nstrout);
716 PI("rot_nstsout", rot->nstsout);
717 PI("rot_ngrp", rot->ngrp);
718 for (g = 0; g < rot->ngrp; g++)
720 pr_rotgrp(fp, indent, g, &rot->grp[g]);
724 void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
727 const char *infbuf = "inf";
730 if (available(fp, ir, indent, title))
734 indent = pr_title(fp, indent, title);
736 PS("integrator", EI(ir->eI));
737 PSTEP("nsteps", ir->nsteps);
738 PSTEP("init-step", ir->init_step);
739 PS("cutoff-scheme", ECUTSCHEME(ir->cutoff_scheme));
740 PS("ns_type", ENS(ir->ns_type));
741 PI("nstlist", ir->nstlist);
742 PI("ndelta", ir->ndelta);
743 PI("nstcomm", ir->nstcomm);
744 PS("comm-mode", ECOM(ir->comm_mode));
745 PI("nstlog", ir->nstlog);
746 PI("nstxout", ir->nstxout);
747 PI("nstvout", ir->nstvout);
748 PI("nstfout", ir->nstfout);
749 PI("nstcalcenergy", ir->nstcalcenergy);
750 PI("nstenergy", ir->nstenergy);
751 PI("nstxtcout", ir->nstxtcout);
752 PR("init-t", ir->init_t);
753 PR("delta-t", ir->delta_t);
755 PR("xtcprec", ir->xtcprec);
756 PR("fourierspacing", ir->fourier_spacing);
760 PI("pme-order", ir->pme_order);
761 PR("ewald-rtol", ir->ewald_rtol);
762 PR("ewald-rtol-lj", ir->ewald_rtol_lj);
763 PR("ewald-geometry", ir->ewald_geometry);
764 PR("epsilon-surface", ir->epsilon_surface);
765 PS("optimize-fft", EBOOL(ir->bOptFFT));
766 PS("lj-pme-comb-rule", ELJPMECOMBNAMES(ir->ljpme_combination_rule));
767 PS("ePBC", EPBC(ir->ePBC));
768 PS("bPeriodicMols", EBOOL(ir->bPeriodicMols));
769 PS("bContinuation", EBOOL(ir->bContinuation));
770 PS("bShakeSOR", EBOOL(ir->bShakeSOR));
771 PS("etc", ETCOUPLTYPE(ir->etc));
772 PS("bPrintNHChains", EBOOL(ir->bPrintNHChains));
773 PI("nsttcouple", ir->nsttcouple);
774 PS("epc", EPCOUPLTYPE(ir->epc));
775 PS("epctype", EPCOUPLTYPETYPE(ir->epct));
776 PI("nstpcouple", ir->nstpcouple);
777 PR("tau-p", ir->tau_p);
778 pr_matrix(fp, indent, "ref-p", ir->ref_p, bMDPformat);
779 pr_matrix(fp, indent, "compress", ir->compress, bMDPformat);
780 PS("refcoord-scaling", EREFSCALINGTYPE(ir->refcoord_scaling));
783 fprintf(fp, "posres-com = %g %g %g\n", ir->posres_com[XX],
784 ir->posres_com[YY], ir->posres_com[ZZ]);
788 pr_rvec(fp, indent, "posres-com", ir->posres_com, DIM, TRUE);
792 fprintf(fp, "posres-comB = %g %g %g\n", ir->posres_comB[XX],
793 ir->posres_comB[YY], ir->posres_comB[ZZ]);
797 pr_rvec(fp, indent, "posres-comB", ir->posres_comB, DIM, TRUE);
799 PR("verlet-buffer-drift", ir->verletbuf_drift);
800 PR("rlist", ir->rlist);
801 PR("rlistlong", ir->rlistlong);
802 PR("nstcalclr", ir->nstcalclr);
803 PR("rtpi", ir->rtpi);
804 PS("coulombtype", EELTYPE(ir->coulombtype));
805 PS("coulomb-modifier", INTMODIFIER(ir->coulomb_modifier));
806 PR("rcoulomb-switch", ir->rcoulomb_switch);
807 PR("rcoulomb", ir->rcoulomb);
808 PS("vdwtype", EVDWTYPE(ir->vdwtype));
809 PS("vdw-modifier", INTMODIFIER(ir->vdw_modifier));
810 PR("rvdw-switch", ir->rvdw_switch);
811 PR("rvdw", ir->rvdw);
812 if (ir->epsilon_r != 0)
814 PR("epsilon-r", ir->epsilon_r);
818 PS("epsilon-r", infbuf);
820 if (ir->epsilon_rf != 0)
822 PR("epsilon-rf", ir->epsilon_rf);
826 PS("epsilon-rf", infbuf);
828 PR("tabext", ir->tabext);
829 PS("implicit-solvent", EIMPLICITSOL(ir->implicit_solvent));
830 PS("gb-algorithm", EGBALGORITHM(ir->gb_algorithm));
831 PR("gb-epsilon-solvent", ir->gb_epsilon_solvent);
832 PI("nstgbradii", ir->nstgbradii);
833 PR("rgbradii", ir->rgbradii);
834 PR("gb-saltconc", ir->gb_saltconc);
835 PR("gb-obc-alpha", ir->gb_obc_alpha);
836 PR("gb-obc-beta", ir->gb_obc_beta);
837 PR("gb-obc-gamma", ir->gb_obc_gamma);
838 PR("gb-dielectric-offset", ir->gb_dielectric_offset);
839 PS("sa-algorithm", ESAALGORITHM(ir->gb_algorithm));
840 PR("sa-surface-tension", ir->sa_surface_tension);
841 PS("DispCorr", EDISPCORR(ir->eDispCorr));
842 PS("bSimTemp", EBOOL(ir->bSimTemp));
845 pr_simtempvals(fp, indent, ir->simtempvals, ir->fepvals->n_lambda);
847 PS("free-energy", EFEPTYPE(ir->efep));
848 if (ir->efep != efepNO || ir->bSimTemp)
850 pr_fepvals(fp, indent, ir->fepvals, bMDPformat);
854 pr_expandedvals(fp, indent, ir->expandedvals, ir->fepvals->n_lambda);
857 PI("nwall", ir->nwall);
858 PS("wall-type", EWALLTYPE(ir->wall_type));
859 PI("wall-atomtype[0]", ir->wall_atomtype[0]);
860 PI("wall-atomtype[1]", ir->wall_atomtype[1]);
861 PR("wall-density[0]", ir->wall_density[0]);
862 PR("wall-density[1]", ir->wall_density[1]);
863 PR("wall-ewald-zfac", ir->wall_ewald_zfac);
865 PS("pull", EPULLTYPE(ir->ePull));
866 if (ir->ePull != epullNO)
868 pr_pull(fp, indent, ir->pull);
871 PS("rotation", EBOOL(ir->bRot));
874 pr_rot(fp, indent, ir->rot);
877 PS("disre", EDISRETYPE(ir->eDisre));
878 PS("disre-weighting", EDISREWEIGHTING(ir->eDisreWeighting));
879 PS("disre-mixed", EBOOL(ir->bDisreMixed));
880 PR("dr-fc", ir->dr_fc);
881 PR("dr-tau", ir->dr_tau);
882 PR("nstdisreout", ir->nstdisreout);
883 PR("orires-fc", ir->orires_fc);
884 PR("orires-tau", ir->orires_tau);
885 PR("nstorireout", ir->nstorireout);
887 PR("dihre-fc", ir->dihre_fc);
889 PR("em-stepsize", ir->em_stepsize);
890 PR("em-tol", ir->em_tol);
891 PI("niter", ir->niter);
892 PR("fc-stepsize", ir->fc_stepsize);
893 PI("nstcgsteep", ir->nstcgsteep);
894 PI("nbfgscorr", ir->nbfgscorr);
896 PS("ConstAlg", ECONSTRTYPE(ir->eConstrAlg));
897 PR("shake-tol", ir->shake_tol);
898 PI("lincs-order", ir->nProjOrder);
899 PR("lincs-warnangle", ir->LincsWarnAngle);
900 PI("lincs-iter", ir->nLincsIter);
901 PR("bd-fric", ir->bd_fric);
902 PI("ld-seed", ir->ld_seed);
903 PR("cos-accel", ir->cos_accel);
904 pr_matrix(fp, indent, "deform", ir->deform, bMDPformat);
906 PS("adress", EBOOL(ir->bAdress));
909 PS("adress_type", EADRESSTYPE(ir->adress->type));
910 PR("adress_const_wf", ir->adress->const_wf);
911 PR("adress_ex_width", ir->adress->ex_width);
912 PR("adress_hy_width", ir->adress->hy_width);
913 PS("adress_interface_correction", EADRESSICTYPE(ir->adress->icor));
914 PS("adress_site", EADRESSSITETYPE(ir->adress->site));
915 PR("adress_ex_force_cap", ir->adress->ex_forcecap);
916 PS("adress_do_hybridpairs", EBOOL(ir->adress->do_hybridpairs));
918 pr_rvec(fp, indent, "adress_reference_coords", ir->adress->refs, DIM, TRUE);
920 PI("userint1", ir->userint1);
921 PI("userint2", ir->userint2);
922 PI("userint3", ir->userint3);
923 PI("userint4", ir->userint4);
924 PR("userreal1", ir->userreal1);
925 PR("userreal2", ir->userreal2);
926 PR("userreal3", ir->userreal3);
927 PR("userreal4", ir->userreal4);
928 pr_grp_opts(fp, indent, "grpopts", &(ir->opts), bMDPformat);
929 pr_cosine(fp, indent, "efield-x", &(ir->ex[XX]), bMDPformat);
930 pr_cosine(fp, indent, "efield-xt", &(ir->et[XX]), bMDPformat);
931 pr_cosine(fp, indent, "efield-y", &(ir->ex[YY]), bMDPformat);
932 pr_cosine(fp, indent, "efield-yt", &(ir->et[YY]), bMDPformat);
933 pr_cosine(fp, indent, "efield-z", &(ir->ex[ZZ]), bMDPformat);
934 pr_cosine(fp, indent, "efield-zt", &(ir->et[ZZ]), bMDPformat);
935 PS("bQMMM", EBOOL(ir->bQMMM));
936 PI("QMconstraints", ir->QMconstraints);
937 PI("QMMMscheme", ir->QMMMscheme);
938 PR("scalefactor", ir->scalefactor);
939 pr_qm_opts(fp, indent, "qm-opts", &(ir->opts));
946 static void pr_harm(FILE *fp, t_iparams *iparams, const char *r, const char *kr)
948 fprintf(fp, "%sA=%12.5e, %sA=%12.5e, %sB=%12.5e, %sB=%12.5e\n",
949 r, iparams->harmonic.rA, kr, iparams->harmonic.krA,
950 r, iparams->harmonic.rB, kr, iparams->harmonic.krB);
953 void pr_iparams(FILE *fp, t_functype ftype, t_iparams *iparams)
956 real VA[4], VB[4], *rbcA, *rbcB;
962 pr_harm(fp, iparams, "th", "ct");
964 case F_CROSS_BOND_BONDS:
965 fprintf(fp, "r1e=%15.8e, r2e=%15.8e, krr=%15.8e\n",
966 iparams->cross_bb.r1e, iparams->cross_bb.r2e,
967 iparams->cross_bb.krr);
969 case F_CROSS_BOND_ANGLES:
970 fprintf(fp, "r1e=%15.8e, r1e=%15.8e, r3e=%15.8e, krt=%15.8e\n",
971 iparams->cross_ba.r1e, iparams->cross_ba.r2e,
972 iparams->cross_ba.r3e, iparams->cross_ba.krt);
974 case F_LINEAR_ANGLES:
975 fprintf(fp, "klinA=%15.8e, aA=%15.8e, klinB=%15.8e, aB=%15.8e\n",
976 iparams->linangle.klinA, iparams->linangle.aA,
977 iparams->linangle.klinB, iparams->linangle.aB);
980 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);
982 case F_QUARTIC_ANGLES:
983 fprintf(fp, "theta=%15.8e", iparams->qangle.theta);
984 for (i = 0; i < 5; i++)
986 fprintf(fp, ", c%c=%15.8e", '0'+i, iparams->qangle.c[i]);
991 fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
992 iparams->bham.a, iparams->bham.b, iparams->bham.c);
997 pr_harm(fp, iparams, "b0", "cb");
1000 pr_harm(fp, iparams, "xi", "cx");
1003 fprintf(fp, "b0A=%15.8e, cbA=%15.8e, betaA=%15.8e, b0B=%15.8e, cbB=%15.8e, betaB=%15.8e\n",
1004 iparams->morse.b0A, iparams->morse.cbA, iparams->morse.betaA,
1005 iparams->morse.b0B, iparams->morse.cbB, iparams->morse.betaB);
1008 fprintf(fp, "b0=%15.8e, kb=%15.8e, kcub=%15.8e\n",
1009 iparams->cubic.b0, iparams->cubic.kb, iparams->cubic.kcub);
1015 fprintf(fp, "bm=%15.8e, kb=%15.8e\n", iparams->fene.bm, iparams->fene.kb);
1018 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",
1019 iparams->restraint.lowA, iparams->restraint.up1A,
1020 iparams->restraint.up2A, iparams->restraint.kA,
1021 iparams->restraint.lowB, iparams->restraint.up1B,
1022 iparams->restraint.up2B, iparams->restraint.kB);
1028 fprintf(fp, "tab=%d, kA=%15.8e, kB=%15.8e\n",
1029 iparams->tab.table, iparams->tab.kA, iparams->tab.kB);
1031 case F_POLARIZATION:
1032 fprintf(fp, "alpha=%15.8e\n", iparams->polarize.alpha);
1035 fprintf(fp, "alpha=%15.8e drcut=%15.8e khyp=%15.8e\n",
1036 iparams->anharm_polarize.alpha,
1037 iparams->anharm_polarize.drcut,
1038 iparams->anharm_polarize.khyp);
1041 fprintf(fp, "a=%15.8e, alpha1=%15.8e, alpha2=%15.8e, rfac=%15.8e\n",
1042 iparams->thole.a, iparams->thole.alpha1, iparams->thole.alpha2,
1043 iparams->thole.rfac);
1046 fprintf(fp, "al_x=%15.8e, al_y=%15.8e, al_z=%15.8e, rOH=%9.6f, rHH=%9.6f, rOD=%9.6f\n",
1047 iparams->wpol.al_x, iparams->wpol.al_y, iparams->wpol.al_z,
1048 iparams->wpol.rOH, iparams->wpol.rHH, iparams->wpol.rOD);
1051 fprintf(fp, "c6=%15.8e, c12=%15.8e\n", iparams->lj.c6, iparams->lj.c12);
1054 fprintf(fp, "c6A=%15.8e, c12A=%15.8e, c6B=%15.8e, c12B=%15.8e\n",
1055 iparams->lj14.c6A, iparams->lj14.c12A,
1056 iparams->lj14.c6B, iparams->lj14.c12B);
1059 fprintf(fp, "fqq=%15.8e, qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
1061 iparams->ljc14.qi, iparams->ljc14.qj,
1062 iparams->ljc14.c6, iparams->ljc14.c12);
1064 case F_LJC_PAIRS_NB:
1065 fprintf(fp, "qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
1066 iparams->ljcnb.qi, iparams->ljcnb.qj,
1067 iparams->ljcnb.c6, iparams->ljcnb.c12);
1073 fprintf(fp, "phiA=%15.8e, cpA=%15.8e, phiB=%15.8e, cpB=%15.8e, mult=%d\n",
1074 iparams->pdihs.phiA, iparams->pdihs.cpA,
1075 iparams->pdihs.phiB, iparams->pdihs.cpB,
1076 iparams->pdihs.mult);
1079 fprintf(fp, "label=%4d, type=%1d, low=%15.8e, up1=%15.8e, up2=%15.8e, fac=%15.8e)\n",
1080 iparams->disres.label, iparams->disres.type,
1081 iparams->disres.low, iparams->disres.up1,
1082 iparams->disres.up2, iparams->disres.kfac);
1085 fprintf(fp, "ex=%4d, label=%d, power=%4d, c=%15.8e, obs=%15.8e, kfac=%15.8e)\n",
1086 iparams->orires.ex, iparams->orires.label, iparams->orires.power,
1087 iparams->orires.c, iparams->orires.obs, iparams->orires.kfac);
1090 fprintf(fp, "phiA=%15.8e, dphiA=%15.8e, kfacA=%15.8e, phiB=%15.8e, dphiB=%15.8e, kfacB=%15.8e\n",
1091 iparams->dihres.phiA, iparams->dihres.dphiA, iparams->dihres.kfacA,
1092 iparams->dihres.phiB, iparams->dihres.dphiB, iparams->dihres.kfacB);
1095 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",
1096 iparams->posres.pos0A[XX], iparams->posres.pos0A[YY],
1097 iparams->posres.pos0A[ZZ], iparams->posres.fcA[XX],
1098 iparams->posres.fcA[YY], iparams->posres.fcA[ZZ],
1099 iparams->posres.pos0B[XX], iparams->posres.pos0B[YY],
1100 iparams->posres.pos0B[ZZ], iparams->posres.fcB[XX],
1101 iparams->posres.fcB[YY], iparams->posres.fcB[ZZ]);
1104 fprintf(fp, "pos0=(%15.8e,%15.8e,%15.8e), geometry=%d, r=%15.8e, k=%15.8e\n",
1105 iparams->fbposres.pos0[XX], iparams->fbposres.pos0[YY],
1106 iparams->fbposres.pos0[ZZ], iparams->fbposres.geom,
1107 iparams->fbposres.r, iparams->fbposres.k);
1110 for (i = 0; i < NR_RBDIHS; i++)
1112 fprintf(fp, "%srbcA[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcA[i]);
1115 for (i = 0; i < NR_RBDIHS; i++)
1117 fprintf(fp, "%srbcB[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcB[i]);
1122 /* Use the OPLS -> Ryckaert-Bellemans formula backwards to get the
1123 * OPLS potential constants back.
1125 rbcA = iparams->rbdihs.rbcA;
1126 rbcB = iparams->rbdihs.rbcB;
1128 VA[3] = -0.25*rbcA[4];
1129 VA[2] = -0.5*rbcA[3];
1130 VA[1] = 4.0*VA[3]-rbcA[2];
1131 VA[0] = 3.0*VA[2]-2.0*rbcA[1];
1133 VB[3] = -0.25*rbcB[4];
1134 VB[2] = -0.5*rbcB[3];
1135 VB[1] = 4.0*VB[3]-rbcB[2];
1136 VB[0] = 3.0*VB[2]-2.0*rbcB[1];
1138 for (i = 0; i < NR_FOURDIHS; i++)
1140 fprintf(fp, "%sFourA[%d]=%15.8e", i == 0 ? "" : ", ", i, VA[i]);
1143 for (i = 0; i < NR_FOURDIHS; i++)
1145 fprintf(fp, "%sFourB[%d]=%15.8e", i == 0 ? "" : ", ", i, VB[i]);
1152 fprintf(fp, "dA=%15.8e, dB=%15.8e\n", iparams->constr.dA, iparams->constr.dB);
1155 fprintf(fp, "doh=%15.8e, dhh=%15.8e\n", iparams->settle.doh,
1156 iparams->settle.dhh);
1159 fprintf(fp, "a=%15.8e\n", iparams->vsite.a);
1164 fprintf(fp, "a=%15.8e, b=%15.8e\n", iparams->vsite.a, iparams->vsite.b);
1169 fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
1170 iparams->vsite.a, iparams->vsite.b, iparams->vsite.c);
1173 fprintf(fp, "n=%2d, a=%15.8e\n", iparams->vsiten.n, iparams->vsiten.a);
1178 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);
1181 fprintf(fp, "cmapA=%1d, cmapB=%1d\n", iparams->cmap.cmapA, iparams->cmap.cmapB);
1184 gmx_fatal(FARGS, "unknown function type %d (%s) in %s line %d",
1185 ftype, interaction_function[ftype].name, __FILE__, __LINE__);
1189 void pr_ilist(FILE *fp, int indent, const char *title,
1190 t_functype *functype, t_ilist *ilist, gmx_bool bShowNumbers)
1192 int i, j, k, type, ftype;
1195 if (available(fp, ilist, indent, title) && ilist->nr > 0)
1197 indent = pr_title(fp, indent, title);
1198 (void) pr_indent(fp, indent);
1199 fprintf(fp, "nr: %d\n", ilist->nr);
1202 (void) pr_indent(fp, indent);
1203 fprintf(fp, "iatoms:\n");
1204 iatoms = ilist->iatoms;
1205 for (i = j = 0; i < ilist->nr; )
1208 (void) pr_indent(fp, indent+INDENT);
1210 ftype = functype[type];
1211 (void) fprintf(fp, "%d type=%d (%s)",
1212 bShowNumbers ? j : -1, bShowNumbers ? type : -1,
1213 interaction_function[ftype].name);
1215 for (k = 0; k < interaction_function[ftype].nratoms; k++)
1217 (void) fprintf(fp, " %u", *(iatoms++));
1219 (void) fprintf(fp, "\n");
1220 i += 1+interaction_function[ftype].nratoms;
1222 fprintf(fp, "%5d%5d\n", i, iatoms[i]);
1230 static void pr_cmap(FILE *fp, int indent, const char *title,
1231 gmx_cmap_t *cmap_grid, gmx_bool bShowNumbers)
1236 dx = 360.0 / cmap_grid->grid_spacing;
1237 nelem = cmap_grid->grid_spacing*cmap_grid->grid_spacing;
1239 if (available(fp, cmap_grid, indent, title))
1241 fprintf(fp, "%s\n", title);
1243 for (i = 0; i < cmap_grid->ngrid; i++)
1246 fprintf(fp, "%8s %8s %8s %8s\n", "V", "dVdx", "dVdy", "d2dV");
1248 fprintf(fp, "grid[%3d]={\n", bShowNumbers ? i : -1);
1250 for (j = 0; j < nelem; j++)
1252 if ( (j%cmap_grid->grid_spacing) == 0)
1254 fprintf(fp, "%8.1f\n", idx);
1258 fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4]);
1259 fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+1]);
1260 fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+2]);
1261 fprintf(fp, "%8.3f\n", cmap_grid->cmapdata[i].cmap[j*4+3]);
1269 void pr_ffparams(FILE *fp, int indent, const char *title,
1270 gmx_ffparams_t *ffparams,
1271 gmx_bool bShowNumbers)
1275 indent = pr_title(fp, indent, title);
1276 (void) pr_indent(fp, indent);
1277 (void) fprintf(fp, "atnr=%d\n", ffparams->atnr);
1278 (void) pr_indent(fp, indent);
1279 (void) fprintf(fp, "ntypes=%d\n", ffparams->ntypes);
1280 for (i = 0; i < ffparams->ntypes; i++)
1282 (void) pr_indent(fp, indent+INDENT);
1283 (void) fprintf(fp, "functype[%d]=%s, ",
1284 bShowNumbers ? i : -1,
1285 interaction_function[ffparams->functype[i]].name);
1286 pr_iparams(fp, ffparams->functype[i], &ffparams->iparams[i]);
1288 (void) pr_double(fp, indent, "reppow", ffparams->reppow);
1289 (void) pr_real(fp, indent, "fudgeQQ", ffparams->fudgeQQ);
1290 pr_cmap(fp, indent, "cmap", &ffparams->cmap_grid, bShowNumbers);
1293 void pr_idef(FILE *fp, int indent, const char *title, t_idef *idef, gmx_bool bShowNumbers)
1297 if (available(fp, idef, indent, title))
1299 indent = pr_title(fp, indent, title);
1300 (void) pr_indent(fp, indent);
1301 (void) fprintf(fp, "atnr=%d\n", idef->atnr);
1302 (void) pr_indent(fp, indent);
1303 (void) fprintf(fp, "ntypes=%d\n", idef->ntypes);
1304 for (i = 0; i < idef->ntypes; i++)
1306 (void) pr_indent(fp, indent+INDENT);
1307 (void) fprintf(fp, "functype[%d]=%s, ",
1308 bShowNumbers ? i : -1,
1309 interaction_function[idef->functype[i]].name);
1310 pr_iparams(fp, idef->functype[i], &idef->iparams[i]);
1312 (void) pr_real(fp, indent, "fudgeQQ", idef->fudgeQQ);
1314 for (j = 0; (j < F_NRE); j++)
1316 pr_ilist(fp, indent, interaction_function[j].longname,
1317 idef->functype, &idef->il[j], bShowNumbers);
1322 static int pr_block_title(FILE *fp, int indent, const char *title, t_block *block)
1326 if (available(fp, block, indent, title))
1328 indent = pr_title(fp, indent, title);
1329 (void) pr_indent(fp, indent);
1330 (void) fprintf(fp, "nr=%d\n", block->nr);
1335 static int pr_blocka_title(FILE *fp, int indent, const char *title, t_blocka *block)
1339 if (available(fp, block, indent, title))
1341 indent = pr_title(fp, indent, title);
1342 (void) pr_indent(fp, indent);
1343 (void) fprintf(fp, "nr=%d\n", block->nr);
1344 (void) pr_indent(fp, indent);
1345 (void) fprintf(fp, "nra=%d\n", block->nra);
1350 static void low_pr_blocka(FILE *fp, int indent, const char *title, t_blocka *block, gmx_bool bShowNumbers)
1354 if (available(fp, block, indent, title))
1356 indent = pr_blocka_title(fp, indent, title, block);
1357 for (i = 0; i <= block->nr; i++)
1359 (void) pr_indent(fp, indent+INDENT);
1360 (void) fprintf(fp, "%s->index[%d]=%u\n",
1361 title, bShowNumbers ? i : -1, block->index[i]);
1363 for (i = 0; i < block->nra; i++)
1365 (void) pr_indent(fp, indent+INDENT);
1366 (void) fprintf(fp, "%s->a[%d]=%u\n",
1367 title, bShowNumbers ? i : -1, block->a[i]);
1372 void pr_block(FILE *fp, int indent, const char *title, t_block *block, gmx_bool bShowNumbers)
1374 int i, j, ok, size, start, end;
1376 if (available(fp, block, indent, title))
1378 indent = pr_block_title(fp, indent, title, block);
1381 if ((ok = (block->index[start] == 0)) == 0)
1383 (void) fprintf(fp, "block->index[%d] should be 0\n", start);
1387 for (i = 0; i < block->nr; i++)
1389 end = block->index[i+1];
1390 size = pr_indent(fp, indent);
1393 size += fprintf(fp, "%s[%d]={}\n", title, i);
1397 size += fprintf(fp, "%s[%d]={%d..%d}\n",
1398 title, bShowNumbers ? i : -1,
1399 bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
1407 void pr_blocka(FILE *fp, int indent, const char *title, t_blocka *block, gmx_bool bShowNumbers)
1409 int i, j, ok, size, start, end;
1411 if (available(fp, block, indent, title))
1413 indent = pr_blocka_title(fp, indent, title, block);
1416 if ((ok = (block->index[start] == 0)) == 0)
1418 (void) fprintf(fp, "block->index[%d] should be 0\n", start);
1422 for (i = 0; i < block->nr; i++)
1424 end = block->index[i+1];
1425 size = pr_indent(fp, indent);
1428 size += fprintf(fp, "%s[%d]={", title, i);
1432 size += fprintf(fp, "%s[%d][%d..%d]={",
1433 title, bShowNumbers ? i : -1,
1434 bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
1436 for (j = start; j < end; j++)
1440 size += fprintf(fp, ", ");
1442 if ((size) > (USE_WIDTH))
1444 (void) fprintf(fp, "\n");
1445 size = pr_indent(fp, indent+INDENT);
1447 size += fprintf(fp, "%u", block->a[j]);
1449 (void) fprintf(fp, "}\n");
1453 if ((end != block->nra) || (!ok))
1455 (void) pr_indent(fp, indent);
1456 (void) fprintf(fp, "tables inconsistent, dumping complete tables:\n");
1457 low_pr_blocka(fp, indent, title, block, bShowNumbers);
1462 static void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int n, gmx_bool bShowNumbers)
1466 if (available(fp, nm, indent, title))
1468 indent = pr_title_n(fp, indent, title, n);
1469 for (i = 0; i < n; i++)
1471 (void) pr_indent(fp, indent);
1472 (void) fprintf(fp, "%s[%d]={name=\"%s\"}\n",
1473 title, bShowNumbers ? i : -1, *(nm[i]));
1478 static void pr_strings2(FILE *fp, int indent, const char *title,
1479 char ***nm, char ***nmB, int n, gmx_bool bShowNumbers)
1483 if (available(fp, nm, indent, title))
1485 indent = pr_title_n(fp, indent, title, n);
1486 for (i = 0; i < n; i++)
1488 (void) pr_indent(fp, indent);
1489 (void) fprintf(fp, "%s[%d]={name=\"%s\",nameB=\"%s\"}\n",
1490 title, bShowNumbers ? i : -1, *(nm[i]), *(nmB[i]));
1495 static void pr_resinfo(FILE *fp, int indent, const char *title, t_resinfo *resinfo, int n, gmx_bool bShowNumbers)
1499 if (available(fp, resinfo, indent, title))
1501 indent = pr_title_n(fp, indent, title, n);
1502 for (i = 0; i < n; i++)
1504 (void) pr_indent(fp, indent);
1505 (void) fprintf(fp, "%s[%d]={name=\"%s\", nr=%d, ic='%c'}\n",
1506 title, bShowNumbers ? i : -1,
1507 *(resinfo[i].name), resinfo[i].nr,
1508 (resinfo[i].ic == '\0') ? ' ' : resinfo[i].ic);
1513 static void pr_atom(FILE *fp, int indent, const char *title, t_atom *atom, int n)
1517 if (available(fp, atom, indent, title))
1519 indent = pr_title_n(fp, indent, title, n);
1520 for (i = 0; i < n; i++)
1522 (void) pr_indent(fp, indent);
1523 fprintf(fp, "%s[%6d]={type=%3d, typeB=%3d, ptype=%8s, m=%12.5e, "
1524 "q=%12.5e, mB=%12.5e, qB=%12.5e, resind=%5d, atomnumber=%3d}\n",
1525 title, i, atom[i].type, atom[i].typeB, ptype_str[atom[i].ptype],
1526 atom[i].m, atom[i].q, atom[i].mB, atom[i].qB,
1527 atom[i].resind, atom[i].atomnumber);
1532 static void pr_grps(FILE *fp, const char *title, t_grps grps[], char **grpname[])
1536 for (i = 0; (i < egcNR); i++)
1538 fprintf(fp, "%s[%-12s] nr=%d, name=[", title, gtypes[i], grps[i].nr);
1539 for (j = 0; (j < grps[i].nr); j++)
1541 fprintf(fp, " %s", *(grpname[grps[i].nm_ind[j]]));
1547 static void pr_groups(FILE *fp, int indent,
1548 gmx_groups_t *groups,
1549 gmx_bool bShowNumbers)
1554 pr_grps(fp, "grp", groups->grps, groups->grpname);
1555 pr_strings(fp, indent, "grpname", groups->grpname, groups->ngrpname, bShowNumbers);
1557 (void) pr_indent(fp, indent);
1558 fprintf(fp, "groups ");
1559 for (g = 0; g < egcNR; g++)
1561 printf(" %5.5s", gtypes[g]);
1565 (void) pr_indent(fp, indent);
1566 fprintf(fp, "allocated ");
1568 for (g = 0; g < egcNR; g++)
1570 printf(" %5d", groups->ngrpnr[g]);
1571 nat_max = max(nat_max, groups->ngrpnr[g]);
1577 (void) pr_indent(fp, indent);
1578 fprintf(fp, "groupnr[%5s] =", "*");
1579 for (g = 0; g < egcNR; g++)
1581 fprintf(fp, " %3d ", 0);
1587 for (i = 0; i < nat_max; i++)
1589 (void) pr_indent(fp, indent);
1590 fprintf(fp, "groupnr[%5d] =", i);
1591 for (g = 0; g < egcNR; g++)
1593 fprintf(fp, " %3d ",
1594 groups->grpnr[g] ? groups->grpnr[g][i] : 0);
1601 void pr_atoms(FILE *fp, int indent, const char *title, t_atoms *atoms,
1602 gmx_bool bShownumbers)
1604 if (available(fp, atoms, indent, title))
1606 indent = pr_title(fp, indent, title);
1607 pr_atom(fp, indent, "atom", atoms->atom, atoms->nr);
1608 pr_strings(fp, indent, "atom", atoms->atomname, atoms->nr, bShownumbers);
1609 pr_strings2(fp, indent, "type", atoms->atomtype, atoms->atomtypeB, atoms->nr, bShownumbers);
1610 pr_resinfo(fp, indent, "residue", atoms->resinfo, atoms->nres, bShownumbers);
1615 void pr_atomtypes(FILE *fp, int indent, const char *title, t_atomtypes *atomtypes,
1616 gmx_bool bShowNumbers)
1619 if (available(fp, atomtypes, indent, title))
1621 indent = pr_title(fp, indent, title);
1622 for (i = 0; i < atomtypes->nr; i++)
1624 pr_indent(fp, indent);
1626 "atomtype[%3d]={radius=%12.5e, volume=%12.5e, gb_radius=%12.5e, surftens=%12.5e, atomnumber=%4d, S_hct=%12.5e)}\n",
1627 bShowNumbers ? i : -1, atomtypes->radius[i], atomtypes->vol[i],
1628 atomtypes->gb_radius[i],
1629 atomtypes->surftens[i], atomtypes->atomnumber[i], atomtypes->S_hct[i]);
1634 static void pr_moltype(FILE *fp, int indent, const char *title,
1635 gmx_moltype_t *molt, int n,
1636 gmx_ffparams_t *ffparams,
1637 gmx_bool bShowNumbers)
1641 indent = pr_title_n(fp, indent, title, n);
1642 (void) pr_indent(fp, indent);
1643 (void) fprintf(fp, "name=\"%s\"\n", *(molt->name));
1644 pr_atoms(fp, indent, "atoms", &(molt->atoms), bShowNumbers);
1645 pr_block(fp, indent, "cgs", &molt->cgs, bShowNumbers);
1646 pr_blocka(fp, indent, "excls", &molt->excls, bShowNumbers);
1647 for (j = 0; (j < F_NRE); j++)
1649 pr_ilist(fp, indent, interaction_function[j].longname,
1650 ffparams->functype, &molt->ilist[j], bShowNumbers);
1654 static void pr_molblock(FILE *fp, int indent, const char *title,
1655 gmx_molblock_t *molb, int n,
1656 gmx_moltype_t *molt)
1658 indent = pr_title_n(fp, indent, title, n);
1659 (void) pr_indent(fp, indent);
1660 (void) fprintf(fp, "%-20s = %d \"%s\"\n",
1661 "moltype", molb->type, *(molt[molb->type].name));
1662 pr_int(fp, indent, "#molecules", molb->nmol);
1663 pr_int(fp, indent, "#atoms_mol", molb->natoms_mol);
1664 pr_int(fp, indent, "#posres_xA", molb->nposres_xA);
1665 if (molb->nposres_xA > 0)
1667 pr_rvecs(fp, indent, "posres_xA", molb->posres_xA, molb->nposres_xA);
1669 pr_int(fp, indent, "#posres_xB", molb->nposres_xB);
1670 if (molb->nposres_xB > 0)
1672 pr_rvecs(fp, indent, "posres_xB", molb->posres_xB, molb->nposres_xB);
1676 void pr_mtop(FILE *fp, int indent, const char *title, gmx_mtop_t *mtop,
1677 gmx_bool bShowNumbers)
1681 if (available(fp, mtop, indent, title))
1683 indent = pr_title(fp, indent, title);
1684 (void) pr_indent(fp, indent);
1685 (void) fprintf(fp, "name=\"%s\"\n", *(mtop->name));
1686 pr_int(fp, indent, "#atoms", mtop->natoms);
1687 pr_int(fp, indent, "#molblock", mtop->nmolblock);
1688 for (mb = 0; mb < mtop->nmolblock; mb++)
1690 pr_molblock(fp, indent, "molblock", &mtop->molblock[mb], mb, mtop->moltype);
1692 pr_ffparams(fp, indent, "ffparams", &(mtop->ffparams), bShowNumbers);
1693 pr_atomtypes(fp, indent, "atomtypes", &(mtop->atomtypes), bShowNumbers);
1694 for (mt = 0; mt < mtop->nmoltype; mt++)
1696 pr_moltype(fp, indent, "moltype", &mtop->moltype[mt], mt,
1697 &mtop->ffparams, bShowNumbers);
1699 pr_groups(fp, indent, &mtop->groups, bShowNumbers);
1703 void pr_top(FILE *fp, int indent, const char *title, t_topology *top, gmx_bool bShowNumbers)
1705 if (available(fp, top, indent, title))
1707 indent = pr_title(fp, indent, title);
1708 (void) pr_indent(fp, indent);
1709 (void) fprintf(fp, "name=\"%s\"\n", *(top->name));
1710 pr_atoms(fp, indent, "atoms", &(top->atoms), bShowNumbers);
1711 pr_atomtypes(fp, indent, "atomtypes", &(top->atomtypes), bShowNumbers);
1712 pr_block(fp, indent, "cgs", &top->cgs, bShowNumbers);
1713 pr_block(fp, indent, "mols", &top->mols, bShowNumbers);
1714 pr_blocka(fp, indent, "excls", &top->excls, bShowNumbers);
1715 pr_idef(fp, indent, "idef", &top->idef, bShowNumbers);
1719 void pr_header(FILE *fp, int indent, const char *title, t_tpxheader *sh)
1723 if (available(fp, sh, indent, title))
1725 indent = pr_title(fp, indent, title);
1726 pr_indent(fp, indent);
1727 fprintf(fp, "bIr = %spresent\n", sh->bIr ? "" : "not ");
1728 pr_indent(fp, indent);
1729 fprintf(fp, "bBox = %spresent\n", sh->bBox ? "" : "not ");
1730 pr_indent(fp, indent);
1731 fprintf(fp, "bTop = %spresent\n", sh->bTop ? "" : "not ");
1732 pr_indent(fp, indent);
1733 fprintf(fp, "bX = %spresent\n", sh->bX ? "" : "not ");
1734 pr_indent(fp, indent);
1735 fprintf(fp, "bV = %spresent\n", sh->bV ? "" : "not ");
1736 pr_indent(fp, indent);
1737 fprintf(fp, "bF = %spresent\n", sh->bF ? "" : "not ");
1739 pr_indent(fp, indent);
1740 fprintf(fp, "natoms = %d\n", sh->natoms);
1741 pr_indent(fp, indent);
1742 fprintf(fp, "lambda = %e\n", sh->lambda);
1746 void pr_commrec(FILE *fp, int indent, t_commrec *cr)
1748 pr_indent(fp, indent);
1749 fprintf(fp, "commrec:\n");
1751 pr_indent(fp, indent);
1752 fprintf(fp, "nodeid = %d\n", cr->nodeid);
1753 pr_indent(fp, indent);
1754 fprintf(fp, "nnodes = %d\n", cr->nnodes);
1755 pr_indent(fp, indent);
1756 fprintf(fp, "npmenodes = %d\n", cr->npmenodes);
1758 pr_indent(fp,indent);
1759 fprintf(fp,"threadid = %d\n",cr->threadid);
1760 pr_indent(fp,indent);
1761 fprintf(fp,"nthreads = %d\n",cr->nthreads);