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,2014, 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! */
46 #include "gromacs/legacyheaders/typedefs.h"
47 #include "gromacs/legacyheaders/types/commrec.h"
48 #include "gromacs/legacyheaders/names.h"
49 #include "gromacs/legacyheaders/txtdump.h"
50 #include "gromacs/math/vec.h"
51 #include "gromacs/legacyheaders/macros.h"
53 #include "gromacs/utility/fatalerror.h"
54 #include "gromacs/utility/smalloc.h"
56 int pr_indent(FILE *fp, int n)
60 for (i = 0; i < n; i++)
62 (void) fprintf(fp, " ");
67 int available(FILE *fp, void *p, int indent, const char *title)
73 pr_indent(fp, indent);
75 (void) fprintf(fp, "%s: not available\n", title);
80 int pr_title(FILE *fp, int indent, const char *title)
82 (void) pr_indent(fp, indent);
83 (void) fprintf(fp, "%s:\n", title);
84 return (indent+INDENT);
87 int pr_title_n(FILE *fp, int indent, const char *title, int n)
89 (void) pr_indent(fp, indent);
90 (void) fprintf(fp, "%s (%d):\n", title, n);
91 return (indent+INDENT);
94 int pr_title_nxn(FILE *fp, int indent, const char *title, int n1, int n2)
96 (void) pr_indent(fp, indent);
97 (void) fprintf(fp, "%s (%dx%d):\n", title, n1, n2);
98 return (indent+INDENT);
101 void pr_ivec(FILE *fp, int indent, const char *title, int vec[], int n, gmx_bool bShowNumbers)
105 if (available(fp, vec, indent, title))
107 indent = pr_title_n(fp, indent, title, n);
108 for (i = 0; i < n; i++)
110 (void) pr_indent(fp, indent);
111 (void) fprintf(fp, "%s[%d]=%d\n", title, bShowNumbers ? i : -1, vec[i]);
116 void pr_ivec_block(FILE *fp, int indent, const char *title, int vec[], int n, gmx_bool bShowNumbers)
120 if (available(fp, vec, indent, title))
122 indent = pr_title_n(fp, indent, title, n);
127 while (j < n && vec[j] == vec[j-1]+1)
131 /* Print consecutive groups of 3 or more as blocks */
136 (void) pr_indent(fp, indent);
137 (void) fprintf(fp, "%s[%d]=%d\n",
138 title, bShowNumbers ? i : -1, vec[i]);
144 (void) pr_indent(fp, indent);
145 (void) fprintf(fp, "%s[%d,...,%d] = {%d,...,%d}\n",
147 bShowNumbers ? i : -1,
148 bShowNumbers ? j-1 : -1,
156 void pr_bvec(FILE *fp, int indent, const char *title, gmx_bool vec[], int n, gmx_bool bShowNumbers)
160 if (available(fp, vec, indent, title))
162 indent = pr_title_n(fp, indent, title, n);
163 for (i = 0; i < n; i++)
165 (void) pr_indent(fp, indent);
166 (void) fprintf(fp, "%s[%d]=%s\n", title, bShowNumbers ? i : -1,
172 void pr_ivecs(FILE *fp, int indent, const char *title, ivec vec[], int n, gmx_bool bShowNumbers)
176 if (available(fp, vec, indent, title))
178 indent = pr_title_nxn(fp, indent, title, n, DIM);
179 for (i = 0; i < n; i++)
181 (void) pr_indent(fp, indent);
182 (void) fprintf(fp, "%s[%d]={", title, bShowNumbers ? i : -1);
183 for (j = 0; j < DIM; j++)
187 (void) fprintf(fp, ", ");
189 fprintf(fp, "%d", vec[i][j]);
191 (void) fprintf(fp, "}\n");
196 void pr_rvec(FILE *fp, int indent, const char *title, real vec[], int n, gmx_bool bShowNumbers)
200 if (available(fp, vec, indent, title))
202 indent = pr_title_n(fp, indent, title, n);
203 for (i = 0; i < n; i++)
205 pr_indent(fp, indent);
206 fprintf(fp, "%s[%d]=%12.5e\n", title, bShowNumbers ? i : -1, vec[i]);
211 void pr_dvec(FILE *fp, int indent, const char *title, double vec[], int n, gmx_bool bShowNumbers)
215 if (available(fp, vec, indent, title))
217 indent = pr_title_n(fp, indent, title, n);
218 for (i = 0; i < n; i++)
220 pr_indent(fp, indent);
221 fprintf(fp, "%s[%d]=%12.5e\n", title, bShowNumbers ? i : -1, vec[i]);
228 void pr_mat(FILE *fp,int indent,char *title,matrix m)
232 if (available(fp,m,indent,title)) {
233 indent=pr_title_n(fp,indent,title,n);
235 pr_indent(fp,indent);
236 fprintf(fp,"%s[%d]=%12.5e %12.5e %12.5e\n",
237 title,bShowNumbers?i:-1,m[i][XX],m[i][YY],m[i][ZZ]);
243 void pr_rvecs_len(FILE *fp, int indent, const char *title, rvec vec[], int n)
247 if (available(fp, vec, indent, title))
249 indent = pr_title_nxn(fp, indent, title, n, DIM);
250 for (i = 0; i < n; i++)
252 (void) pr_indent(fp, indent);
253 (void) fprintf(fp, "%s[%5d]={", title, i);
254 for (j = 0; j < DIM; j++)
258 (void) fprintf(fp, ", ");
260 (void) fprintf(fp, "%12.5e", vec[i][j]);
262 (void) fprintf(fp, "} len=%12.5e\n", norm(vec[i]));
267 void pr_rvecs(FILE *fp, int indent, const char *title, rvec vec[], int n)
269 const char *fshort = "%12.5e";
270 const char *flong = "%15.8e";
274 if (getenv("GMX_PRINT_LONGFORMAT") != NULL)
283 if (available(fp, vec, indent, title))
285 indent = pr_title_nxn(fp, indent, title, n, DIM);
286 for (i = 0; i < n; i++)
288 (void) pr_indent(fp, indent);
289 (void) fprintf(fp, "%s[%5d]={", title, i);
290 for (j = 0; j < DIM; j++)
294 (void) fprintf(fp, ", ");
296 (void) fprintf(fp, format, vec[i][j]);
298 (void) fprintf(fp, "}\n");
304 void pr_rvecs_of_dim(FILE *fp, int indent, const char *title, rvec vec[], int n, int dim)
306 const char *fshort = "%12.5e";
307 const char *flong = "%15.8e";
311 if (getenv("GMX_PRINT_LONGFORMAT") != NULL)
320 if (available(fp, vec, indent, title))
322 indent = pr_title_nxn(fp, indent, title, n, dim);
323 for (i = 0; i < n; i++)
325 (void) pr_indent(fp, indent);
326 (void) fprintf(fp, "%s[%5d]={", title, i);
327 for (j = 0; j < dim; j++)
331 (void) fprintf(fp, ", ");
333 (void) fprintf(fp, format, vec[i][j]);
335 (void) fprintf(fp, "}\n");
340 void pr_reals(FILE *fp, int indent, const char *title, real *vec, int n)
344 if (available(fp, vec, indent, title))
346 (void) pr_indent(fp, indent);
347 (void) fprintf(fp, "%s:\t", title);
348 for (i = 0; i < n; i++)
350 fprintf(fp, " %10g", vec[i]);
352 (void) fprintf(fp, "\n");
356 void pr_doubles(FILE *fp, int indent, const char *title, double *vec, int n)
360 if (available(fp, vec, indent, title))
362 (void) pr_indent(fp, indent);
363 (void) fprintf(fp, "%s:\t", title);
364 for (i = 0; i < n; i++)
366 fprintf(fp, " %10g", vec[i]);
368 (void) fprintf(fp, "\n");
372 void pr_reals_of_dim(FILE *fp, int indent, const char *title, real *vec, int n, int dim)
375 const char *fshort = "%12.5e";
376 const char *flong = "%15.8e";
379 if (getenv("GMX_PRINT_LONGFORMAT") != NULL)
388 if (available(fp, vec, indent, title))
390 indent = pr_title_nxn(fp, indent, title, n, dim);
391 for (i = 0; i < n; i++)
393 (void) pr_indent(fp, indent);
394 (void) fprintf(fp, "%s[%5d]={", title, i);
395 for (j = 0; j < dim; j++)
399 (void) fprintf(fp, ", ");
401 (void) fprintf(fp, format, vec[i * dim + j]);
403 (void) fprintf(fp, "}\n");
408 static void pr_int(FILE *fp, int indent, const char *title, int i)
410 pr_indent(fp, indent);
411 fprintf(fp, "%-30s = %d\n", title, i);
414 static void pr_int64(FILE *fp, int indent, const char *title, gmx_int64_t i)
416 char buf[STEPSTRSIZE];
418 pr_indent(fp, indent);
419 fprintf(fp, "%-30s = %s\n", title, gmx_step_str(i, buf));
422 static void pr_real(FILE *fp, int indent, const char *title, real r)
424 pr_indent(fp, indent);
425 fprintf(fp, "%-30s = %g\n", title, r);
428 static void pr_double(FILE *fp, int indent, const char *title, double d)
430 pr_indent(fp, indent);
431 fprintf(fp, "%-30s = %g\n", title, d);
434 static void pr_str(FILE *fp, int indent, const char *title, const char *s)
436 pr_indent(fp, indent);
437 fprintf(fp, "%-30s = %s\n", title, s);
440 void pr_qm_opts(FILE *fp, int indent, const char *title, t_grpopts *opts)
444 fprintf(fp, "%s:\n", title);
446 pr_int(fp, indent, "ngQM", opts->ngQM);
449 pr_ivec(fp, indent, "QMmethod", opts->QMmethod, opts->ngQM, FALSE);
450 pr_ivec(fp, indent, "QMbasis", opts->QMbasis, opts->ngQM, FALSE);
451 pr_ivec(fp, indent, "QMcharge", opts->QMcharge, opts->ngQM, FALSE);
452 pr_ivec(fp, indent, "QMmult", opts->QMmult, opts->ngQM, FALSE);
453 pr_bvec(fp, indent, "SH", opts->bSH, opts->ngQM, FALSE);
454 pr_ivec(fp, indent, "CASorbitals", opts->CASorbitals, opts->ngQM, FALSE);
455 pr_ivec(fp, indent, "CASelectrons", opts->CASelectrons, opts->ngQM, FALSE);
456 pr_rvec(fp, indent, "SAon", opts->SAon, opts->ngQM, FALSE);
457 pr_rvec(fp, indent, "SAoff", opts->SAoff, opts->ngQM, FALSE);
458 pr_ivec(fp, indent, "SAsteps", opts->SAsteps, opts->ngQM, FALSE);
459 pr_bvec(fp, indent, "bOPT", opts->bOPT, opts->ngQM, FALSE);
460 pr_bvec(fp, indent, "bTS", opts->bTS, opts->ngQM, FALSE);
464 static void pr_grp_opts(FILE *out, int indent, const char *title, t_grpopts *opts,
471 fprintf(out, "%s:\n", title);
474 pr_indent(out, indent);
475 fprintf(out, "nrdf%s", bMDPformat ? " = " : ":");
476 for (i = 0; (i < opts->ngtc); i++)
478 fprintf(out, " %10g", opts->nrdf[i]);
482 pr_indent(out, indent);
483 fprintf(out, "ref-t%s", bMDPformat ? " = " : ":");
484 for (i = 0; (i < opts->ngtc); i++)
486 fprintf(out, " %10g", opts->ref_t[i]);
490 pr_indent(out, indent);
491 fprintf(out, "tau-t%s", bMDPformat ? " = " : ":");
492 for (i = 0; (i < opts->ngtc); i++)
494 fprintf(out, " %10g", opts->tau_t[i]);
498 /* Pretty-print the simulated annealing info */
499 fprintf(out, "annealing%s", bMDPformat ? " = " : ":");
500 for (i = 0; (i < opts->ngtc); i++)
502 fprintf(out, " %10s", EANNEAL(opts->annealing[i]));
506 fprintf(out, "annealing-npoints%s", bMDPformat ? " = " : ":");
507 for (i = 0; (i < opts->ngtc); i++)
509 fprintf(out, " %10d", opts->anneal_npoints[i]);
513 for (i = 0; (i < opts->ngtc); i++)
515 if (opts->anneal_npoints[i] > 0)
517 fprintf(out, "annealing-time [%d]:\t", i);
518 for (j = 0; (j < opts->anneal_npoints[i]); j++)
520 fprintf(out, " %10.1f", opts->anneal_time[i][j]);
523 fprintf(out, "annealing-temp [%d]:\t", i);
524 for (j = 0; (j < opts->anneal_npoints[i]); j++)
526 fprintf(out, " %10.1f", opts->anneal_temp[i][j]);
532 pr_indent(out, indent);
533 fprintf(out, "acc:\t");
534 for (i = 0; (i < opts->ngacc); i++)
536 for (m = 0; (m < DIM); m++)
538 fprintf(out, " %10g", opts->acc[i][m]);
543 pr_indent(out, indent);
544 fprintf(out, "nfreeze:");
545 for (i = 0; (i < opts->ngfrz); i++)
547 for (m = 0; (m < DIM); m++)
549 fprintf(out, " %10s", opts->nFreeze[i][m] ? "Y" : "N");
555 for (i = 0; (i < opts->ngener); i++)
557 pr_indent(out, indent);
558 fprintf(out, "energygrp-flags[%3d]:", i);
559 for (m = 0; (m < opts->ngener); m++)
561 fprintf(out, " %d", opts->egp_flags[opts->ngener*i+m]);
569 static void pr_matrix(FILE *fp, int indent, const char *title, rvec *m,
574 fprintf(fp, "%-10s = %g %g %g %g %g %g\n", title,
575 m[XX][XX], m[YY][YY], m[ZZ][ZZ], m[XX][YY], m[XX][ZZ], m[YY][ZZ]);
579 pr_rvecs(fp, indent, title, m, DIM);
583 static void pr_cosine(FILE *fp, int indent, const char *title, t_cosines *cos,
590 fprintf(fp, "%s = %d\n", title, cos->n);
594 indent = pr_title(fp, indent, title);
595 (void) pr_indent(fp, indent);
596 fprintf(fp, "n = %d\n", cos->n);
599 (void) pr_indent(fp, indent+2);
601 for (j = 0; (j < cos->n); j++)
603 fprintf(fp, " %e", cos->a[j]);
606 (void) pr_indent(fp, indent+2);
607 fprintf(fp, "phi =");
608 for (j = 0; (j < cos->n); j++)
610 fprintf(fp, " %e", cos->phi[j]);
617 #define PS(t, s) pr_str(fp, indent, t, s)
618 #define PI(t, s) pr_int(fp, indent, t, s)
619 #define PSTEP(t, s) pr_int64(fp, indent, t, s)
620 #define PR(t, s) pr_real(fp, indent, t, s)
621 #define PD(t, s) pr_double(fp, indent, t, s)
623 static void pr_pull_group(FILE *fp, int indent, int g, t_pull_group *pgrp)
625 pr_indent(fp, indent);
626 fprintf(fp, "pull-group %d:\n", g);
628 pr_ivec_block(fp, indent, "atom", pgrp->ind, pgrp->nat, TRUE);
629 pr_rvec(fp, indent, "weight", pgrp->weight, pgrp->nweight, TRUE);
630 PI("pbcatom", pgrp->pbcatom);
633 static void pr_pull_coord(FILE *fp, int indent, int c, t_pull_coord *pcrd)
635 pr_indent(fp, indent);
636 fprintf(fp, "pull-coord %d:\n", c);
637 PI("group[0]", pcrd->group[0]);
638 PI("group[1]", pcrd->group[1]);
639 pr_rvec(fp, indent, "origin", pcrd->origin, DIM, TRUE);
640 pr_rvec(fp, indent, "vec", pcrd->vec, DIM, TRUE);
641 PR("init", pcrd->init);
642 PR("rate", pcrd->rate);
647 static void pr_simtempvals(FILE *fp, int indent, t_simtemp *simtemp, int n_lambda)
649 PS("simulated-tempering-scaling", ESIMTEMP(simtemp->eSimTempScale));
650 PR("sim-temp-low", simtemp->simtemp_low);
651 PR("sim-temp-high", simtemp->simtemp_high);
652 pr_rvec(fp, indent, "simulated tempering temperatures", simtemp->temperatures, n_lambda, TRUE);
655 static void pr_expandedvals(FILE *fp, int indent, t_expanded *expand, int n_lambda)
658 PI("nstexpanded", expand->nstexpanded);
659 PS("lmc-stats", elamstats_names[expand->elamstats]);
660 PS("lmc-move", elmcmove_names[expand->elmcmove]);
661 PS("lmc-weights-equil", elmceq_names[expand->elmceq]);
662 if (expand->elmceq == elmceqNUMATLAM)
664 PI("weight-equil-number-all-lambda", expand->equil_n_at_lam);
666 if (expand->elmceq == elmceqSAMPLES)
668 PI("weight-equil-number-samples", expand->equil_samples);
670 if (expand->elmceq == elmceqSTEPS)
672 PI("weight-equil-number-steps", expand->equil_steps);
674 if (expand->elmceq == elmceqWLDELTA)
676 PR("weight-equil-wl-delta", expand->equil_wl_delta);
678 if (expand->elmceq == elmceqRATIO)
680 PR("weight-equil-count-ratio", expand->equil_ratio);
682 PI("lmc-seed", expand->lmc_seed);
683 PR("mc-temperature", expand->mc_temp);
684 PI("lmc-repeats", expand->lmc_repeats);
685 PI("lmc-gibbsdelta", expand->gibbsdeltalam);
686 PI("lmc-forced-nstart", expand->lmc_forced_nstart);
687 PS("symmetrized-transition-matrix", EBOOL(expand->bSymmetrizedTMatrix));
688 PI("nst-transition-matrix", expand->nstTij);
689 PI("mininum-var-min", expand->minvarmin); /*default is reasonable */
690 PI("weight-c-range", expand->c_range); /* default is just C=0 */
691 PR("wl-scale", expand->wl_scale);
692 PR("wl-ratio", expand->wl_ratio);
693 PR("init-wl-delta", expand->init_wl_delta);
694 PS("wl-oneovert", EBOOL(expand->bWLoneovert));
696 pr_indent(fp, indent);
697 pr_rvec(fp, indent, "init-lambda-weights", expand->init_lambda_weights, n_lambda, TRUE);
698 PS("init-weights", EBOOL(expand->bInit_weights));
701 static void pr_fepvals(FILE *fp, int indent, t_lambda *fep, gmx_bool bMDPformat)
705 PR("init-lambda", fep->init_lambda);
706 PI("init-lambda-state", fep->init_fep_state);
707 PR("delta-lambda", fep->delta_lambda);
708 PI("nstdhdl", fep->nstdhdl);
712 PI("n-lambdas", fep->n_lambda);
714 if (fep->n_lambda > 0)
716 pr_indent(fp, indent);
717 fprintf(fp, "separate-dvdl%s\n", bMDPformat ? " = " : ":");
718 for (i = 0; i < efptNR; i++)
720 fprintf(fp, "%18s = ", efpt_names[i]);
721 if (fep->separate_dvdl[i])
723 fprintf(fp, " TRUE");
727 fprintf(fp, " FALSE");
731 fprintf(fp, "all-lambdas%s\n", bMDPformat ? " = " : ":");
732 for (i = 0; i < efptNR; i++)
734 fprintf(fp, "%18s = ", efpt_names[i]);
735 for (j = 0; j < fep->n_lambda; j++)
737 fprintf(fp, " %10g", fep->all_lambda[i][j]);
742 PI("calc-lambda-neighbors", fep->lambda_neighbors);
743 PS("dhdl-print-energy", edHdLPrintEnergy_names[fep->edHdLPrintEnergy]);
744 PR("sc-alpha", fep->sc_alpha);
745 PI("sc-power", fep->sc_power);
746 PR("sc-r-power", fep->sc_r_power);
747 PR("sc-sigma", fep->sc_sigma);
748 PR("sc-sigma-min", fep->sc_sigma_min);
749 PS("sc-coul", EBOOL(fep->bScCoul));
750 PI("dh-hist-size", fep->dh_hist_size);
751 PD("dh-hist-spacing", fep->dh_hist_spacing);
752 PS("separate-dhdl-file", SEPDHDLFILETYPE(fep->separate_dhdl_file));
753 PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(fep->dhdl_derivatives));
756 static void pr_pull(FILE *fp, int indent, t_pull *pull)
760 PS("pull-geometry", EPULLGEOM(pull->eGeom));
761 pr_ivec(fp, indent, "pull-dim", pull->dim, DIM, TRUE);
762 PR("pull-r1", pull->cyl_r1);
763 PR("pull-r0", pull->cyl_r0);
764 PR("pull-constr-tol", pull->constr_tol);
765 PS("pull-print-reference", EBOOL(pull->bPrintRef));
766 PI("pull-nstxout", pull->nstxout);
767 PI("pull-nstfout", pull->nstfout);
768 PI("pull-ngroups", pull->ngroup);
769 for (g = 0; g < pull->ngroup; g++)
771 pr_pull_group(fp, indent, g, &pull->group[g]);
773 PI("pull-ncoords", pull->ncoord);
774 for (g = 0; g < pull->ncoord; g++)
776 pr_pull_coord(fp, indent, g, &pull->coord[g]);
780 static void pr_rotgrp(FILE *fp, int indent, int g, t_rotgrp *rotg)
782 pr_indent(fp, indent);
783 fprintf(fp, "rot-group %d:\n", g);
785 PS("rot-type", EROTGEOM(rotg->eType));
786 PS("rot-massw", EBOOL(rotg->bMassW));
787 pr_ivec_block(fp, indent, "atom", rotg->ind, rotg->nat, TRUE);
788 pr_rvecs(fp, indent, "x-ref", rotg->x_ref, rotg->nat);
789 pr_rvec(fp, indent, "rot-vec", rotg->vec, DIM, TRUE);
790 pr_rvec(fp, indent, "rot-pivot", rotg->pivot, DIM, TRUE);
791 PR("rot-rate", rotg->rate);
792 PR("rot-k", rotg->k);
793 PR("rot-slab-dist", rotg->slab_dist);
794 PR("rot-min-gauss", rotg->min_gaussian);
795 PR("rot-eps", rotg->eps);
796 PS("rot-fit-method", EROTFIT(rotg->eFittype));
797 PI("rot_potfit_nstep", rotg->PotAngle_nstep);
798 PR("rot_potfit_step", rotg->PotAngle_step);
801 static void pr_rot(FILE *fp, int indent, t_rot *rot)
805 PI("rot-nstrout", rot->nstrout);
806 PI("rot-nstsout", rot->nstsout);
807 PI("rot-ngroups", rot->ngrp);
808 for (g = 0; g < rot->ngrp; g++)
810 pr_rotgrp(fp, indent, g, &rot->grp[g]);
815 static void pr_swap(FILE *fp, int indent, t_swapcoords *swap)
821 PI("swap-frequency", swap->nstswap);
822 for (j = 0; j < 2; j++)
824 sprintf(str, "massw_split%d", j);
825 PS(str, EBOOL(swap->massw_split[j]));
826 sprintf(str, "split atoms group %d", j);
827 pr_ivec_block(fp, indent, str, swap->ind_split[j], swap->nat_split[j], TRUE);
829 pr_ivec_block(fp, indent, "swap atoms", swap->ind, swap->nat, TRUE);
830 pr_ivec_block(fp, indent, "solvent atoms", swap->ind_sol, swap->nat_sol, TRUE);
831 PR("cyl0-r", swap->cyl0r);
832 PR("cyl0-up", swap->cyl0u);
833 PR("cyl0-down", swap->cyl0l);
834 PR("cyl1-r", swap->cyl1r);
835 PR("cyl1-up", swap->cyl1u);
836 PR("cyl1-down", swap->cyl1l);
837 PI("coupl-steps", swap->nAverage);
838 for (j = 0; j < 2; j++)
840 sprintf(str, "anions%c", j+'A');
841 PI(str, swap->nanions[j]);
842 sprintf(str, "cations%c", j+'A');
843 PI(str, swap->ncations[j]);
845 PR("threshold", swap->threshold);
849 static void pr_imd(FILE *fp, int indent, t_IMD *imd)
851 PI("IMD-atoms", imd->nat);
852 pr_ivec_block(fp, indent, "atom", imd->ind, imd->nat, TRUE);
856 void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
859 const char *infbuf = "inf";
862 if (available(fp, ir, indent, title))
866 indent = pr_title(fp, indent, title);
868 /* Try to make this list appear in the same order as the
869 * options are written in the default mdout.mdp, and with
870 * the same user-exposed names to facilitate debugging.
872 PS("integrator", EI(ir->eI));
873 PR("tinit", ir->init_t);
874 PR("dt", ir->delta_t);
875 PSTEP("nsteps", ir->nsteps);
876 PSTEP("init-step", ir->init_step);
877 PI("simulation-part", ir->simulation_part);
878 PS("comm-mode", ECOM(ir->comm_mode));
879 PI("nstcomm", ir->nstcomm);
881 /* Langevin dynamics */
882 PR("bd-fric", ir->bd_fric);
883 PSTEP("ld-seed", ir->ld_seed);
885 /* Energy minimization */
886 PR("emtol", ir->em_tol);
887 PR("emstep", ir->em_stepsize);
888 PI("niter", ir->niter);
889 PR("fcstep", ir->fc_stepsize);
890 PI("nstcgsteep", ir->nstcgsteep);
891 PI("nbfgscorr", ir->nbfgscorr);
893 /* Test particle insertion */
894 PR("rtpi", ir->rtpi);
897 PI("nstxout", ir->nstxout);
898 PI("nstvout", ir->nstvout);
899 PI("nstfout", ir->nstfout);
900 PI("nstlog", ir->nstlog);
901 PI("nstcalcenergy", ir->nstcalcenergy);
902 PI("nstenergy", ir->nstenergy);
903 PI("nstxout-compressed", ir->nstxout_compressed);
904 PR("compressed-x-precision", ir->x_compression_precision);
906 /* Neighborsearching parameters */
907 PS("cutoff-scheme", ECUTSCHEME(ir->cutoff_scheme));
908 PI("nstlist", ir->nstlist);
909 PS("ns-type", ENS(ir->ns_type));
910 PS("pbc", EPBC(ir->ePBC));
911 PS("periodic-molecules", EBOOL(ir->bPeriodicMols));
912 PR("verlet-buffer-tolerance", ir->verletbuf_tol);
913 PR("rlist", ir->rlist);
914 PR("rlistlong", ir->rlistlong);
915 PR("nstcalclr", ir->nstcalclr);
917 /* Options for electrostatics and VdW */
918 PS("coulombtype", EELTYPE(ir->coulombtype));
919 PS("coulomb-modifier", INTMODIFIER(ir->coulomb_modifier));
920 PR("rcoulomb-switch", ir->rcoulomb_switch);
921 PR("rcoulomb", ir->rcoulomb);
922 if (ir->epsilon_r != 0)
924 PR("epsilon-r", ir->epsilon_r);
928 PS("epsilon-r", infbuf);
930 if (ir->epsilon_rf != 0)
932 PR("epsilon-rf", ir->epsilon_rf);
936 PS("epsilon-rf", infbuf);
938 PS("vdw-type", EVDWTYPE(ir->vdwtype));
939 PS("vdw-modifier", INTMODIFIER(ir->vdw_modifier));
940 PR("rvdw-switch", ir->rvdw_switch);
941 PR("rvdw", ir->rvdw);
942 PS("DispCorr", EDISPCORR(ir->eDispCorr));
943 PR("table-extension", ir->tabext);
945 PR("fourierspacing", ir->fourier_spacing);
946 PI("fourier-nx", ir->nkx);
947 PI("fourier-ny", ir->nky);
948 PI("fourier-nz", ir->nkz);
949 PI("pme-order", ir->pme_order);
950 PR("ewald-rtol", ir->ewald_rtol);
951 PR("ewald-rtol-lj", ir->ewald_rtol_lj);
952 PS("lj-pme-comb-rule", ELJPMECOMBNAMES(ir->ljpme_combination_rule));
953 PR("ewald-geometry", ir->ewald_geometry);
954 PR("epsilon-surface", ir->epsilon_surface);
956 /* Implicit solvent */
957 PS("implicit-solvent", EIMPLICITSOL(ir->implicit_solvent));
959 /* Generalized born electrostatics */
960 PS("gb-algorithm", EGBALGORITHM(ir->gb_algorithm));
961 PI("nstgbradii", ir->nstgbradii);
962 PR("rgbradii", ir->rgbradii);
963 PR("gb-epsilon-solvent", ir->gb_epsilon_solvent);
964 PR("gb-saltconc", ir->gb_saltconc);
965 PR("gb-obc-alpha", ir->gb_obc_alpha);
966 PR("gb-obc-beta", ir->gb_obc_beta);
967 PR("gb-obc-gamma", ir->gb_obc_gamma);
968 PR("gb-dielectric-offset", ir->gb_dielectric_offset);
969 PS("sa-algorithm", ESAALGORITHM(ir->gb_algorithm));
970 PR("sa-surface-tension", ir->sa_surface_tension);
972 /* Options for weak coupling algorithms */
973 PS("tcoupl", ETCOUPLTYPE(ir->etc));
974 PI("nsttcouple", ir->nsttcouple);
975 PI("nh-chain-length", ir->opts.nhchainlength);
976 PS("print-nose-hoover-chain-variables", EBOOL(ir->bPrintNHChains));
978 PS("pcoupl", EPCOUPLTYPE(ir->epc));
979 PS("pcoupltype", EPCOUPLTYPETYPE(ir->epct));
980 PI("nstpcouple", ir->nstpcouple);
981 PR("tau-p", ir->tau_p);
982 pr_matrix(fp, indent, "compressibility", ir->compress, bMDPformat);
983 pr_matrix(fp, indent, "ref-p", ir->ref_p, bMDPformat);
984 PS("refcoord-scaling", EREFSCALINGTYPE(ir->refcoord_scaling));
988 fprintf(fp, "posres-com = %g %g %g\n", ir->posres_com[XX],
989 ir->posres_com[YY], ir->posres_com[ZZ]);
990 fprintf(fp, "posres-comB = %g %g %g\n", ir->posres_comB[XX],
991 ir->posres_comB[YY], ir->posres_comB[ZZ]);
995 pr_rvec(fp, indent, "posres-com", ir->posres_com, DIM, TRUE);
996 pr_rvec(fp, indent, "posres-comB", ir->posres_comB, DIM, TRUE);
1000 PS("QMMM", EBOOL(ir->bQMMM));
1001 PI("QMconstraints", ir->QMconstraints);
1002 PI("QMMMscheme", ir->QMMMscheme);
1003 PR("MMChargeScaleFactor", ir->scalefactor);
1004 pr_qm_opts(fp, indent, "qm-opts", &(ir->opts));
1006 /* CONSTRAINT OPTIONS */
1007 PS("constraint-algorithm", ECONSTRTYPE(ir->eConstrAlg));
1008 PS("continuation", EBOOL(ir->bContinuation));
1010 PS("Shake-SOR", EBOOL(ir->bShakeSOR));
1011 PR("shake-tol", ir->shake_tol);
1012 PI("lincs-order", ir->nProjOrder);
1013 PI("lincs-iter", ir->nLincsIter);
1014 PR("lincs-warnangle", ir->LincsWarnAngle);
1017 PI("nwall", ir->nwall);
1018 PS("wall-type", EWALLTYPE(ir->wall_type));
1019 PR("wall-r-linpot", ir->wall_r_linpot);
1021 PI("wall-atomtype[0]", ir->wall_atomtype[0]);
1022 PI("wall-atomtype[1]", ir->wall_atomtype[1]);
1024 PR("wall-density[0]", ir->wall_density[0]);
1025 PR("wall-density[1]", ir->wall_density[1]);
1026 PR("wall-ewald-zfac", ir->wall_ewald_zfac);
1029 PS("pull", EPULLTYPE(ir->ePull));
1030 if (ir->ePull != epullNO)
1032 pr_pull(fp, indent, ir->pull);
1035 /* ENFORCED ROTATION */
1036 PS("rotation", EBOOL(ir->bRot));
1039 pr_rot(fp, indent, ir->rot);
1042 /* INTERACTIVE MD */
1043 PS("interactiveMD", EBOOL(ir->bIMD));
1046 pr_imd(fp, indent, ir->imd);
1049 /* NMR refinement stuff */
1050 PS("disre", EDISRETYPE(ir->eDisre));
1051 PS("disre-weighting", EDISREWEIGHTING(ir->eDisreWeighting));
1052 PS("disre-mixed", EBOOL(ir->bDisreMixed));
1053 PR("dr-fc", ir->dr_fc);
1054 PR("dr-tau", ir->dr_tau);
1055 PR("nstdisreout", ir->nstdisreout);
1057 PR("orire-fc", ir->orires_fc);
1058 PR("orire-tau", ir->orires_tau);
1059 PR("nstorireout", ir->nstorireout);
1061 /* FREE ENERGY VARIABLES */
1062 PS("free-energy", EFEPTYPE(ir->efep));
1063 if (ir->efep != efepNO || ir->bSimTemp)
1065 pr_fepvals(fp, indent, ir->fepvals, bMDPformat);
1069 pr_expandedvals(fp, indent, ir->expandedvals, ir->fepvals->n_lambda);
1072 /* NON-equilibrium MD stuff */
1073 PR("cos-acceleration", ir->cos_accel);
1074 pr_matrix(fp, indent, "deform", ir->deform, bMDPformat);
1076 /* SIMULATED TEMPERING */
1077 PS("simulated-tempering", EBOOL(ir->bSimTemp));
1080 pr_simtempvals(fp, indent, ir->simtempvals, ir->fepvals->n_lambda);
1083 /* ELECTRIC FIELDS */
1084 pr_cosine(fp, indent, "E-x", &(ir->ex[XX]), bMDPformat);
1085 pr_cosine(fp, indent, "E-xt", &(ir->et[XX]), bMDPformat);
1086 pr_cosine(fp, indent, "E-y", &(ir->ex[YY]), bMDPformat);
1087 pr_cosine(fp, indent, "E-yt", &(ir->et[YY]), bMDPformat);
1088 pr_cosine(fp, indent, "E-z", &(ir->ex[ZZ]), bMDPformat);
1089 pr_cosine(fp, indent, "E-zt", &(ir->et[ZZ]), bMDPformat);
1091 /* ION/WATER SWAPPING FOR COMPUTATIONAL ELECTROPHYSIOLOGY */
1092 PS("swapcoords", ESWAPTYPE(ir->eSwapCoords));
1093 if (ir->eSwapCoords != eswapNO)
1095 pr_swap(fp, indent, ir->swap);
1098 /* AdResS PARAMETERS */
1099 PS("adress", EBOOL(ir->bAdress));
1102 PS("adress-type", EADRESSTYPE(ir->adress->type));
1103 PR("adress-const-wf", ir->adress->const_wf);
1104 PR("adress-ex-width", ir->adress->ex_width);
1105 PR("adress-hy-width", ir->adress->hy_width);
1106 PR("adress-ex-forcecap", ir->adress->ex_forcecap);
1107 PS("adress-interface-correction", EADRESSICTYPE(ir->adress->icor));
1108 PS("adress-site", EADRESSSITETYPE(ir->adress->site));
1109 pr_rvec(fp, indent, "adress-reference-coords", ir->adress->refs, DIM, TRUE);
1110 PS("adress-do-hybridpairs", EBOOL(ir->adress->do_hybridpairs));
1113 /* USER-DEFINED THINGIES */
1114 PI("userint1", ir->userint1);
1115 PI("userint2", ir->userint2);
1116 PI("userint3", ir->userint3);
1117 PI("userint4", ir->userint4);
1118 PR("userreal1", ir->userreal1);
1119 PR("userreal2", ir->userreal2);
1120 PR("userreal3", ir->userreal3);
1121 PR("userreal4", ir->userreal4);
1123 pr_grp_opts(fp, indent, "grpopts", &(ir->opts), bMDPformat);
1130 static void pr_harm(FILE *fp, t_iparams *iparams, const char *r, const char *kr)
1132 fprintf(fp, "%sA=%12.5e, %sA=%12.5e, %sB=%12.5e, %sB=%12.5e\n",
1133 r, iparams->harmonic.rA, kr, iparams->harmonic.krA,
1134 r, iparams->harmonic.rB, kr, iparams->harmonic.krB);
1137 void pr_iparams(FILE *fp, t_functype ftype, t_iparams *iparams)
1140 real VA[4], VB[4], *rbcA, *rbcB;
1146 pr_harm(fp, iparams, "th", "ct");
1148 case F_CROSS_BOND_BONDS:
1149 fprintf(fp, "r1e=%15.8e, r2e=%15.8e, krr=%15.8e\n",
1150 iparams->cross_bb.r1e, iparams->cross_bb.r2e,
1151 iparams->cross_bb.krr);
1153 case F_CROSS_BOND_ANGLES:
1154 fprintf(fp, "r1e=%15.8e, r1e=%15.8e, r3e=%15.8e, krt=%15.8e\n",
1155 iparams->cross_ba.r1e, iparams->cross_ba.r2e,
1156 iparams->cross_ba.r3e, iparams->cross_ba.krt);
1158 case F_LINEAR_ANGLES:
1159 fprintf(fp, "klinA=%15.8e, aA=%15.8e, klinB=%15.8e, aB=%15.8e\n",
1160 iparams->linangle.klinA, iparams->linangle.aA,
1161 iparams->linangle.klinB, iparams->linangle.aB);
1163 case F_UREY_BRADLEY:
1164 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);
1166 case F_QUARTIC_ANGLES:
1167 fprintf(fp, "theta=%15.8e", iparams->qangle.theta);
1168 for (i = 0; i < 5; i++)
1170 fprintf(fp, ", c%c=%15.8e", '0'+i, iparams->qangle.c[i]);
1175 fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
1176 iparams->bham.a, iparams->bham.b, iparams->bham.c);
1181 pr_harm(fp, iparams, "b0", "cb");
1184 pr_harm(fp, iparams, "xi", "cx");
1187 fprintf(fp, "b0A=%15.8e, cbA=%15.8e, betaA=%15.8e, b0B=%15.8e, cbB=%15.8e, betaB=%15.8e\n",
1188 iparams->morse.b0A, iparams->morse.cbA, iparams->morse.betaA,
1189 iparams->morse.b0B, iparams->morse.cbB, iparams->morse.betaB);
1192 fprintf(fp, "b0=%15.8e, kb=%15.8e, kcub=%15.8e\n",
1193 iparams->cubic.b0, iparams->cubic.kb, iparams->cubic.kcub);
1199 fprintf(fp, "bm=%15.8e, kb=%15.8e\n", iparams->fene.bm, iparams->fene.kb);
1202 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",
1203 iparams->restraint.lowA, iparams->restraint.up1A,
1204 iparams->restraint.up2A, iparams->restraint.kA,
1205 iparams->restraint.lowB, iparams->restraint.up1B,
1206 iparams->restraint.up2B, iparams->restraint.kB);
1212 fprintf(fp, "tab=%d, kA=%15.8e, kB=%15.8e\n",
1213 iparams->tab.table, iparams->tab.kA, iparams->tab.kB);
1215 case F_POLARIZATION:
1216 fprintf(fp, "alpha=%15.8e\n", iparams->polarize.alpha);
1219 fprintf(fp, "alpha=%15.8e drcut=%15.8e khyp=%15.8e\n",
1220 iparams->anharm_polarize.alpha,
1221 iparams->anharm_polarize.drcut,
1222 iparams->anharm_polarize.khyp);
1225 fprintf(fp, "a=%15.8e, alpha1=%15.8e, alpha2=%15.8e, rfac=%15.8e\n",
1226 iparams->thole.a, iparams->thole.alpha1, iparams->thole.alpha2,
1227 iparams->thole.rfac);
1230 fprintf(fp, "al_x=%15.8e, al_y=%15.8e, al_z=%15.8e, rOH=%9.6f, rHH=%9.6f, rOD=%9.6f\n",
1231 iparams->wpol.al_x, iparams->wpol.al_y, iparams->wpol.al_z,
1232 iparams->wpol.rOH, iparams->wpol.rHH, iparams->wpol.rOD);
1235 fprintf(fp, "c6=%15.8e, c12=%15.8e\n", iparams->lj.c6, iparams->lj.c12);
1238 fprintf(fp, "c6A=%15.8e, c12A=%15.8e, c6B=%15.8e, c12B=%15.8e\n",
1239 iparams->lj14.c6A, iparams->lj14.c12A,
1240 iparams->lj14.c6B, iparams->lj14.c12B);
1243 fprintf(fp, "fqq=%15.8e, qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
1245 iparams->ljc14.qi, iparams->ljc14.qj,
1246 iparams->ljc14.c6, iparams->ljc14.c12);
1248 case F_LJC_PAIRS_NB:
1249 fprintf(fp, "qi=%15.8e, qj=%15.8e, c6=%15.8e, c12=%15.8e\n",
1250 iparams->ljcnb.qi, iparams->ljcnb.qj,
1251 iparams->ljcnb.c6, iparams->ljcnb.c12);
1257 fprintf(fp, "phiA=%15.8e, cpA=%15.8e, phiB=%15.8e, cpB=%15.8e, mult=%d\n",
1258 iparams->pdihs.phiA, iparams->pdihs.cpA,
1259 iparams->pdihs.phiB, iparams->pdihs.cpB,
1260 iparams->pdihs.mult);
1263 fprintf(fp, "label=%4d, type=%1d, low=%15.8e, up1=%15.8e, up2=%15.8e, fac=%15.8e)\n",
1264 iparams->disres.label, iparams->disres.type,
1265 iparams->disres.low, iparams->disres.up1,
1266 iparams->disres.up2, iparams->disres.kfac);
1269 fprintf(fp, "ex=%4d, label=%d, power=%4d, c=%15.8e, obs=%15.8e, kfac=%15.8e)\n",
1270 iparams->orires.ex, iparams->orires.label, iparams->orires.power,
1271 iparams->orires.c, iparams->orires.obs, iparams->orires.kfac);
1274 fprintf(fp, "phiA=%15.8e, dphiA=%15.8e, kfacA=%15.8e, phiB=%15.8e, dphiB=%15.8e, kfacB=%15.8e\n",
1275 iparams->dihres.phiA, iparams->dihres.dphiA, iparams->dihres.kfacA,
1276 iparams->dihres.phiB, iparams->dihres.dphiB, iparams->dihres.kfacB);
1279 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",
1280 iparams->posres.pos0A[XX], iparams->posres.pos0A[YY],
1281 iparams->posres.pos0A[ZZ], iparams->posres.fcA[XX],
1282 iparams->posres.fcA[YY], iparams->posres.fcA[ZZ],
1283 iparams->posres.pos0B[XX], iparams->posres.pos0B[YY],
1284 iparams->posres.pos0B[ZZ], iparams->posres.fcB[XX],
1285 iparams->posres.fcB[YY], iparams->posres.fcB[ZZ]);
1288 fprintf(fp, "pos0=(%15.8e,%15.8e,%15.8e), geometry=%d, r=%15.8e, k=%15.8e\n",
1289 iparams->fbposres.pos0[XX], iparams->fbposres.pos0[YY],
1290 iparams->fbposres.pos0[ZZ], iparams->fbposres.geom,
1291 iparams->fbposres.r, iparams->fbposres.k);
1294 for (i = 0; i < NR_RBDIHS; i++)
1296 fprintf(fp, "%srbcA[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcA[i]);
1299 for (i = 0; i < NR_RBDIHS; i++)
1301 fprintf(fp, "%srbcB[%d]=%15.8e", i == 0 ? "" : ", ", i, iparams->rbdihs.rbcB[i]);
1306 /* Use the OPLS -> Ryckaert-Bellemans formula backwards to get the
1307 * OPLS potential constants back.
1309 rbcA = iparams->rbdihs.rbcA;
1310 rbcB = iparams->rbdihs.rbcB;
1312 VA[3] = -0.25*rbcA[4];
1313 VA[2] = -0.5*rbcA[3];
1314 VA[1] = 4.0*VA[3]-rbcA[2];
1315 VA[0] = 3.0*VA[2]-2.0*rbcA[1];
1317 VB[3] = -0.25*rbcB[4];
1318 VB[2] = -0.5*rbcB[3];
1319 VB[1] = 4.0*VB[3]-rbcB[2];
1320 VB[0] = 3.0*VB[2]-2.0*rbcB[1];
1322 for (i = 0; i < NR_FOURDIHS; i++)
1324 fprintf(fp, "%sFourA[%d]=%15.8e", i == 0 ? "" : ", ", i, VA[i]);
1327 for (i = 0; i < NR_FOURDIHS; i++)
1329 fprintf(fp, "%sFourB[%d]=%15.8e", i == 0 ? "" : ", ", i, VB[i]);
1336 fprintf(fp, "dA=%15.8e, dB=%15.8e\n", iparams->constr.dA, iparams->constr.dB);
1339 fprintf(fp, "doh=%15.8e, dhh=%15.8e\n", iparams->settle.doh,
1340 iparams->settle.dhh);
1343 fprintf(fp, "a=%15.8e\n", iparams->vsite.a);
1348 fprintf(fp, "a=%15.8e, b=%15.8e\n", iparams->vsite.a, iparams->vsite.b);
1353 fprintf(fp, "a=%15.8e, b=%15.8e, c=%15.8e\n",
1354 iparams->vsite.a, iparams->vsite.b, iparams->vsite.c);
1357 fprintf(fp, "n=%2d, a=%15.8e\n", iparams->vsiten.n, iparams->vsiten.a);
1362 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);
1365 fprintf(fp, "cmapA=%1d, cmapB=%1d\n", iparams->cmap.cmapA, iparams->cmap.cmapB);
1368 pr_harm(fp, iparams, "ktheta", "costheta0");
1371 fprintf(fp, "phiA=%15.8e, cpA=%15.8e",
1372 iparams->pdihs.phiA, iparams->pdihs.cpA);
1375 fprintf(fp, "kphi=%15.8e", iparams->cbtdihs.cbtcA[0]);
1376 for (i = 1; i < NR_CBTDIHS; i++)
1378 fprintf(fp, ", cbtcA[%d]=%15.8e", i-1, iparams->cbtdihs.cbtcA[i]);
1383 gmx_fatal(FARGS, "unknown function type %d (%s) in %s line %d",
1384 ftype, interaction_function[ftype].name, __FILE__, __LINE__);
1388 void pr_ilist(FILE *fp, int indent, const char *title,
1389 t_functype *functype, t_ilist *ilist, gmx_bool bShowNumbers)
1391 int i, j, k, type, ftype;
1394 if (available(fp, ilist, indent, title) && ilist->nr > 0)
1396 indent = pr_title(fp, indent, title);
1397 (void) pr_indent(fp, indent);
1398 fprintf(fp, "nr: %d\n", ilist->nr);
1401 (void) pr_indent(fp, indent);
1402 fprintf(fp, "iatoms:\n");
1403 iatoms = ilist->iatoms;
1404 for (i = j = 0; i < ilist->nr; )
1407 (void) pr_indent(fp, indent+INDENT);
1409 ftype = functype[type];
1410 (void) fprintf(fp, "%d type=%d (%s)",
1411 bShowNumbers ? j : -1, bShowNumbers ? type : -1,
1412 interaction_function[ftype].name);
1414 for (k = 0; k < interaction_function[ftype].nratoms; k++)
1416 (void) fprintf(fp, " %u", *(iatoms++));
1418 (void) fprintf(fp, "\n");
1419 i += 1+interaction_function[ftype].nratoms;
1421 fprintf(fp, "%5d%5d\n", i, iatoms[i]);
1429 static void pr_cmap(FILE *fp, int indent, const char *title,
1430 gmx_cmap_t *cmap_grid, gmx_bool bShowNumbers)
1435 dx = 360.0 / cmap_grid->grid_spacing;
1436 nelem = cmap_grid->grid_spacing*cmap_grid->grid_spacing;
1438 if (available(fp, cmap_grid, indent, title))
1440 fprintf(fp, "%s\n", title);
1442 for (i = 0; i < cmap_grid->ngrid; i++)
1445 fprintf(fp, "%8s %8s %8s %8s\n", "V", "dVdx", "dVdy", "d2dV");
1447 fprintf(fp, "grid[%3d]={\n", bShowNumbers ? i : -1);
1449 for (j = 0; j < nelem; j++)
1451 if ( (j%cmap_grid->grid_spacing) == 0)
1453 fprintf(fp, "%8.1f\n", idx);
1457 fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4]);
1458 fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+1]);
1459 fprintf(fp, "%8.3f ", cmap_grid->cmapdata[i].cmap[j*4+2]);
1460 fprintf(fp, "%8.3f\n", cmap_grid->cmapdata[i].cmap[j*4+3]);
1468 void pr_ffparams(FILE *fp, int indent, const char *title,
1469 gmx_ffparams_t *ffparams,
1470 gmx_bool bShowNumbers)
1474 indent = pr_title(fp, indent, title);
1475 (void) pr_indent(fp, indent);
1476 (void) fprintf(fp, "atnr=%d\n", ffparams->atnr);
1477 (void) pr_indent(fp, indent);
1478 (void) fprintf(fp, "ntypes=%d\n", ffparams->ntypes);
1479 for (i = 0; i < ffparams->ntypes; i++)
1481 (void) pr_indent(fp, indent+INDENT);
1482 (void) fprintf(fp, "functype[%d]=%s, ",
1483 bShowNumbers ? i : -1,
1484 interaction_function[ffparams->functype[i]].name);
1485 pr_iparams(fp, ffparams->functype[i], &ffparams->iparams[i]);
1487 (void) pr_double(fp, indent, "reppow", ffparams->reppow);
1488 (void) pr_real(fp, indent, "fudgeQQ", ffparams->fudgeQQ);
1489 pr_cmap(fp, indent, "cmap", &ffparams->cmap_grid, bShowNumbers);
1492 void pr_idef(FILE *fp, int indent, const char *title, t_idef *idef, gmx_bool bShowNumbers)
1496 if (available(fp, idef, indent, title))
1498 indent = pr_title(fp, indent, title);
1499 (void) pr_indent(fp, indent);
1500 (void) fprintf(fp, "atnr=%d\n", idef->atnr);
1501 (void) pr_indent(fp, indent);
1502 (void) fprintf(fp, "ntypes=%d\n", idef->ntypes);
1503 for (i = 0; i < idef->ntypes; i++)
1505 (void) pr_indent(fp, indent+INDENT);
1506 (void) fprintf(fp, "functype[%d]=%s, ",
1507 bShowNumbers ? i : -1,
1508 interaction_function[idef->functype[i]].name);
1509 pr_iparams(fp, idef->functype[i], &idef->iparams[i]);
1511 (void) pr_real(fp, indent, "fudgeQQ", idef->fudgeQQ);
1513 for (j = 0; (j < F_NRE); j++)
1515 pr_ilist(fp, indent, interaction_function[j].longname,
1516 idef->functype, &idef->il[j], bShowNumbers);
1521 static int pr_block_title(FILE *fp, int indent, const char *title, t_block *block)
1525 if (available(fp, block, indent, title))
1527 indent = pr_title(fp, indent, title);
1528 (void) pr_indent(fp, indent);
1529 (void) fprintf(fp, "nr=%d\n", block->nr);
1534 static int pr_blocka_title(FILE *fp, int indent, const char *title, t_blocka *block)
1538 if (available(fp, block, indent, title))
1540 indent = pr_title(fp, indent, title);
1541 (void) pr_indent(fp, indent);
1542 (void) fprintf(fp, "nr=%d\n", block->nr);
1543 (void) pr_indent(fp, indent);
1544 (void) fprintf(fp, "nra=%d\n", block->nra);
1549 static void low_pr_blocka(FILE *fp, int indent, const char *title, t_blocka *block, gmx_bool bShowNumbers)
1553 if (available(fp, block, indent, title))
1555 indent = pr_blocka_title(fp, indent, title, block);
1556 for (i = 0; i <= block->nr; i++)
1558 (void) pr_indent(fp, indent+INDENT);
1559 (void) fprintf(fp, "%s->index[%d]=%d\n",
1560 title, bShowNumbers ? i : -1, block->index[i]);
1562 for (i = 0; i < block->nra; i++)
1564 (void) pr_indent(fp, indent+INDENT);
1565 (void) fprintf(fp, "%s->a[%d]=%d\n",
1566 title, bShowNumbers ? i : -1, block->a[i]);
1571 void pr_block(FILE *fp, int indent, const char *title, t_block *block, gmx_bool bShowNumbers)
1573 int i, j, ok, size, start, end;
1575 if (available(fp, block, indent, title))
1577 indent = pr_block_title(fp, indent, title, block);
1580 if ((ok = (block->index[start] == 0)) == 0)
1582 (void) fprintf(fp, "block->index[%d] should be 0\n", start);
1586 for (i = 0; i < block->nr; i++)
1588 end = block->index[i+1];
1589 size = pr_indent(fp, indent);
1592 size += fprintf(fp, "%s[%d]={}\n", title, i);
1596 size += fprintf(fp, "%s[%d]={%d..%d}\n",
1597 title, bShowNumbers ? i : -1,
1598 bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
1606 void pr_blocka(FILE *fp, int indent, const char *title, t_blocka *block, gmx_bool bShowNumbers)
1608 int i, j, ok, size, start, end;
1610 if (available(fp, block, indent, title))
1612 indent = pr_blocka_title(fp, indent, title, block);
1615 if ((ok = (block->index[start] == 0)) == 0)
1617 (void) fprintf(fp, "block->index[%d] should be 0\n", start);
1621 for (i = 0; i < block->nr; i++)
1623 end = block->index[i+1];
1624 size = pr_indent(fp, indent);
1627 size += fprintf(fp, "%s[%d]={", title, i);
1631 size += fprintf(fp, "%s[%d][%d..%d]={",
1632 title, bShowNumbers ? i : -1,
1633 bShowNumbers ? start : -1, bShowNumbers ? end-1 : -1);
1635 for (j = start; j < end; j++)
1639 size += fprintf(fp, ", ");
1641 if ((size) > (USE_WIDTH))
1643 (void) fprintf(fp, "\n");
1644 size = pr_indent(fp, indent+INDENT);
1646 size += fprintf(fp, "%d", block->a[j]);
1648 (void) fprintf(fp, "}\n");
1652 if ((end != block->nra) || (!ok))
1654 (void) pr_indent(fp, indent);
1655 (void) fprintf(fp, "tables inconsistent, dumping complete tables:\n");
1656 low_pr_blocka(fp, indent, title, block, bShowNumbers);
1661 static void pr_strings(FILE *fp, int indent, const char *title, char ***nm, int n, gmx_bool bShowNumbers)
1665 if (available(fp, nm, indent, title))
1667 indent = pr_title_n(fp, indent, title, n);
1668 for (i = 0; i < n; i++)
1670 (void) pr_indent(fp, indent);
1671 (void) fprintf(fp, "%s[%d]={name=\"%s\"}\n",
1672 title, bShowNumbers ? i : -1, *(nm[i]));
1677 static void pr_strings2(FILE *fp, int indent, const char *title,
1678 char ***nm, char ***nmB, int n, gmx_bool bShowNumbers)
1682 if (available(fp, nm, indent, title))
1684 indent = pr_title_n(fp, indent, title, n);
1685 for (i = 0; i < n; i++)
1687 (void) pr_indent(fp, indent);
1688 (void) fprintf(fp, "%s[%d]={name=\"%s\",nameB=\"%s\"}\n",
1689 title, bShowNumbers ? i : -1, *(nm[i]), *(nmB[i]));
1694 static void pr_resinfo(FILE *fp, int indent, const char *title, t_resinfo *resinfo, int n, gmx_bool bShowNumbers)
1698 if (available(fp, resinfo, indent, title))
1700 indent = pr_title_n(fp, indent, title, n);
1701 for (i = 0; i < n; i++)
1703 (void) pr_indent(fp, indent);
1704 (void) fprintf(fp, "%s[%d]={name=\"%s\", nr=%d, ic='%c'}\n",
1705 title, bShowNumbers ? i : -1,
1706 *(resinfo[i].name), resinfo[i].nr,
1707 (resinfo[i].ic == '\0') ? ' ' : resinfo[i].ic);
1712 static void pr_atom(FILE *fp, int indent, const char *title, t_atom *atom, int n)
1716 if (available(fp, atom, indent, title))
1718 indent = pr_title_n(fp, indent, title, n);
1719 for (i = 0; i < n; i++)
1721 (void) pr_indent(fp, indent);
1722 fprintf(fp, "%s[%6d]={type=%3d, typeB=%3d, ptype=%8s, m=%12.5e, "
1723 "q=%12.5e, mB=%12.5e, qB=%12.5e, resind=%5d, atomnumber=%3d}\n",
1724 title, i, atom[i].type, atom[i].typeB, ptype_str[atom[i].ptype],
1725 atom[i].m, atom[i].q, atom[i].mB, atom[i].qB,
1726 atom[i].resind, atom[i].atomnumber);
1731 static void pr_grps(FILE *fp, const char *title, t_grps grps[], char **grpname[])
1735 for (i = 0; (i < egcNR); i++)
1737 fprintf(fp, "%s[%-12s] nr=%d, name=[", title, gtypes[i], grps[i].nr);
1738 for (j = 0; (j < grps[i].nr); j++)
1740 fprintf(fp, " %s", *(grpname[grps[i].nm_ind[j]]));
1746 static void pr_groups(FILE *fp, int indent,
1747 gmx_groups_t *groups,
1748 gmx_bool bShowNumbers)
1753 pr_grps(fp, "grp", groups->grps, groups->grpname);
1754 pr_strings(fp, indent, "grpname", groups->grpname, groups->ngrpname, bShowNumbers);
1756 (void) pr_indent(fp, indent);
1757 fprintf(fp, "groups ");
1758 for (g = 0; g < egcNR; g++)
1760 printf(" %5.5s", gtypes[g]);
1764 (void) pr_indent(fp, indent);
1765 fprintf(fp, "allocated ");
1767 for (g = 0; g < egcNR; g++)
1769 printf(" %5d", groups->ngrpnr[g]);
1770 nat_max = max(nat_max, groups->ngrpnr[g]);
1776 (void) pr_indent(fp, indent);
1777 fprintf(fp, "groupnr[%5s] =", "*");
1778 for (g = 0; g < egcNR; g++)
1780 fprintf(fp, " %3d ", 0);
1786 for (i = 0; i < nat_max; i++)
1788 (void) pr_indent(fp, indent);
1789 fprintf(fp, "groupnr[%5d] =", i);
1790 for (g = 0; g < egcNR; g++)
1792 fprintf(fp, " %3d ",
1793 groups->grpnr[g] ? groups->grpnr[g][i] : 0);
1800 void pr_atoms(FILE *fp, int indent, const char *title, t_atoms *atoms,
1801 gmx_bool bShownumbers)
1803 if (available(fp, atoms, indent, title))
1805 indent = pr_title(fp, indent, title);
1806 pr_atom(fp, indent, "atom", atoms->atom, atoms->nr);
1807 pr_strings(fp, indent, "atom", atoms->atomname, atoms->nr, bShownumbers);
1808 pr_strings2(fp, indent, "type", atoms->atomtype, atoms->atomtypeB, atoms->nr, bShownumbers);
1809 pr_resinfo(fp, indent, "residue", atoms->resinfo, atoms->nres, bShownumbers);
1814 void pr_atomtypes(FILE *fp, int indent, const char *title, t_atomtypes *atomtypes,
1815 gmx_bool bShowNumbers)
1818 if (available(fp, atomtypes, indent, title))
1820 indent = pr_title(fp, indent, title);
1821 for (i = 0; i < atomtypes->nr; i++)
1823 pr_indent(fp, indent);
1825 "atomtype[%3d]={radius=%12.5e, volume=%12.5e, gb_radius=%12.5e, surftens=%12.5e, atomnumber=%4d, S_hct=%12.5e)}\n",
1826 bShowNumbers ? i : -1, atomtypes->radius[i], atomtypes->vol[i],
1827 atomtypes->gb_radius[i],
1828 atomtypes->surftens[i], atomtypes->atomnumber[i], atomtypes->S_hct[i]);
1833 static void pr_moltype(FILE *fp, int indent, const char *title,
1834 gmx_moltype_t *molt, int n,
1835 gmx_ffparams_t *ffparams,
1836 gmx_bool bShowNumbers)
1840 indent = pr_title_n(fp, indent, title, n);
1841 (void) pr_indent(fp, indent);
1842 (void) fprintf(fp, "name=\"%s\"\n", *(molt->name));
1843 pr_atoms(fp, indent, "atoms", &(molt->atoms), bShowNumbers);
1844 pr_block(fp, indent, "cgs", &molt->cgs, bShowNumbers);
1845 pr_blocka(fp, indent, "excls", &molt->excls, bShowNumbers);
1846 for (j = 0; (j < F_NRE); j++)
1848 pr_ilist(fp, indent, interaction_function[j].longname,
1849 ffparams->functype, &molt->ilist[j], bShowNumbers);
1853 static void pr_molblock(FILE *fp, int indent, const char *title,
1854 gmx_molblock_t *molb, int n,
1855 gmx_moltype_t *molt)
1857 indent = pr_title_n(fp, indent, title, n);
1858 (void) pr_indent(fp, indent);
1859 (void) fprintf(fp, "%-20s = %d \"%s\"\n",
1860 "moltype", molb->type, *(molt[molb->type].name));
1861 pr_int(fp, indent, "#molecules", molb->nmol);
1862 pr_int(fp, indent, "#atoms_mol", molb->natoms_mol);
1863 pr_int(fp, indent, "#posres_xA", molb->nposres_xA);
1864 if (molb->nposres_xA > 0)
1866 pr_rvecs(fp, indent, "posres_xA", molb->posres_xA, molb->nposres_xA);
1868 pr_int(fp, indent, "#posres_xB", molb->nposres_xB);
1869 if (molb->nposres_xB > 0)
1871 pr_rvecs(fp, indent, "posres_xB", molb->posres_xB, molb->nposres_xB);
1875 void pr_mtop(FILE *fp, int indent, const char *title, gmx_mtop_t *mtop,
1876 gmx_bool bShowNumbers)
1880 if (available(fp, mtop, indent, title))
1882 indent = pr_title(fp, indent, title);
1883 (void) pr_indent(fp, indent);
1884 (void) fprintf(fp, "name=\"%s\"\n", *(mtop->name));
1885 pr_int(fp, indent, "#atoms", mtop->natoms);
1886 pr_int(fp, indent, "#molblock", mtop->nmolblock);
1887 for (mb = 0; mb < mtop->nmolblock; mb++)
1889 pr_molblock(fp, indent, "molblock", &mtop->molblock[mb], mb, mtop->moltype);
1891 pr_ffparams(fp, indent, "ffparams", &(mtop->ffparams), bShowNumbers);
1892 pr_atomtypes(fp, indent, "atomtypes", &(mtop->atomtypes), bShowNumbers);
1893 for (mt = 0; mt < mtop->nmoltype; mt++)
1895 pr_moltype(fp, indent, "moltype", &mtop->moltype[mt], mt,
1896 &mtop->ffparams, bShowNumbers);
1898 pr_groups(fp, indent, &mtop->groups, bShowNumbers);
1902 void pr_top(FILE *fp, int indent, const char *title, t_topology *top, gmx_bool bShowNumbers)
1904 if (available(fp, top, indent, title))
1906 indent = pr_title(fp, indent, title);
1907 (void) pr_indent(fp, indent);
1908 (void) fprintf(fp, "name=\"%s\"\n", *(top->name));
1909 pr_atoms(fp, indent, "atoms", &(top->atoms), bShowNumbers);
1910 pr_atomtypes(fp, indent, "atomtypes", &(top->atomtypes), bShowNumbers);
1911 pr_block(fp, indent, "cgs", &top->cgs, bShowNumbers);
1912 pr_block(fp, indent, "mols", &top->mols, bShowNumbers);
1913 pr_blocka(fp, indent, "excls", &top->excls, bShowNumbers);
1914 pr_idef(fp, indent, "idef", &top->idef, bShowNumbers);
1918 void pr_header(FILE *fp, int indent, const char *title, t_tpxheader *sh)
1922 if (available(fp, sh, indent, title))
1924 indent = pr_title(fp, indent, title);
1925 pr_indent(fp, indent);
1926 fprintf(fp, "bIr = %spresent\n", sh->bIr ? "" : "not ");
1927 pr_indent(fp, indent);
1928 fprintf(fp, "bBox = %spresent\n", sh->bBox ? "" : "not ");
1929 pr_indent(fp, indent);
1930 fprintf(fp, "bTop = %spresent\n", sh->bTop ? "" : "not ");
1931 pr_indent(fp, indent);
1932 fprintf(fp, "bX = %spresent\n", sh->bX ? "" : "not ");
1933 pr_indent(fp, indent);
1934 fprintf(fp, "bV = %spresent\n", sh->bV ? "" : "not ");
1935 pr_indent(fp, indent);
1936 fprintf(fp, "bF = %spresent\n", sh->bF ? "" : "not ");
1938 pr_indent(fp, indent);
1939 fprintf(fp, "natoms = %d\n", sh->natoms);
1940 pr_indent(fp, indent);
1941 fprintf(fp, "lambda = %e\n", sh->lambda);
1945 void pr_commrec(FILE *fp, int indent, t_commrec *cr)
1947 pr_indent(fp, indent);
1948 fprintf(fp, "commrec:\n");
1950 pr_indent(fp, indent);
1951 fprintf(fp, "rank = %d\n", cr->nodeid);
1952 pr_indent(fp, indent);
1953 fprintf(fp, "number of ranks = %d\n", cr->nnodes);
1954 pr_indent(fp, indent);
1955 fprintf(fp, "PME-only ranks = %d\n", cr->npmenodes);
1957 pr_indent(fp,indent);
1958 fprintf(fp,"threadid = %d\n",cr->threadid);
1959 pr_indent(fp,indent);
1960 fprintf(fp,"nthreads = %d\n",cr->nthreads);