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,2015, 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.
39 /* This file is completely threadsafe - please keep it that way! */
46 #include "gromacs/math/vec.h"
47 #include "gromacs/mdtypes/inputrec.h"
48 #include "gromacs/mdtypes/md_enums.h"
49 #include "gromacs/mdtypes/pull-params.h"
50 #include "gromacs/pbcutil/pbc.h"
51 #include "gromacs/utility/cstringutil.h"
52 #include "gromacs/utility/snprintf.h"
53 #include "gromacs/utility/stringutil.h"
55 //! Macro to select a bool name
56 #define EBOOL(e) gmx::boolToString(e)
58 int pr_indent(FILE *fp
, int n
)
62 for (i
= 0; i
< n
; i
++)
69 int available(FILE *fp
, const void *p
, int indent
, const char *title
)
75 pr_indent(fp
, indent
);
77 fprintf(fp
, "%s: not available\n", title
);
82 int pr_title(FILE *fp
, int indent
, const char *title
)
84 pr_indent(fp
, indent
);
85 fprintf(fp
, "%s:\n", title
);
86 return (indent
+INDENT
);
89 int pr_title_n(FILE *fp
, int indent
, const char *title
, int n
)
91 pr_indent(fp
, indent
);
92 fprintf(fp
, "%s (%d):\n", title
, n
);
93 return (indent
+INDENT
);
96 int pr_title_nxn(FILE *fp
, int indent
, const char *title
, int n1
, int n2
)
98 pr_indent(fp
, indent
);
99 fprintf(fp
, "%s (%dx%d):\n", title
, n1
, n2
);
100 return (indent
+INDENT
);
103 void pr_ivec(FILE *fp
, int indent
, const char *title
, const int vec
[], int n
, gmx_bool bShowNumbers
)
107 if (available(fp
, vec
, indent
, title
))
109 indent
= pr_title_n(fp
, indent
, title
, n
);
110 for (i
= 0; i
< n
; i
++)
112 pr_indent(fp
, indent
);
113 fprintf(fp
, "%s[%d]=%d\n", title
, bShowNumbers
? i
: -1, vec
[i
]);
118 void pr_ivec_block(FILE *fp
, int indent
, const char *title
, const int vec
[], int n
, gmx_bool bShowNumbers
)
122 if (available(fp
, vec
, indent
, title
))
124 indent
= pr_title_n(fp
, indent
, title
, n
);
129 while (j
< n
&& vec
[j
] == vec
[j
-1]+1)
133 /* Print consecutive groups of 3 or more as blocks */
138 pr_indent(fp
, indent
);
139 fprintf(fp
, "%s[%d]=%d\n",
140 title
, bShowNumbers
? i
: -1, vec
[i
]);
146 pr_indent(fp
, indent
);
147 fprintf(fp
, "%s[%d,...,%d] = {%d,...,%d}\n",
149 bShowNumbers
? i
: -1,
150 bShowNumbers
? j
-1 : -1,
158 void pr_bvec(FILE *fp
, int indent
, const char *title
, const gmx_bool vec
[], int n
, gmx_bool bShowNumbers
)
162 if (available(fp
, vec
, indent
, title
))
164 indent
= pr_title_n(fp
, indent
, title
, n
);
165 for (i
= 0; i
< n
; i
++)
167 pr_indent(fp
, indent
);
168 fprintf(fp
, "%s[%d]=%s\n", title
, bShowNumbers
? i
: -1,
174 void pr_ivecs(FILE *fp
, int indent
, const char *title
, const ivec vec
[], int n
, gmx_bool bShowNumbers
)
178 if (available(fp
, vec
, indent
, title
))
180 indent
= pr_title_nxn(fp
, indent
, title
, n
, DIM
);
181 for (i
= 0; i
< n
; i
++)
183 pr_indent(fp
, indent
);
184 fprintf(fp
, "%s[%d]={", title
, bShowNumbers
? i
: -1);
185 for (j
= 0; j
< DIM
; j
++)
191 fprintf(fp
, "%d", vec
[i
][j
]);
198 void pr_rvec(FILE *fp
, int indent
, const char *title
, const real vec
[], int n
, gmx_bool bShowNumbers
)
202 if (available(fp
, vec
, indent
, title
))
204 indent
= pr_title_n(fp
, indent
, title
, n
);
205 for (i
= 0; i
< n
; i
++)
207 pr_indent(fp
, indent
);
208 fprintf(fp
, "%s[%d]=%12.5e\n", title
, bShowNumbers
? i
: -1, vec
[i
]);
213 void pr_dvec(FILE *fp
, int indent
, const char *title
, const double vec
[], int n
, gmx_bool bShowNumbers
)
217 if (available(fp
, vec
, indent
, title
))
219 indent
= pr_title_n(fp
, indent
, title
, n
);
220 for (i
= 0; i
< n
; i
++)
222 pr_indent(fp
, indent
);
223 fprintf(fp
, "%s[%d]=%12.5e\n", title
, bShowNumbers
? i
: -1, vec
[i
]);
229 void pr_rvecs_len(FILE *fp
, int indent
, const char *title
, const rvec vec
[], int n
)
233 if (available(fp
, vec
, indent
, title
))
235 indent
= pr_title_nxn(fp
, indent
, title
, n
, DIM
);
236 for (i
= 0; i
< n
; i
++)
238 pr_indent(fp
, indent
);
239 fprintf(fp
, "%s[%5d]={", title
, i
);
240 for (j
= 0; j
< DIM
; j
++)
246 fprintf(fp
, "%12.5e", vec
[i
][j
]);
248 fprintf(fp
, "} len=%12.5e\n", norm(vec
[i
]));
253 void pr_rvecs(FILE *fp
, int indent
, const char *title
, const rvec vec
[], int n
)
255 const char *fshort
= "%12.5e";
256 const char *flong
= "%15.8e";
260 if (getenv("GMX_PRINT_LONGFORMAT") != NULL
)
269 if (available(fp
, vec
, indent
, title
))
271 indent
= pr_title_nxn(fp
, indent
, title
, n
, DIM
);
272 for (i
= 0; i
< n
; i
++)
274 pr_indent(fp
, indent
);
275 fprintf(fp
, "%s[%5d]={", title
, i
);
276 for (j
= 0; j
< DIM
; j
++)
282 fprintf(fp
, format
, vec
[i
][j
]);
290 void pr_rvecs_of_dim(FILE *fp
, int indent
, const char *title
, const rvec vec
[], int n
, int dim
)
292 const char *fshort
= "%12.5e";
293 const char *flong
= "%15.8e";
297 if (getenv("GMX_PRINT_LONGFORMAT") != NULL
)
306 if (available(fp
, vec
, indent
, title
))
308 indent
= pr_title_nxn(fp
, indent
, title
, n
, dim
);
309 for (i
= 0; i
< n
; i
++)
311 pr_indent(fp
, indent
);
312 fprintf(fp
, "%s[%5d]={", title
, i
);
313 for (j
= 0; j
< dim
; j
++)
319 fprintf(fp
, format
, vec
[i
][j
]);
326 void pr_reals(FILE *fp
, int indent
, const char *title
, const real
*vec
, int n
)
330 if (available(fp
, vec
, indent
, title
))
332 pr_indent(fp
, indent
);
333 fprintf(fp
, "%s:\t", title
);
334 for (i
= 0; i
< n
; i
++)
336 fprintf(fp
, " %10g", vec
[i
]);
342 void pr_doubles(FILE *fp
, int indent
, const char *title
, const double *vec
, int n
)
346 if (available(fp
, vec
, indent
, title
))
348 pr_indent(fp
, indent
);
349 fprintf(fp
, "%s:\t", title
);
350 for (i
= 0; i
< n
; i
++)
352 fprintf(fp
, " %10g", vec
[i
]);
358 void pr_reals_of_dim(FILE *fp
, int indent
, const char *title
, const real
*vec
, int n
, int dim
)
361 const char *fshort
= "%12.5e";
362 const char *flong
= "%15.8e";
365 if (getenv("GMX_PRINT_LONGFORMAT") != NULL
)
374 if (available(fp
, vec
, indent
, title
))
376 indent
= pr_title_nxn(fp
, indent
, title
, n
, dim
);
377 for (i
= 0; i
< n
; i
++)
379 pr_indent(fp
, indent
);
380 fprintf(fp
, "%s[%5d]={", title
, i
);
381 for (j
= 0; j
< dim
; j
++)
387 fprintf(fp
, format
, vec
[i
* dim
+ j
]);
394 void pr_int(FILE *fp
, int indent
, const char *title
, int i
)
396 pr_indent(fp
, indent
);
397 fprintf(fp
, "%-30s = %d\n", title
, i
);
400 static void pr_int64(FILE *fp
, int indent
, const char *title
, gmx_int64_t i
)
402 char buf
[STEPSTRSIZE
];
404 pr_indent(fp
, indent
);
405 fprintf(fp
, "%-30s = %s\n", title
, gmx_step_str(i
, buf
));
408 void pr_real(FILE *fp
, int indent
, const char *title
, real r
)
410 pr_indent(fp
, indent
);
411 fprintf(fp
, "%-30s = %g\n", title
, r
);
414 void pr_double(FILE *fp
, int indent
, const char *title
, double d
)
416 pr_indent(fp
, indent
);
417 fprintf(fp
, "%-30s = %g\n", title
, d
);
420 void pr_str(FILE *fp
, int indent
, const char *title
, const char *s
)
422 pr_indent(fp
, indent
);
423 fprintf(fp
, "%-30s = %s\n", title
, s
);
426 void pr_qm_opts(FILE *fp
, int indent
, const char *title
, const t_grpopts
*opts
)
428 fprintf(fp
, "%s:\n", title
);
430 pr_int(fp
, indent
, "ngQM", opts
->ngQM
);
433 pr_ivec(fp
, indent
, "QMmethod", opts
->QMmethod
, opts
->ngQM
, FALSE
);
434 pr_ivec(fp
, indent
, "QMbasis", opts
->QMbasis
, opts
->ngQM
, FALSE
);
435 pr_ivec(fp
, indent
, "QMcharge", opts
->QMcharge
, opts
->ngQM
, FALSE
);
436 pr_ivec(fp
, indent
, "QMmult", opts
->QMmult
, opts
->ngQM
, FALSE
);
437 pr_bvec(fp
, indent
, "SH", opts
->bSH
, opts
->ngQM
, FALSE
);
438 pr_ivec(fp
, indent
, "CASorbitals", opts
->CASorbitals
, opts
->ngQM
, FALSE
);
439 pr_ivec(fp
, indent
, "CASelectrons", opts
->CASelectrons
, opts
->ngQM
, FALSE
);
440 pr_rvec(fp
, indent
, "SAon", opts
->SAon
, opts
->ngQM
, FALSE
);
441 pr_rvec(fp
, indent
, "SAoff", opts
->SAoff
, opts
->ngQM
, FALSE
);
442 pr_ivec(fp
, indent
, "SAsteps", opts
->SAsteps
, opts
->ngQM
, FALSE
);
443 pr_bvec(fp
, indent
, "bOPT", opts
->bOPT
, opts
->ngQM
, FALSE
);
444 pr_bvec(fp
, indent
, "bTS", opts
->bTS
, opts
->ngQM
, FALSE
);
448 static void pr_grp_opts(FILE *out
, int indent
, const char *title
, const t_grpopts
*opts
,
455 fprintf(out
, "%s:\n", title
);
458 pr_indent(out
, indent
);
459 fprintf(out
, "nrdf%s", bMDPformat
? " = " : ":");
460 for (i
= 0; (i
< opts
->ngtc
); i
++)
462 fprintf(out
, " %10g", opts
->nrdf
[i
]);
466 pr_indent(out
, indent
);
467 fprintf(out
, "ref-t%s", bMDPformat
? " = " : ":");
468 for (i
= 0; (i
< opts
->ngtc
); i
++)
470 fprintf(out
, " %10g", opts
->ref_t
[i
]);
474 pr_indent(out
, indent
);
475 fprintf(out
, "tau-t%s", bMDPformat
? " = " : ":");
476 for (i
= 0; (i
< opts
->ngtc
); i
++)
478 fprintf(out
, " %10g", opts
->tau_t
[i
]);
482 /* Pretty-print the simulated annealing info */
483 fprintf(out
, "annealing%s", bMDPformat
? " = " : ":");
484 for (i
= 0; (i
< opts
->ngtc
); i
++)
486 fprintf(out
, " %10s", EANNEAL(opts
->annealing
[i
]));
490 fprintf(out
, "annealing-npoints%s", bMDPformat
? " = " : ":");
491 for (i
= 0; (i
< opts
->ngtc
); i
++)
493 fprintf(out
, " %10d", opts
->anneal_npoints
[i
]);
497 for (i
= 0; (i
< opts
->ngtc
); i
++)
499 if (opts
->anneal_npoints
[i
] > 0)
501 fprintf(out
, "annealing-time [%d]:\t", i
);
502 for (j
= 0; (j
< opts
->anneal_npoints
[i
]); j
++)
504 fprintf(out
, " %10.1f", opts
->anneal_time
[i
][j
]);
507 fprintf(out
, "annealing-temp [%d]:\t", i
);
508 for (j
= 0; (j
< opts
->anneal_npoints
[i
]); j
++)
510 fprintf(out
, " %10.1f", opts
->anneal_temp
[i
][j
]);
516 pr_indent(out
, indent
);
517 fprintf(out
, "acc:\t");
518 for (i
= 0; (i
< opts
->ngacc
); i
++)
520 for (m
= 0; (m
< DIM
); m
++)
522 fprintf(out
, " %10g", opts
->acc
[i
][m
]);
527 pr_indent(out
, indent
);
528 fprintf(out
, "nfreeze:");
529 for (i
= 0; (i
< opts
->ngfrz
); i
++)
531 for (m
= 0; (m
< DIM
); m
++)
533 fprintf(out
, " %10s", opts
->nFreeze
[i
][m
] ? "Y" : "N");
539 for (i
= 0; (i
< opts
->ngener
); i
++)
541 pr_indent(out
, indent
);
542 fprintf(out
, "energygrp-flags[%3d]:", i
);
543 for (m
= 0; (m
< opts
->ngener
); m
++)
545 fprintf(out
, " %d", opts
->egp_flags
[opts
->ngener
*i
+m
]);
553 static void pr_matrix(FILE *fp
, int indent
, const char *title
, const rvec
*m
,
558 fprintf(fp
, "%-10s = %g %g %g %g %g %g\n", title
,
559 m
[XX
][XX
], m
[YY
][YY
], m
[ZZ
][ZZ
], m
[XX
][YY
], m
[XX
][ZZ
], m
[YY
][ZZ
]);
563 pr_rvecs(fp
, indent
, title
, m
, DIM
);
567 static void pr_cosine(FILE *fp
, int indent
, const char *title
, const t_cosines
*cos
,
574 fprintf(fp
, "%s = %d\n", title
, cos
->n
);
578 indent
= pr_title(fp
, indent
, title
);
579 pr_indent(fp
, indent
);
580 fprintf(fp
, "n = %d\n", cos
->n
);
583 pr_indent(fp
, indent
+2);
585 for (j
= 0; (j
< cos
->n
); j
++)
587 fprintf(fp
, " %e", cos
->a
[j
]);
590 pr_indent(fp
, indent
+2);
591 fprintf(fp
, "phi =");
592 for (j
= 0; (j
< cos
->n
); j
++)
594 fprintf(fp
, " %e", cos
->phi
[j
]);
601 #define PS(t, s) pr_str(fp, indent, t, s)
602 #define PI(t, s) pr_int(fp, indent, t, s)
603 #define PSTEP(t, s) pr_int64(fp, indent, t, s)
604 #define PR(t, s) pr_real(fp, indent, t, s)
605 #define PD(t, s) pr_double(fp, indent, t, s)
607 static void pr_pull_group(FILE *fp
, int indent
, int g
, const t_pull_group
*pgrp
)
609 pr_indent(fp
, indent
);
610 fprintf(fp
, "pull-group %d:\n", g
);
612 pr_ivec_block(fp
, indent
, "atom", pgrp
->ind
, pgrp
->nat
, TRUE
);
613 pr_rvec(fp
, indent
, "weight", pgrp
->weight
, pgrp
->nweight
, TRUE
);
614 PI("pbcatom", pgrp
->pbcatom
);
617 static void pr_pull_coord(FILE *fp
, int indent
, int c
, const t_pull_coord
*pcrd
)
621 pr_indent(fp
, indent
);
622 fprintf(fp
, "pull-coord %d:\n", c
);
623 PS("type", EPULLTYPE(pcrd
->eType
));
624 PS("geometry", EPULLGEOM(pcrd
->eGeom
));
625 for (g
= 0; g
< pcrd
->ngroup
; g
++)
629 sprintf(buf
, "group[%d]", g
);
630 PI(buf
, pcrd
->group
[g
]);
632 pr_ivec(fp
, indent
, "dim", pcrd
->dim
, DIM
, TRUE
);
633 pr_rvec(fp
, indent
, "origin", pcrd
->origin
, DIM
, TRUE
);
634 pr_rvec(fp
, indent
, "vec", pcrd
->vec
, DIM
, TRUE
);
635 PS("start", EBOOL(pcrd
->bStart
));
636 PR("init", pcrd
->init
);
637 PR("rate", pcrd
->rate
);
642 static void pr_simtempvals(FILE *fp
, int indent
, const t_simtemp
*simtemp
, int n_lambda
)
644 PS("simulated-tempering-scaling", ESIMTEMP(simtemp
->eSimTempScale
));
645 PR("sim-temp-low", simtemp
->simtemp_low
);
646 PR("sim-temp-high", simtemp
->simtemp_high
);
647 pr_rvec(fp
, indent
, "simulated tempering temperatures", simtemp
->temperatures
, n_lambda
, TRUE
);
650 static void pr_expandedvals(FILE *fp
, int indent
, const t_expanded
*expand
, int n_lambda
)
653 PI("nstexpanded", expand
->nstexpanded
);
654 PS("lmc-stats", elamstats_names
[expand
->elamstats
]);
655 PS("lmc-move", elmcmove_names
[expand
->elmcmove
]);
656 PS("lmc-weights-equil", elmceq_names
[expand
->elmceq
]);
657 if (expand
->elmceq
== elmceqNUMATLAM
)
659 PI("weight-equil-number-all-lambda", expand
->equil_n_at_lam
);
661 if (expand
->elmceq
== elmceqSAMPLES
)
663 PI("weight-equil-number-samples", expand
->equil_samples
);
665 if (expand
->elmceq
== elmceqSTEPS
)
667 PI("weight-equil-number-steps", expand
->equil_steps
);
669 if (expand
->elmceq
== elmceqWLDELTA
)
671 PR("weight-equil-wl-delta", expand
->equil_wl_delta
);
673 if (expand
->elmceq
== elmceqRATIO
)
675 PR("weight-equil-count-ratio", expand
->equil_ratio
);
677 PI("lmc-seed", expand
->lmc_seed
);
678 PR("mc-temperature", expand
->mc_temp
);
679 PI("lmc-repeats", expand
->lmc_repeats
);
680 PI("lmc-gibbsdelta", expand
->gibbsdeltalam
);
681 PI("lmc-forced-nstart", expand
->lmc_forced_nstart
);
682 PS("symmetrized-transition-matrix", EBOOL(expand
->bSymmetrizedTMatrix
));
683 PI("nst-transition-matrix", expand
->nstTij
);
684 PI("mininum-var-min", expand
->minvarmin
); /*default is reasonable */
685 PI("weight-c-range", expand
->c_range
); /* default is just C=0 */
686 PR("wl-scale", expand
->wl_scale
);
687 PR("wl-ratio", expand
->wl_ratio
);
688 PR("init-wl-delta", expand
->init_wl_delta
);
689 PS("wl-oneovert", EBOOL(expand
->bWLoneovert
));
691 pr_indent(fp
, indent
);
692 pr_rvec(fp
, indent
, "init-lambda-weights", expand
->init_lambda_weights
, n_lambda
, TRUE
);
693 PS("init-weights", EBOOL(expand
->bInit_weights
));
696 static void pr_fepvals(FILE *fp
, int indent
, const t_lambda
*fep
, gmx_bool bMDPformat
)
700 PR("init-lambda", fep
->init_lambda
);
701 PI("init-lambda-state", fep
->init_fep_state
);
702 PR("delta-lambda", fep
->delta_lambda
);
703 PI("nstdhdl", fep
->nstdhdl
);
707 PI("n-lambdas", fep
->n_lambda
);
709 if (fep
->n_lambda
> 0)
711 pr_indent(fp
, indent
);
712 fprintf(fp
, "separate-dvdl%s\n", bMDPformat
? " = " : ":");
713 for (i
= 0; i
< efptNR
; i
++)
715 fprintf(fp
, "%18s = ", efpt_names
[i
]);
716 if (fep
->separate_dvdl
[i
])
718 fprintf(fp
, " TRUE");
722 fprintf(fp
, " FALSE");
726 fprintf(fp
, "all-lambdas%s\n", bMDPformat
? " = " : ":");
727 for (i
= 0; i
< efptNR
; i
++)
729 fprintf(fp
, "%18s = ", efpt_names
[i
]);
730 for (j
= 0; j
< fep
->n_lambda
; j
++)
732 fprintf(fp
, " %10g", fep
->all_lambda
[i
][j
]);
737 PI("calc-lambda-neighbors", fep
->lambda_neighbors
);
738 PS("dhdl-print-energy", edHdLPrintEnergy_names
[fep
->edHdLPrintEnergy
]);
739 PR("sc-alpha", fep
->sc_alpha
);
740 PI("sc-power", fep
->sc_power
);
741 PR("sc-r-power", fep
->sc_r_power
);
742 PR("sc-sigma", fep
->sc_sigma
);
743 PR("sc-sigma-min", fep
->sc_sigma_min
);
744 PS("sc-coul", EBOOL(fep
->bScCoul
));
745 PI("dh-hist-size", fep
->dh_hist_size
);
746 PD("dh-hist-spacing", fep
->dh_hist_spacing
);
747 PS("separate-dhdl-file", SEPDHDLFILETYPE(fep
->separate_dhdl_file
));
748 PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(fep
->dhdl_derivatives
));
751 static void pr_pull(FILE *fp
, int indent
, const pull_params_t
*pull
)
755 PR("pull-cylinder-r", pull
->cylinder_r
);
756 PR("pull-constr-tol", pull
->constr_tol
);
757 PS("pull-print-COM1", EBOOL(pull
->bPrintCOM1
));
758 PS("pull-print-COM2", EBOOL(pull
->bPrintCOM2
));
759 PS("pull-print-ref-value", EBOOL(pull
->bPrintRefValue
));
760 PS("pull-print-components", EBOOL(pull
->bPrintComp
));
761 PI("pull-nstxout", pull
->nstxout
);
762 PI("pull-nstfout", pull
->nstfout
);
763 PI("pull-ngroups", pull
->ngroup
);
764 for (g
= 0; g
< pull
->ngroup
; g
++)
766 pr_pull_group(fp
, indent
, g
, &pull
->group
[g
]);
768 PI("pull-ncoords", pull
->ncoord
);
769 for (g
= 0; g
< pull
->ncoord
; g
++)
771 pr_pull_coord(fp
, indent
, g
, &pull
->coord
[g
]);
775 static void pr_rotgrp(FILE *fp
, int indent
, int g
, const t_rotgrp
*rotg
)
777 pr_indent(fp
, indent
);
778 fprintf(fp
, "rot-group %d:\n", g
);
780 PS("rot-type", EROTGEOM(rotg
->eType
));
781 PS("rot-massw", EBOOL(rotg
->bMassW
));
782 pr_ivec_block(fp
, indent
, "atom", rotg
->ind
, rotg
->nat
, TRUE
);
783 pr_rvecs(fp
, indent
, "x-ref", rotg
->x_ref
, rotg
->nat
);
784 pr_rvec(fp
, indent
, "rot-vec", rotg
->vec
, DIM
, TRUE
);
785 pr_rvec(fp
, indent
, "rot-pivot", rotg
->pivot
, DIM
, TRUE
);
786 PR("rot-rate", rotg
->rate
);
787 PR("rot-k", rotg
->k
);
788 PR("rot-slab-dist", rotg
->slab_dist
);
789 PR("rot-min-gauss", rotg
->min_gaussian
);
790 PR("rot-eps", rotg
->eps
);
791 PS("rot-fit-method", EROTFIT(rotg
->eFittype
));
792 PI("rot-potfit-nstep", rotg
->PotAngle_nstep
);
793 PR("rot-potfit-step", rotg
->PotAngle_step
);
796 static void pr_rot(FILE *fp
, int indent
, const t_rot
*rot
)
800 PI("rot-nstrout", rot
->nstrout
);
801 PI("rot-nstsout", rot
->nstsout
);
802 PI("rot-ngroups", rot
->ngrp
);
803 for (g
= 0; g
< rot
->ngrp
; g
++)
805 pr_rotgrp(fp
, indent
, g
, &rot
->grp
[g
]);
810 static void pr_swap(FILE *fp
, int indent
, const t_swapcoords
*swap
)
814 /* Enums for better readability of the code */
820 PI("swap-frequency", swap
->nstswap
);
822 /* The split groups that define the compartments */
823 for (int j
= 0; j
< 2; j
++)
825 snprintf(str
, STRLEN
, "massw_split%d", j
);
826 PS(str
, EBOOL(swap
->massw_split
[j
]));
827 snprintf(str
, STRLEN
, "split atoms group %d", j
);
828 pr_ivec_block(fp
, indent
, str
, swap
->grp
[j
].ind
, swap
->grp
[j
].nat
, TRUE
);
831 /* The solvent group */
832 snprintf(str
, STRLEN
, "solvent group %s", swap
->grp
[eGrpSolvent
].molname
);
833 pr_ivec_block(fp
, indent
, str
, swap
->grp
[eGrpSolvent
].ind
, swap
->grp
[eGrpSolvent
].nat
, TRUE
);
835 /* Now print the indices for all the ion groups: */
836 for (int ig
= eSwapFixedGrpNR
; ig
< swap
->ngrp
; ig
++)
838 snprintf(str
, STRLEN
, "ion group %s", swap
->grp
[ig
].molname
);
839 pr_ivec_block(fp
, indent
, str
, swap
->grp
[ig
].ind
, swap
->grp
[ig
].nat
, TRUE
);
842 PR("cyl0-r", swap
->cyl0r
);
843 PR("cyl0-up", swap
->cyl0u
);
844 PR("cyl0-down", swap
->cyl0l
);
845 PR("cyl1-r", swap
->cyl1r
);
846 PR("cyl1-up", swap
->cyl1u
);
847 PR("cyl1-down", swap
->cyl1l
);
848 PI("coupl-steps", swap
->nAverage
);
850 /* Print the requested ion counts for both compartments */
851 for (int ic
= eCompA
; ic
<= eCompB
; ic
++)
853 for (int ig
= eSwapFixedGrpNR
; ig
< swap
->ngrp
; ig
++)
855 snprintf(str
, STRLEN
, "%s-in-%c", swap
->grp
[ig
].molname
, 'A'+ic
);
856 PI(str
, swap
->grp
[ig
].nmolReq
[ic
]);
860 PR("threshold", swap
->threshold
);
861 PR("bulk-offsetA", swap
->bulkOffset
[eCompA
]);
862 PR("bulk-offsetB", swap
->bulkOffset
[eCompB
]);
866 static void pr_imd(FILE *fp
, int indent
, const t_IMD
*imd
)
868 PI("IMD-atoms", imd
->nat
);
869 pr_ivec_block(fp
, indent
, "atom", imd
->ind
, imd
->nat
, TRUE
);
873 void pr_inputrec(FILE *fp
, int indent
, const char *title
, const t_inputrec
*ir
,
876 const char *infbuf
= "inf";
878 if (available(fp
, ir
, indent
, title
))
882 indent
= pr_title(fp
, indent
, title
);
884 /* Try to make this list appear in the same order as the
885 * options are written in the default mdout.mdp, and with
886 * the same user-exposed names to facilitate debugging.
888 PS("integrator", EI(ir
->eI
));
889 PR("tinit", ir
->init_t
);
890 PR("dt", ir
->delta_t
);
891 PSTEP("nsteps", ir
->nsteps
);
892 PSTEP("init-step", ir
->init_step
);
893 PI("simulation-part", ir
->simulation_part
);
894 PS("comm-mode", ECOM(ir
->comm_mode
));
895 PI("nstcomm", ir
->nstcomm
);
897 /* Langevin dynamics */
898 PR("bd-fric", ir
->bd_fric
);
899 PSTEP("ld-seed", ir
->ld_seed
);
901 /* Energy minimization */
902 PR("emtol", ir
->em_tol
);
903 PR("emstep", ir
->em_stepsize
);
904 PI("niter", ir
->niter
);
905 PR("fcstep", ir
->fc_stepsize
);
906 PI("nstcgsteep", ir
->nstcgsteep
);
907 PI("nbfgscorr", ir
->nbfgscorr
);
909 /* Test particle insertion */
910 PR("rtpi", ir
->rtpi
);
913 PI("nstxout", ir
->nstxout
);
914 PI("nstvout", ir
->nstvout
);
915 PI("nstfout", ir
->nstfout
);
916 PI("nstlog", ir
->nstlog
);
917 PI("nstcalcenergy", ir
->nstcalcenergy
);
918 PI("nstenergy", ir
->nstenergy
);
919 PI("nstxout-compressed", ir
->nstxout_compressed
);
920 PR("compressed-x-precision", ir
->x_compression_precision
);
922 /* Neighborsearching parameters */
923 PS("cutoff-scheme", ECUTSCHEME(ir
->cutoff_scheme
));
924 PI("nstlist", ir
->nstlist
);
925 PS("ns-type", ENS(ir
->ns_type
));
926 PS("pbc", epbc_names
[ir
->ePBC
]);
927 PS("periodic-molecules", EBOOL(ir
->bPeriodicMols
));
928 PR("verlet-buffer-tolerance", ir
->verletbuf_tol
);
929 PR("rlist", ir
->rlist
);
931 /* Options for electrostatics and VdW */
932 PS("coulombtype", EELTYPE(ir
->coulombtype
));
933 PS("coulomb-modifier", INTMODIFIER(ir
->coulomb_modifier
));
934 PR("rcoulomb-switch", ir
->rcoulomb_switch
);
935 PR("rcoulomb", ir
->rcoulomb
);
936 if (ir
->epsilon_r
!= 0)
938 PR("epsilon-r", ir
->epsilon_r
);
942 PS("epsilon-r", infbuf
);
944 if (ir
->epsilon_rf
!= 0)
946 PR("epsilon-rf", ir
->epsilon_rf
);
950 PS("epsilon-rf", infbuf
);
952 PS("vdw-type", EVDWTYPE(ir
->vdwtype
));
953 PS("vdw-modifier", INTMODIFIER(ir
->vdw_modifier
));
954 PR("rvdw-switch", ir
->rvdw_switch
);
955 PR("rvdw", ir
->rvdw
);
956 PS("DispCorr", EDISPCORR(ir
->eDispCorr
));
957 PR("table-extension", ir
->tabext
);
959 PR("fourierspacing", ir
->fourier_spacing
);
960 PI("fourier-nx", ir
->nkx
);
961 PI("fourier-ny", ir
->nky
);
962 PI("fourier-nz", ir
->nkz
);
963 PI("pme-order", ir
->pme_order
);
964 PR("ewald-rtol", ir
->ewald_rtol
);
965 PR("ewald-rtol-lj", ir
->ewald_rtol_lj
);
966 PS("lj-pme-comb-rule", ELJPMECOMBNAMES(ir
->ljpme_combination_rule
));
967 PR("ewald-geometry", ir
->ewald_geometry
);
968 PR("epsilon-surface", ir
->epsilon_surface
);
970 /* Implicit solvent */
971 PS("implicit-solvent", EIMPLICITSOL(ir
->implicit_solvent
));
973 /* Generalized born electrostatics */
974 PS("gb-algorithm", EGBALGORITHM(ir
->gb_algorithm
));
975 PI("nstgbradii", ir
->nstgbradii
);
976 PR("rgbradii", ir
->rgbradii
);
977 PR("gb-epsilon-solvent", ir
->gb_epsilon_solvent
);
978 PR("gb-saltconc", ir
->gb_saltconc
);
979 PR("gb-obc-alpha", ir
->gb_obc_alpha
);
980 PR("gb-obc-beta", ir
->gb_obc_beta
);
981 PR("gb-obc-gamma", ir
->gb_obc_gamma
);
982 PR("gb-dielectric-offset", ir
->gb_dielectric_offset
);
983 PS("sa-algorithm", ESAALGORITHM(ir
->sa_algorithm
));
984 PR("sa-surface-tension", ir
->sa_surface_tension
);
986 /* Options for weak coupling algorithms */
987 PS("tcoupl", ETCOUPLTYPE(ir
->etc
));
988 PI("nsttcouple", ir
->nsttcouple
);
989 PI("nh-chain-length", ir
->opts
.nhchainlength
);
990 PS("print-nose-hoover-chain-variables", EBOOL(ir
->bPrintNHChains
));
992 PS("pcoupl", EPCOUPLTYPE(ir
->epc
));
993 PS("pcoupltype", EPCOUPLTYPETYPE(ir
->epct
));
994 PI("nstpcouple", ir
->nstpcouple
);
995 PR("tau-p", ir
->tau_p
);
996 pr_matrix(fp
, indent
, "compressibility", ir
->compress
, bMDPformat
);
997 pr_matrix(fp
, indent
, "ref-p", ir
->ref_p
, bMDPformat
);
998 PS("refcoord-scaling", EREFSCALINGTYPE(ir
->refcoord_scaling
));
1002 fprintf(fp
, "posres-com = %g %g %g\n", ir
->posres_com
[XX
],
1003 ir
->posres_com
[YY
], ir
->posres_com
[ZZ
]);
1004 fprintf(fp
, "posres-comB = %g %g %g\n", ir
->posres_comB
[XX
],
1005 ir
->posres_comB
[YY
], ir
->posres_comB
[ZZ
]);
1009 pr_rvec(fp
, indent
, "posres-com", ir
->posres_com
, DIM
, TRUE
);
1010 pr_rvec(fp
, indent
, "posres-comB", ir
->posres_comB
, DIM
, TRUE
);
1014 PS("QMMM", EBOOL(ir
->bQMMM
));
1015 PI("QMconstraints", ir
->QMconstraints
);
1016 PI("QMMMscheme", ir
->QMMMscheme
);
1017 PR("MMChargeScaleFactor", ir
->scalefactor
);
1018 pr_qm_opts(fp
, indent
, "qm-opts", &(ir
->opts
));
1020 /* CONSTRAINT OPTIONS */
1021 PS("constraint-algorithm", ECONSTRTYPE(ir
->eConstrAlg
));
1022 PS("continuation", EBOOL(ir
->bContinuation
));
1024 PS("Shake-SOR", EBOOL(ir
->bShakeSOR
));
1025 PR("shake-tol", ir
->shake_tol
);
1026 PI("lincs-order", ir
->nProjOrder
);
1027 PI("lincs-iter", ir
->nLincsIter
);
1028 PR("lincs-warnangle", ir
->LincsWarnAngle
);
1031 PI("nwall", ir
->nwall
);
1032 PS("wall-type", EWALLTYPE(ir
->wall_type
));
1033 PR("wall-r-linpot", ir
->wall_r_linpot
);
1035 PI("wall-atomtype[0]", ir
->wall_atomtype
[0]);
1036 PI("wall-atomtype[1]", ir
->wall_atomtype
[1]);
1038 PR("wall-density[0]", ir
->wall_density
[0]);
1039 PR("wall-density[1]", ir
->wall_density
[1]);
1040 PR("wall-ewald-zfac", ir
->wall_ewald_zfac
);
1043 PS("pull", EBOOL(ir
->bPull
));
1046 pr_pull(fp
, indent
, ir
->pull
);
1049 /* ENFORCED ROTATION */
1050 PS("rotation", EBOOL(ir
->bRot
));
1053 pr_rot(fp
, indent
, ir
->rot
);
1056 /* INTERACTIVE MD */
1057 PS("interactiveMD", EBOOL(ir
->bIMD
));
1060 pr_imd(fp
, indent
, ir
->imd
);
1063 /* NMR refinement stuff */
1064 PS("disre", EDISRETYPE(ir
->eDisre
));
1065 PS("disre-weighting", EDISREWEIGHTING(ir
->eDisreWeighting
));
1066 PS("disre-mixed", EBOOL(ir
->bDisreMixed
));
1067 PR("dr-fc", ir
->dr_fc
);
1068 PR("dr-tau", ir
->dr_tau
);
1069 PR("nstdisreout", ir
->nstdisreout
);
1071 PR("orire-fc", ir
->orires_fc
);
1072 PR("orire-tau", ir
->orires_tau
);
1073 PR("nstorireout", ir
->nstorireout
);
1075 /* FREE ENERGY VARIABLES */
1076 PS("free-energy", EFEPTYPE(ir
->efep
));
1077 if (ir
->efep
!= efepNO
|| ir
->bSimTemp
)
1079 pr_fepvals(fp
, indent
, ir
->fepvals
, bMDPformat
);
1083 pr_expandedvals(fp
, indent
, ir
->expandedvals
, ir
->fepvals
->n_lambda
);
1086 /* NON-equilibrium MD stuff */
1087 PR("cos-acceleration", ir
->cos_accel
);
1088 pr_matrix(fp
, indent
, "deform", ir
->deform
, bMDPformat
);
1090 /* SIMULATED TEMPERING */
1091 PS("simulated-tempering", EBOOL(ir
->bSimTemp
));
1094 pr_simtempvals(fp
, indent
, ir
->simtempvals
, ir
->fepvals
->n_lambda
);
1097 /* ELECTRIC FIELDS */
1098 pr_cosine(fp
, indent
, "E-x", &(ir
->ex
[XX
]), bMDPformat
);
1099 pr_cosine(fp
, indent
, "E-xt", &(ir
->et
[XX
]), bMDPformat
);
1100 pr_cosine(fp
, indent
, "E-y", &(ir
->ex
[YY
]), bMDPformat
);
1101 pr_cosine(fp
, indent
, "E-yt", &(ir
->et
[YY
]), bMDPformat
);
1102 pr_cosine(fp
, indent
, "E-z", &(ir
->ex
[ZZ
]), bMDPformat
);
1103 pr_cosine(fp
, indent
, "E-zt", &(ir
->et
[ZZ
]), bMDPformat
);
1105 /* ION/WATER SWAPPING FOR COMPUTATIONAL ELECTROPHYSIOLOGY */
1106 PS("swapcoords", ESWAPTYPE(ir
->eSwapCoords
));
1107 if (ir
->eSwapCoords
!= eswapNO
)
1109 pr_swap(fp
, indent
, ir
->swap
);
1112 /* USER-DEFINED THINGIES */
1113 PI("userint1", ir
->userint1
);
1114 PI("userint2", ir
->userint2
);
1115 PI("userint3", ir
->userint3
);
1116 PI("userint4", ir
->userint4
);
1117 PR("userreal1", ir
->userreal1
);
1118 PR("userreal2", ir
->userreal2
);
1119 PR("userreal3", ir
->userreal3
);
1120 PR("userreal4", ir
->userreal4
);
1122 pr_grp_opts(fp
, indent
, "grpopts", &(ir
->opts
), bMDPformat
);
1129 void pr_strings(FILE *fp
, int indent
, const char *title
, char ***nm
, int n
, gmx_bool bShowNumbers
)
1133 if (available(fp
, nm
, indent
, title
))
1135 indent
= pr_title_n(fp
, indent
, title
, n
);
1136 for (i
= 0; i
< n
; i
++)
1138 pr_indent(fp
, indent
);
1139 fprintf(fp
, "%s[%d]={name=\"%s\"}\n",
1140 title
, bShowNumbers
? i
: -1, *(nm
[i
]));