128-bit AVX2 SIMD for AMD Ryzen
[gromacs.git] / src / gromacs / mdtypes / inputrec.cpp
blob808fa1977f0735345510a41ca9a01125f869503d
1 /*
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-2010, The GROMACS development team.
6 * Copyright (c) 2012,2014,2015,2016,2017, 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.
37 #include "gmxpre.h"
39 #include "inputrec.h"
41 #include <cstdio>
42 #include <cstdlib>
43 #include <cstring>
45 #include <algorithm>
47 #include "gromacs/math/veccompare.h"
48 #include "gromacs/math/vecdump.h"
49 #include "gromacs/mdtypes/md_enums.h"
50 #include "gromacs/mdtypes/pull-params.h"
51 #include "gromacs/pbcutil/pbc.h"
52 #include "gromacs/utility/compare.h"
53 #include "gromacs/utility/cstringutil.h"
54 #include "gromacs/utility/fatalerror.h"
55 #include "gromacs/utility/keyvaluetree.h"
56 #include "gromacs/utility/smalloc.h"
57 #include "gromacs/utility/snprintf.h"
58 #include "gromacs/utility/stringutil.h"
59 #include "gromacs/utility/textwriter.h"
60 #include "gromacs/utility/txtdump.h"
62 //! Macro to select a bool name
63 #define EBOOL(e) gmx::boolToString(e)
65 /* The minimum number of integration steps required for reasonably accurate
66 * integration of first and second order coupling algorithms.
68 const int nstmin_berendsen_tcouple = 5;
69 const int nstmin_berendsen_pcouple = 10;
70 const int nstmin_harmonic = 20;
72 t_inputrec::t_inputrec()
74 std::memset(this, 0, sizeof(*this));
75 snew(fepvals, 1);
76 snew(expandedvals, 1);
77 snew(simtempvals, 1);
80 t_inputrec::~t_inputrec()
82 done_inputrec(this);
85 static int nst_wanted(const t_inputrec *ir)
87 if (ir->nstlist > 0)
89 return ir->nstlist;
91 else
93 return 10;
97 int ir_optimal_nstcalcenergy(const t_inputrec *ir)
99 return nst_wanted(ir);
102 int tcouple_min_integration_steps(int etc)
104 int n;
106 switch (etc)
108 case etcNO:
109 n = 0;
110 break;
111 case etcBERENDSEN:
112 case etcYES:
113 n = nstmin_berendsen_tcouple;
114 break;
115 case etcVRESCALE:
116 /* V-rescale supports instantaneous rescaling */
117 n = 0;
118 break;
119 case etcNOSEHOOVER:
120 n = nstmin_harmonic;
121 break;
122 case etcANDERSEN:
123 case etcANDERSENMASSIVE:
124 n = 1;
125 break;
126 default:
127 gmx_incons("Unknown etc value");
128 n = 0;
131 return n;
134 int ir_optimal_nsttcouple(const t_inputrec *ir)
136 int nmin, nwanted, n;
137 real tau_min;
138 int g;
140 nmin = tcouple_min_integration_steps(ir->etc);
142 nwanted = nst_wanted(ir);
144 tau_min = 1e20;
145 if (ir->etc != etcNO)
147 for (g = 0; g < ir->opts.ngtc; g++)
149 if (ir->opts.tau_t[g] > 0)
151 tau_min = std::min(tau_min, ir->opts.tau_t[g]);
156 if (nmin == 0 || ir->delta_t*nwanted <= tau_min)
158 n = nwanted;
160 else
162 n = (int)(tau_min/(ir->delta_t*nmin) + 0.001);
163 if (n < 1)
165 n = 1;
167 while (nwanted % n != 0)
169 n--;
173 return n;
176 int pcouple_min_integration_steps(int epc)
178 int n;
180 switch (epc)
182 case epcNO:
183 n = 0;
184 break;
185 case etcBERENDSEN:
186 case epcISOTROPIC:
187 n = nstmin_berendsen_pcouple;
188 break;
189 case epcPARRINELLORAHMAN:
190 case epcMTTK:
191 n = nstmin_harmonic;
192 break;
193 default:
194 gmx_incons("Unknown epc value");
195 n = 0;
198 return n;
201 int ir_optimal_nstpcouple(const t_inputrec *ir)
203 int nmin, nwanted, n;
205 nmin = pcouple_min_integration_steps(ir->epc);
207 nwanted = nst_wanted(ir);
209 if (nmin == 0 || ir->delta_t*nwanted <= ir->tau_p)
211 n = nwanted;
213 else
215 n = static_cast<int>(ir->tau_p/(ir->delta_t*nmin) + 0.001);
216 if (n < 1)
218 n = 1;
220 while (nwanted % n != 0)
222 n--;
226 return n;
229 gmx_bool ir_coulomb_switched(const t_inputrec *ir)
231 return (ir->coulombtype == eelSWITCH ||
232 ir->coulombtype == eelSHIFT ||
233 ir->coulombtype == eelENCADSHIFT ||
234 ir->coulombtype == eelPMESWITCH ||
235 ir->coulombtype == eelPMEUSERSWITCH ||
236 ir->coulomb_modifier == eintmodPOTSWITCH ||
237 ir->coulomb_modifier == eintmodFORCESWITCH);
240 gmx_bool ir_coulomb_is_zero_at_cutoff(const t_inputrec *ir)
242 return (ir->cutoff_scheme == ecutsVERLET ||
243 ir_coulomb_switched(ir) || ir->coulomb_modifier != eintmodNONE ||
244 ir->coulombtype == eelRF_ZERO);
247 gmx_bool ir_coulomb_might_be_zero_at_cutoff(const t_inputrec *ir)
249 return (ir_coulomb_is_zero_at_cutoff(ir) || ir->coulombtype == eelUSER || ir->coulombtype == eelPMEUSER);
252 gmx_bool ir_vdw_switched(const t_inputrec *ir)
254 return (ir->vdwtype == evdwSWITCH ||
255 ir->vdwtype == evdwSHIFT ||
256 ir->vdwtype == evdwENCADSHIFT ||
257 ir->vdw_modifier == eintmodPOTSWITCH ||
258 ir->vdw_modifier == eintmodFORCESWITCH);
261 gmx_bool ir_vdw_is_zero_at_cutoff(const t_inputrec *ir)
263 return (ir->cutoff_scheme == ecutsVERLET ||
264 ir_vdw_switched(ir) || ir->vdw_modifier != eintmodNONE);
267 gmx_bool ir_vdw_might_be_zero_at_cutoff(const t_inputrec *ir)
269 return (ir_vdw_is_zero_at_cutoff(ir) || ir->vdwtype == evdwUSER);
272 static void done_pull_group(t_pull_group *pgrp)
274 if (pgrp->nat > 0)
276 sfree(pgrp->ind);
277 sfree(pgrp->weight);
281 static void done_pull_params(pull_params_t *pull)
283 int i;
285 for (i = 0; i < pull->ngroup+1; i++)
287 done_pull_group(pull->group);
290 sfree(pull->group);
291 sfree(pull->coord);
294 static void done_lambdas(t_lambda *fep)
296 if (fep->n_lambda > 0)
298 for (int i = 0; i < efptNR; i++)
300 sfree(fep->all_lambda[i]);
302 sfree(fep->all_lambda);
306 void done_inputrec(t_inputrec *ir)
308 sfree(ir->opts.nrdf);
309 sfree(ir->opts.ref_t);
310 sfree(ir->opts.annealing);
311 sfree(ir->opts.anneal_npoints);
312 sfree(ir->opts.anneal_time);
313 sfree(ir->opts.anneal_temp);
314 sfree(ir->opts.tau_t);
315 sfree(ir->opts.acc);
316 sfree(ir->opts.nFreeze);
317 sfree(ir->opts.QMmethod);
318 sfree(ir->opts.QMbasis);
319 sfree(ir->opts.QMcharge);
320 sfree(ir->opts.QMmult);
321 sfree(ir->opts.bSH);
322 sfree(ir->opts.CASorbitals);
323 sfree(ir->opts.CASelectrons);
324 sfree(ir->opts.SAon);
325 sfree(ir->opts.SAoff);
326 sfree(ir->opts.SAsteps);
327 sfree(ir->opts.bOPT);
328 sfree(ir->opts.bTS);
329 sfree(ir->opts.egp_flags);
330 done_lambdas(ir->fepvals);
331 sfree(ir->fepvals);
332 sfree(ir->expandedvals);
333 sfree(ir->simtempvals);
335 if (ir->pull)
337 done_pull_params(ir->pull);
338 sfree(ir->pull);
340 delete ir->params;
343 static void pr_qm_opts(FILE *fp, int indent, const char *title, const t_grpopts *opts)
345 fprintf(fp, "%s:\n", title);
347 pr_int(fp, indent, "ngQM", opts->ngQM);
348 if (opts->ngQM > 0)
350 pr_ivec(fp, indent, "QMmethod", opts->QMmethod, opts->ngQM, FALSE);
351 pr_ivec(fp, indent, "QMbasis", opts->QMbasis, opts->ngQM, FALSE);
352 pr_ivec(fp, indent, "QMcharge", opts->QMcharge, opts->ngQM, FALSE);
353 pr_ivec(fp, indent, "QMmult", opts->QMmult, opts->ngQM, FALSE);
354 pr_bvec(fp, indent, "SH", opts->bSH, opts->ngQM, FALSE);
355 pr_ivec(fp, indent, "CASorbitals", opts->CASorbitals, opts->ngQM, FALSE);
356 pr_ivec(fp, indent, "CASelectrons", opts->CASelectrons, opts->ngQM, FALSE);
357 pr_rvec(fp, indent, "SAon", opts->SAon, opts->ngQM, FALSE);
358 pr_rvec(fp, indent, "SAoff", opts->SAoff, opts->ngQM, FALSE);
359 pr_ivec(fp, indent, "SAsteps", opts->SAsteps, opts->ngQM, FALSE);
360 pr_bvec(fp, indent, "bOPT", opts->bOPT, opts->ngQM, FALSE);
361 pr_bvec(fp, indent, "bTS", opts->bTS, opts->ngQM, FALSE);
365 static void pr_grp_opts(FILE *out, int indent, const char *title, const t_grpopts *opts,
366 gmx_bool bMDPformat)
368 int i, m, j;
370 if (!bMDPformat)
372 fprintf(out, "%s:\n", title);
375 pr_indent(out, indent);
376 fprintf(out, "nrdf%s", bMDPformat ? " = " : ":");
377 for (i = 0; (i < opts->ngtc); i++)
379 fprintf(out, " %10g", opts->nrdf[i]);
381 fprintf(out, "\n");
383 pr_indent(out, indent);
384 fprintf(out, "ref-t%s", bMDPformat ? " = " : ":");
385 for (i = 0; (i < opts->ngtc); i++)
387 fprintf(out, " %10g", opts->ref_t[i]);
389 fprintf(out, "\n");
391 pr_indent(out, indent);
392 fprintf(out, "tau-t%s", bMDPformat ? " = " : ":");
393 for (i = 0; (i < opts->ngtc); i++)
395 fprintf(out, " %10g", opts->tau_t[i]);
397 fprintf(out, "\n");
399 /* Pretty-print the simulated annealing info */
400 fprintf(out, "annealing%s", bMDPformat ? " = " : ":");
401 for (i = 0; (i < opts->ngtc); i++)
403 fprintf(out, " %10s", EANNEAL(opts->annealing[i]));
405 fprintf(out, "\n");
407 fprintf(out, "annealing-npoints%s", bMDPformat ? " = " : ":");
408 for (i = 0; (i < opts->ngtc); i++)
410 fprintf(out, " %10d", opts->anneal_npoints[i]);
412 fprintf(out, "\n");
414 for (i = 0; (i < opts->ngtc); i++)
416 if (opts->anneal_npoints[i] > 0)
418 fprintf(out, "annealing-time [%d]:\t", i);
419 for (j = 0; (j < opts->anneal_npoints[i]); j++)
421 fprintf(out, " %10.1f", opts->anneal_time[i][j]);
423 fprintf(out, "\n");
424 fprintf(out, "annealing-temp [%d]:\t", i);
425 for (j = 0; (j < opts->anneal_npoints[i]); j++)
427 fprintf(out, " %10.1f", opts->anneal_temp[i][j]);
429 fprintf(out, "\n");
433 pr_indent(out, indent);
434 fprintf(out, "acc:\t");
435 for (i = 0; (i < opts->ngacc); i++)
437 for (m = 0; (m < DIM); m++)
439 fprintf(out, " %10g", opts->acc[i][m]);
442 fprintf(out, "\n");
444 pr_indent(out, indent);
445 fprintf(out, "nfreeze:");
446 for (i = 0; (i < opts->ngfrz); i++)
448 for (m = 0; (m < DIM); m++)
450 fprintf(out, " %10s", opts->nFreeze[i][m] ? "Y" : "N");
453 fprintf(out, "\n");
456 for (i = 0; (i < opts->ngener); i++)
458 pr_indent(out, indent);
459 fprintf(out, "energygrp-flags[%3d]:", i);
460 for (m = 0; (m < opts->ngener); m++)
462 fprintf(out, " %d", opts->egp_flags[opts->ngener*i+m]);
464 fprintf(out, "\n");
467 fflush(out);
470 static void pr_matrix(FILE *fp, int indent, const char *title, const rvec *m,
471 gmx_bool bMDPformat)
473 if (bMDPformat)
475 fprintf(fp, "%-10s = %g %g %g %g %g %g\n", title,
476 m[XX][XX], m[YY][YY], m[ZZ][ZZ], m[XX][YY], m[XX][ZZ], m[YY][ZZ]);
478 else
480 pr_rvecs(fp, indent, title, m, DIM);
484 #define PS(t, s) pr_str(fp, indent, t, s)
485 #define PI(t, s) pr_int(fp, indent, t, s)
486 #define PSTEP(t, s) pr_int64(fp, indent, t, s)
487 #define PR(t, s) pr_real(fp, indent, t, s)
488 #define PD(t, s) pr_double(fp, indent, t, s)
490 static void pr_pull_group(FILE *fp, int indent, int g, const t_pull_group *pgrp)
492 pr_indent(fp, indent);
493 fprintf(fp, "pull-group %d:\n", g);
494 indent += 2;
495 pr_ivec_block(fp, indent, "atom", pgrp->ind, pgrp->nat, TRUE);
496 pr_rvec(fp, indent, "weight", pgrp->weight, pgrp->nweight, TRUE);
497 PI("pbcatom", pgrp->pbcatom);
500 static void pr_pull_coord(FILE *fp, int indent, int c, const t_pull_coord *pcrd)
502 int g;
504 pr_indent(fp, indent);
505 fprintf(fp, "pull-coord %d:\n", c);
506 PS("type", EPULLTYPE(pcrd->eType));
507 if (pcrd->eType == epullEXTERNAL)
509 PS("potential-provider", pcrd->externalPotentialProvider);
511 PS("geometry", EPULLGEOM(pcrd->eGeom));
512 for (g = 0; g < pcrd->ngroup; g++)
514 char buf[10];
516 sprintf(buf, "group[%d]", g);
517 PI(buf, pcrd->group[g]);
519 pr_ivec(fp, indent, "dim", pcrd->dim, DIM, TRUE);
520 pr_rvec(fp, indent, "origin", pcrd->origin, DIM, TRUE);
521 pr_rvec(fp, indent, "vec", pcrd->vec, DIM, TRUE);
522 PS("start", EBOOL(pcrd->bStart));
523 PR("init", pcrd->init);
524 PR("rate", pcrd->rate);
525 PR("k", pcrd->k);
526 PR("kB", pcrd->kB);
529 static void pr_simtempvals(FILE *fp, int indent, const t_simtemp *simtemp, int n_lambda)
531 PS("simulated-tempering-scaling", ESIMTEMP(simtemp->eSimTempScale));
532 PR("sim-temp-low", simtemp->simtemp_low);
533 PR("sim-temp-high", simtemp->simtemp_high);
534 pr_rvec(fp, indent, "simulated tempering temperatures", simtemp->temperatures, n_lambda, TRUE);
537 static void pr_expandedvals(FILE *fp, int indent, const t_expanded *expand, int n_lambda)
540 PI("nstexpanded", expand->nstexpanded);
541 PS("lmc-stats", elamstats_names[expand->elamstats]);
542 PS("lmc-move", elmcmove_names[expand->elmcmove]);
543 PS("lmc-weights-equil", elmceq_names[expand->elmceq]);
544 if (expand->elmceq == elmceqNUMATLAM)
546 PI("weight-equil-number-all-lambda", expand->equil_n_at_lam);
548 if (expand->elmceq == elmceqSAMPLES)
550 PI("weight-equil-number-samples", expand->equil_samples);
552 if (expand->elmceq == elmceqSTEPS)
554 PI("weight-equil-number-steps", expand->equil_steps);
556 if (expand->elmceq == elmceqWLDELTA)
558 PR("weight-equil-wl-delta", expand->equil_wl_delta);
560 if (expand->elmceq == elmceqRATIO)
562 PR("weight-equil-count-ratio", expand->equil_ratio);
564 PI("lmc-seed", expand->lmc_seed);
565 PR("mc-temperature", expand->mc_temp);
566 PI("lmc-repeats", expand->lmc_repeats);
567 PI("lmc-gibbsdelta", expand->gibbsdeltalam);
568 PI("lmc-forced-nstart", expand->lmc_forced_nstart);
569 PS("symmetrized-transition-matrix", EBOOL(expand->bSymmetrizedTMatrix));
570 PI("nst-transition-matrix", expand->nstTij);
571 PI("mininum-var-min", expand->minvarmin); /*default is reasonable */
572 PI("weight-c-range", expand->c_range); /* default is just C=0 */
573 PR("wl-scale", expand->wl_scale);
574 PR("wl-ratio", expand->wl_ratio);
575 PR("init-wl-delta", expand->init_wl_delta);
576 PS("wl-oneovert", EBOOL(expand->bWLoneovert));
578 pr_indent(fp, indent);
579 pr_rvec(fp, indent, "init-lambda-weights", expand->init_lambda_weights, n_lambda, TRUE);
580 PS("init-weights", EBOOL(expand->bInit_weights));
583 static void pr_fepvals(FILE *fp, int indent, const t_lambda *fep, gmx_bool bMDPformat)
585 int i, j;
587 PR("init-lambda", fep->init_lambda);
588 PI("init-lambda-state", fep->init_fep_state);
589 PR("delta-lambda", fep->delta_lambda);
590 PI("nstdhdl", fep->nstdhdl);
592 if (!bMDPformat)
594 PI("n-lambdas", fep->n_lambda);
596 if (fep->n_lambda > 0)
598 pr_indent(fp, indent);
599 fprintf(fp, "separate-dvdl%s\n", bMDPformat ? " = " : ":");
600 for (i = 0; i < efptNR; i++)
602 fprintf(fp, "%18s = ", efpt_names[i]);
603 if (fep->separate_dvdl[i])
605 fprintf(fp, " TRUE");
607 else
609 fprintf(fp, " FALSE");
611 fprintf(fp, "\n");
613 fprintf(fp, "all-lambdas%s\n", bMDPformat ? " = " : ":");
614 for (i = 0; i < efptNR; i++)
616 fprintf(fp, "%18s = ", efpt_names[i]);
617 for (j = 0; j < fep->n_lambda; j++)
619 fprintf(fp, " %10g", fep->all_lambda[i][j]);
621 fprintf(fp, "\n");
624 PI("calc-lambda-neighbors", fep->lambda_neighbors);
625 PS("dhdl-print-energy", edHdLPrintEnergy_names[fep->edHdLPrintEnergy]);
626 PR("sc-alpha", fep->sc_alpha);
627 PI("sc-power", fep->sc_power);
628 PR("sc-r-power", fep->sc_r_power);
629 PR("sc-sigma", fep->sc_sigma);
630 PR("sc-sigma-min", fep->sc_sigma_min);
631 PS("sc-coul", EBOOL(fep->bScCoul));
632 PI("dh-hist-size", fep->dh_hist_size);
633 PD("dh-hist-spacing", fep->dh_hist_spacing);
634 PS("separate-dhdl-file", SEPDHDLFILETYPE(fep->separate_dhdl_file));
635 PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(fep->dhdl_derivatives));
638 static void pr_pull(FILE *fp, int indent, const pull_params_t *pull)
640 int g;
642 PR("pull-cylinder-r", pull->cylinder_r);
643 PR("pull-constr-tol", pull->constr_tol);
644 PS("pull-print-COM", EBOOL(pull->bPrintCOM));
645 PS("pull-print-ref-value", EBOOL(pull->bPrintRefValue));
646 PS("pull-print-components", EBOOL(pull->bPrintComp));
647 PI("pull-nstxout", pull->nstxout);
648 PI("pull-nstfout", pull->nstfout);
649 PI("pull-ngroups", pull->ngroup);
650 for (g = 0; g < pull->ngroup; g++)
652 pr_pull_group(fp, indent, g, &pull->group[g]);
654 PI("pull-ncoords", pull->ncoord);
655 for (g = 0; g < pull->ncoord; g++)
657 pr_pull_coord(fp, indent, g, &pull->coord[g]);
661 static void pr_rotgrp(FILE *fp, int indent, int g, const t_rotgrp *rotg)
663 pr_indent(fp, indent);
664 fprintf(fp, "rot-group %d:\n", g);
665 indent += 2;
666 PS("rot-type", EROTGEOM(rotg->eType));
667 PS("rot-massw", EBOOL(rotg->bMassW));
668 pr_ivec_block(fp, indent, "atom", rotg->ind, rotg->nat, TRUE);
669 pr_rvecs(fp, indent, "x-ref", rotg->x_ref, rotg->nat);
670 pr_rvec(fp, indent, "rot-vec", rotg->vec, DIM, TRUE);
671 pr_rvec(fp, indent, "rot-pivot", rotg->pivot, DIM, TRUE);
672 PR("rot-rate", rotg->rate);
673 PR("rot-k", rotg->k);
674 PR("rot-slab-dist", rotg->slab_dist);
675 PR("rot-min-gauss", rotg->min_gaussian);
676 PR("rot-eps", rotg->eps);
677 PS("rot-fit-method", EROTFIT(rotg->eFittype));
678 PI("rot-potfit-nstep", rotg->PotAngle_nstep);
679 PR("rot-potfit-step", rotg->PotAngle_step);
682 static void pr_rot(FILE *fp, int indent, const t_rot *rot)
684 int g;
686 PI("rot-nstrout", rot->nstrout);
687 PI("rot-nstsout", rot->nstsout);
688 PI("rot-ngroups", rot->ngrp);
689 for (g = 0; g < rot->ngrp; g++)
691 pr_rotgrp(fp, indent, g, &rot->grp[g]);
696 static void pr_swap(FILE *fp, int indent, const t_swapcoords *swap)
698 char str[STRLEN];
700 /* Enums for better readability of the code */
701 enum {
702 eCompA = 0, eCompB
706 PI("swap-frequency", swap->nstswap);
708 /* The split groups that define the compartments */
709 for (int j = 0; j < 2; j++)
711 snprintf(str, STRLEN, "massw_split%d", j);
712 PS(str, EBOOL(swap->massw_split[j]));
713 snprintf(str, STRLEN, "split atoms group %d", j);
714 pr_ivec_block(fp, indent, str, swap->grp[j].ind, swap->grp[j].nat, TRUE);
717 /* The solvent group */
718 snprintf(str, STRLEN, "solvent group %s", swap->grp[eGrpSolvent].molname);
719 pr_ivec_block(fp, indent, str, swap->grp[eGrpSolvent].ind, swap->grp[eGrpSolvent].nat, TRUE);
721 /* Now print the indices for all the ion groups: */
722 for (int ig = eSwapFixedGrpNR; ig < swap->ngrp; ig++)
724 snprintf(str, STRLEN, "ion group %s", swap->grp[ig].molname);
725 pr_ivec_block(fp, indent, str, swap->grp[ig].ind, swap->grp[ig].nat, TRUE);
728 PR("cyl0-r", swap->cyl0r);
729 PR("cyl0-up", swap->cyl0u);
730 PR("cyl0-down", swap->cyl0l);
731 PR("cyl1-r", swap->cyl1r);
732 PR("cyl1-up", swap->cyl1u);
733 PR("cyl1-down", swap->cyl1l);
734 PI("coupl-steps", swap->nAverage);
736 /* Print the requested ion counts for both compartments */
737 for (int ic = eCompA; ic <= eCompB; ic++)
739 for (int ig = eSwapFixedGrpNR; ig < swap->ngrp; ig++)
741 snprintf(str, STRLEN, "%s-in-%c", swap->grp[ig].molname, 'A'+ic);
742 PI(str, swap->grp[ig].nmolReq[ic]);
746 PR("threshold", swap->threshold);
747 PR("bulk-offsetA", swap->bulkOffset[eCompA]);
748 PR("bulk-offsetB", swap->bulkOffset[eCompB]);
752 static void pr_imd(FILE *fp, int indent, const t_IMD *imd)
754 PI("IMD-atoms", imd->nat);
755 pr_ivec_block(fp, indent, "atom", imd->ind, imd->nat, TRUE);
759 void pr_inputrec(FILE *fp, int indent, const char *title, const t_inputrec *ir,
760 gmx_bool bMDPformat)
762 const char *infbuf = "inf";
764 if (available(fp, ir, indent, title))
766 if (!bMDPformat)
768 indent = pr_title(fp, indent, title);
770 /* Try to make this list appear in the same order as the
771 * options are written in the default mdout.mdp, and with
772 * the same user-exposed names to facilitate debugging.
774 PS("integrator", EI(ir->eI));
775 PR("tinit", ir->init_t);
776 PR("dt", ir->delta_t);
777 PSTEP("nsteps", ir->nsteps);
778 PSTEP("init-step", ir->init_step);
779 PI("simulation-part", ir->simulation_part);
780 PS("comm-mode", ECOM(ir->comm_mode));
781 PI("nstcomm", ir->nstcomm);
783 /* Langevin dynamics */
784 PR("bd-fric", ir->bd_fric);
785 PSTEP("ld-seed", ir->ld_seed);
787 /* Energy minimization */
788 PR("emtol", ir->em_tol);
789 PR("emstep", ir->em_stepsize);
790 PI("niter", ir->niter);
791 PR("fcstep", ir->fc_stepsize);
792 PI("nstcgsteep", ir->nstcgsteep);
793 PI("nbfgscorr", ir->nbfgscorr);
795 /* Test particle insertion */
796 PR("rtpi", ir->rtpi);
798 /* Output control */
799 PI("nstxout", ir->nstxout);
800 PI("nstvout", ir->nstvout);
801 PI("nstfout", ir->nstfout);
802 PI("nstlog", ir->nstlog);
803 PI("nstcalcenergy", ir->nstcalcenergy);
804 PI("nstenergy", ir->nstenergy);
805 PI("nstxout-compressed", ir->nstxout_compressed);
806 PR("compressed-x-precision", ir->x_compression_precision);
808 /* Neighborsearching parameters */
809 PS("cutoff-scheme", ECUTSCHEME(ir->cutoff_scheme));
810 PI("nstlist", ir->nstlist);
811 PS("ns-type", ENS(ir->ns_type));
812 PS("pbc", epbc_names[ir->ePBC]);
813 PS("periodic-molecules", EBOOL(ir->bPeriodicMols));
814 PR("verlet-buffer-tolerance", ir->verletbuf_tol);
815 PR("rlist", ir->rlist);
817 /* Options for electrostatics and VdW */
818 PS("coulombtype", EELTYPE(ir->coulombtype));
819 PS("coulomb-modifier", INTMODIFIER(ir->coulomb_modifier));
820 PR("rcoulomb-switch", ir->rcoulomb_switch);
821 PR("rcoulomb", ir->rcoulomb);
822 if (ir->epsilon_r != 0)
824 PR("epsilon-r", ir->epsilon_r);
826 else
828 PS("epsilon-r", infbuf);
830 if (ir->epsilon_rf != 0)
832 PR("epsilon-rf", ir->epsilon_rf);
834 else
836 PS("epsilon-rf", infbuf);
838 PS("vdw-type", EVDWTYPE(ir->vdwtype));
839 PS("vdw-modifier", INTMODIFIER(ir->vdw_modifier));
840 PR("rvdw-switch", ir->rvdw_switch);
841 PR("rvdw", ir->rvdw);
842 PS("DispCorr", EDISPCORR(ir->eDispCorr));
843 PR("table-extension", ir->tabext);
845 PR("fourierspacing", ir->fourier_spacing);
846 PI("fourier-nx", ir->nkx);
847 PI("fourier-ny", ir->nky);
848 PI("fourier-nz", ir->nkz);
849 PI("pme-order", ir->pme_order);
850 PR("ewald-rtol", ir->ewald_rtol);
851 PR("ewald-rtol-lj", ir->ewald_rtol_lj);
852 PS("lj-pme-comb-rule", ELJPMECOMBNAMES(ir->ljpme_combination_rule));
853 PR("ewald-geometry", ir->ewald_geometry);
854 PR("epsilon-surface", ir->epsilon_surface);
856 /* Implicit solvent */
857 PS("implicit-solvent", EIMPLICITSOL(ir->implicit_solvent));
859 /* Generalized born electrostatics */
860 PS("gb-algorithm", EGBALGORITHM(ir->gb_algorithm));
861 PI("nstgbradii", ir->nstgbradii);
862 PR("rgbradii", ir->rgbradii);
863 PR("gb-epsilon-solvent", ir->gb_epsilon_solvent);
864 PR("gb-saltconc", ir->gb_saltconc);
865 PR("gb-obc-alpha", ir->gb_obc_alpha);
866 PR("gb-obc-beta", ir->gb_obc_beta);
867 PR("gb-obc-gamma", ir->gb_obc_gamma);
868 PR("gb-dielectric-offset", ir->gb_dielectric_offset);
869 PS("sa-algorithm", ESAALGORITHM(ir->sa_algorithm));
870 PR("sa-surface-tension", ir->sa_surface_tension);
872 /* Options for weak coupling algorithms */
873 PS("tcoupl", ETCOUPLTYPE(ir->etc));
874 PI("nsttcouple", ir->nsttcouple);
875 PI("nh-chain-length", ir->opts.nhchainlength);
876 PS("print-nose-hoover-chain-variables", EBOOL(ir->bPrintNHChains));
878 PS("pcoupl", EPCOUPLTYPE(ir->epc));
879 PS("pcoupltype", EPCOUPLTYPETYPE(ir->epct));
880 PI("nstpcouple", ir->nstpcouple);
881 PR("tau-p", ir->tau_p);
882 pr_matrix(fp, indent, "compressibility", ir->compress, bMDPformat);
883 pr_matrix(fp, indent, "ref-p", ir->ref_p, bMDPformat);
884 PS("refcoord-scaling", EREFSCALINGTYPE(ir->refcoord_scaling));
886 if (bMDPformat)
888 fprintf(fp, "posres-com = %g %g %g\n", ir->posres_com[XX],
889 ir->posres_com[YY], ir->posres_com[ZZ]);
890 fprintf(fp, "posres-comB = %g %g %g\n", ir->posres_comB[XX],
891 ir->posres_comB[YY], ir->posres_comB[ZZ]);
893 else
895 pr_rvec(fp, indent, "posres-com", ir->posres_com, DIM, TRUE);
896 pr_rvec(fp, indent, "posres-comB", ir->posres_comB, DIM, TRUE);
899 /* QMMM */
900 PS("QMMM", EBOOL(ir->bQMMM));
901 PI("QMconstraints", ir->QMconstraints);
902 PI("QMMMscheme", ir->QMMMscheme);
903 PR("MMChargeScaleFactor", ir->scalefactor);
904 pr_qm_opts(fp, indent, "qm-opts", &(ir->opts));
906 /* CONSTRAINT OPTIONS */
907 PS("constraint-algorithm", ECONSTRTYPE(ir->eConstrAlg));
908 PS("continuation", EBOOL(ir->bContinuation));
910 PS("Shake-SOR", EBOOL(ir->bShakeSOR));
911 PR("shake-tol", ir->shake_tol);
912 PI("lincs-order", ir->nProjOrder);
913 PI("lincs-iter", ir->nLincsIter);
914 PR("lincs-warnangle", ir->LincsWarnAngle);
916 /* Walls */
917 PI("nwall", ir->nwall);
918 PS("wall-type", EWALLTYPE(ir->wall_type));
919 PR("wall-r-linpot", ir->wall_r_linpot);
920 /* wall-atomtype */
921 PI("wall-atomtype[0]", ir->wall_atomtype[0]);
922 PI("wall-atomtype[1]", ir->wall_atomtype[1]);
923 /* wall-density */
924 PR("wall-density[0]", ir->wall_density[0]);
925 PR("wall-density[1]", ir->wall_density[1]);
926 PR("wall-ewald-zfac", ir->wall_ewald_zfac);
928 /* COM PULLING */
929 PS("pull", EBOOL(ir->bPull));
930 if (ir->bPull)
932 pr_pull(fp, indent, ir->pull);
935 /* ENFORCED ROTATION */
936 PS("rotation", EBOOL(ir->bRot));
937 if (ir->bRot)
939 pr_rot(fp, indent, ir->rot);
942 /* INTERACTIVE MD */
943 PS("interactiveMD", EBOOL(ir->bIMD));
944 if (ir->bIMD)
946 pr_imd(fp, indent, ir->imd);
949 /* NMR refinement stuff */
950 PS("disre", EDISRETYPE(ir->eDisre));
951 PS("disre-weighting", EDISREWEIGHTING(ir->eDisreWeighting));
952 PS("disre-mixed", EBOOL(ir->bDisreMixed));
953 PR("dr-fc", ir->dr_fc);
954 PR("dr-tau", ir->dr_tau);
955 PR("nstdisreout", ir->nstdisreout);
957 PR("orire-fc", ir->orires_fc);
958 PR("orire-tau", ir->orires_tau);
959 PR("nstorireout", ir->nstorireout);
961 /* FREE ENERGY VARIABLES */
962 PS("free-energy", EFEPTYPE(ir->efep));
963 if (ir->efep != efepNO || ir->bSimTemp)
965 pr_fepvals(fp, indent, ir->fepvals, bMDPformat);
967 if (ir->bExpanded)
969 pr_expandedvals(fp, indent, ir->expandedvals, ir->fepvals->n_lambda);
972 /* NON-equilibrium MD stuff */
973 PR("cos-acceleration", ir->cos_accel);
974 pr_matrix(fp, indent, "deform", ir->deform, bMDPformat);
976 /* SIMULATED TEMPERING */
977 PS("simulated-tempering", EBOOL(ir->bSimTemp));
978 if (ir->bSimTemp)
980 pr_simtempvals(fp, indent, ir->simtempvals, ir->fepvals->n_lambda);
983 /* ION/WATER SWAPPING FOR COMPUTATIONAL ELECTROPHYSIOLOGY */
984 PS("swapcoords", ESWAPTYPE(ir->eSwapCoords));
985 if (ir->eSwapCoords != eswapNO)
987 pr_swap(fp, indent, ir->swap);
990 /* USER-DEFINED THINGIES */
991 PI("userint1", ir->userint1);
992 PI("userint2", ir->userint2);
993 PI("userint3", ir->userint3);
994 PI("userint4", ir->userint4);
995 PR("userreal1", ir->userreal1);
996 PR("userreal2", ir->userreal2);
997 PR("userreal3", ir->userreal3);
998 PR("userreal4", ir->userreal4);
1000 if (!bMDPformat)
1002 gmx::TextWriter writer(fp);
1003 writer.wrapperSettings().setIndent(indent);
1004 ir->params->writeUsing(&writer);
1007 pr_grp_opts(fp, indent, "grpopts", &(ir->opts), bMDPformat);
1010 #undef PS
1011 #undef PR
1012 #undef PI
1014 static void cmp_grpopts(FILE *fp, const t_grpopts *opt1, const t_grpopts *opt2, real ftol, real abstol)
1016 int i, j;
1017 char buf1[256], buf2[256];
1019 cmp_int(fp, "inputrec->grpopts.ngtc", -1, opt1->ngtc, opt2->ngtc);
1020 cmp_int(fp, "inputrec->grpopts.ngacc", -1, opt1->ngacc, opt2->ngacc);
1021 cmp_int(fp, "inputrec->grpopts.ngfrz", -1, opt1->ngfrz, opt2->ngfrz);
1022 cmp_int(fp, "inputrec->grpopts.ngener", -1, opt1->ngener, opt2->ngener);
1023 for (i = 0; (i < std::min(opt1->ngtc, opt2->ngtc)); i++)
1025 cmp_real(fp, "inputrec->grpopts.nrdf", i, opt1->nrdf[i], opt2->nrdf[i], ftol, abstol);
1026 cmp_real(fp, "inputrec->grpopts.ref_t", i, opt1->ref_t[i], opt2->ref_t[i], ftol, abstol);
1027 cmp_real(fp, "inputrec->grpopts.tau_t", i, opt1->tau_t[i], opt2->tau_t[i], ftol, abstol);
1028 cmp_int(fp, "inputrec->grpopts.annealing", i, opt1->annealing[i], opt2->annealing[i]);
1029 cmp_int(fp, "inputrec->grpopts.anneal_npoints", i,
1030 opt1->anneal_npoints[i], opt2->anneal_npoints[i]);
1031 if (opt1->anneal_npoints[i] == opt2->anneal_npoints[i])
1033 sprintf(buf1, "inputrec->grpopts.anneal_time[%d]", i);
1034 sprintf(buf2, "inputrec->grpopts.anneal_temp[%d]", i);
1035 for (j = 0; j < opt1->anneal_npoints[i]; j++)
1037 cmp_real(fp, buf1, j, opt1->anneal_time[i][j], opt2->anneal_time[i][j], ftol, abstol);
1038 cmp_real(fp, buf2, j, opt1->anneal_temp[i][j], opt2->anneal_temp[i][j], ftol, abstol);
1042 if (opt1->ngener == opt2->ngener)
1044 for (i = 0; i < opt1->ngener; i++)
1046 for (j = i; j < opt1->ngener; j++)
1048 sprintf(buf1, "inputrec->grpopts.egp_flags[%d]", i);
1049 cmp_int(fp, buf1, j,
1050 opt1->egp_flags[opt1->ngener*i+j],
1051 opt2->egp_flags[opt1->ngener*i+j]);
1055 for (i = 0; (i < std::min(opt1->ngacc, opt2->ngacc)); i++)
1057 cmp_rvec(fp, "inputrec->grpopts.acc", i, opt1->acc[i], opt2->acc[i], ftol, abstol);
1059 for (i = 0; (i < std::min(opt1->ngfrz, opt2->ngfrz)); i++)
1061 cmp_ivec(fp, "inputrec->grpopts.nFreeze", i, opt1->nFreeze[i], opt2->nFreeze[i]);
1065 static void cmp_pull(FILE *fp)
1067 fprintf(fp, "WARNING: Both files use COM pulling, but comparing of the pull struct is not implemented (yet). The pull parameters could be the same or different.\n");
1070 static void cmp_simtempvals(FILE *fp, const t_simtemp *simtemp1, const t_simtemp *simtemp2, int n_lambda, real ftol, real abstol)
1072 int i;
1073 cmp_int(fp, "inputrec->simtempvals->eSimTempScale", -1, simtemp1->eSimTempScale, simtemp2->eSimTempScale);
1074 cmp_real(fp, "inputrec->simtempvals->simtemp_high", -1, simtemp1->simtemp_high, simtemp2->simtemp_high, ftol, abstol);
1075 cmp_real(fp, "inputrec->simtempvals->simtemp_low", -1, simtemp1->simtemp_low, simtemp2->simtemp_low, ftol, abstol);
1076 for (i = 0; i < n_lambda; i++)
1078 cmp_real(fp, "inputrec->simtempvals->temperatures", -1, simtemp1->temperatures[i], simtemp2->temperatures[i], ftol, abstol);
1082 static void cmp_expandedvals(FILE *fp, const t_expanded *expand1, const t_expanded *expand2, int n_lambda, real ftol, real abstol)
1084 int i;
1086 cmp_bool(fp, "inputrec->fepvals->bInit_weights", -1, expand1->bInit_weights, expand2->bInit_weights);
1087 cmp_bool(fp, "inputrec->fepvals->bWLoneovert", -1, expand1->bWLoneovert, expand2->bWLoneovert);
1089 for (i = 0; i < n_lambda; i++)
1091 cmp_real(fp, "inputrec->expandedvals->init_lambda_weights", -1,
1092 expand1->init_lambda_weights[i], expand2->init_lambda_weights[i], ftol, abstol);
1095 cmp_int(fp, "inputrec->expandedvals->lambda-stats", -1, expand1->elamstats, expand2->elamstats);
1096 cmp_int(fp, "inputrec->expandedvals->lambda-mc-move", -1, expand1->elmcmove, expand2->elmcmove);
1097 cmp_int(fp, "inputrec->expandedvals->lmc-repeats", -1, expand1->lmc_repeats, expand2->lmc_repeats);
1098 cmp_int(fp, "inputrec->expandedvals->lmc-gibbsdelta", -1, expand1->gibbsdeltalam, expand2->gibbsdeltalam);
1099 cmp_int(fp, "inputrec->expandedvals->lmc-forced-nstart", -1, expand1->lmc_forced_nstart, expand2->lmc_forced_nstart);
1100 cmp_int(fp, "inputrec->expandedvals->lambda-weights-equil", -1, expand1->elmceq, expand2->elmceq);
1101 cmp_int(fp, "inputrec->expandedvals->,weight-equil-number-all-lambda", -1, expand1->equil_n_at_lam, expand2->equil_n_at_lam);
1102 cmp_int(fp, "inputrec->expandedvals->weight-equil-number-samples", -1, expand1->equil_samples, expand2->equil_samples);
1103 cmp_int(fp, "inputrec->expandedvals->weight-equil-number-steps", -1, expand1->equil_steps, expand2->equil_steps);
1104 cmp_real(fp, "inputrec->expandedvals->weight-equil-wl-delta", -1, expand1->equil_wl_delta, expand2->equil_wl_delta, ftol, abstol);
1105 cmp_real(fp, "inputrec->expandedvals->weight-equil-count-ratio", -1, expand1->equil_ratio, expand2->equil_ratio, ftol, abstol);
1106 cmp_bool(fp, "inputrec->expandedvals->symmetrized-transition-matrix", -1, expand1->bSymmetrizedTMatrix, expand2->bSymmetrizedTMatrix);
1107 cmp_int(fp, "inputrec->expandedvals->nstTij", -1, expand1->nstTij, expand2->nstTij);
1108 cmp_int(fp, "inputrec->expandedvals->mininum-var-min", -1, expand1->minvarmin, expand2->minvarmin); /*default is reasonable */
1109 cmp_int(fp, "inputrec->expandedvals->weight-c-range", -1, expand1->c_range, expand2->c_range); /* default is just C=0 */
1110 cmp_real(fp, "inputrec->expandedvals->wl-scale", -1, expand1->wl_scale, expand2->wl_scale, ftol, abstol);
1111 cmp_real(fp, "inputrec->expandedvals->init-wl-delta", -1, expand1->init_wl_delta, expand2->init_wl_delta, ftol, abstol);
1112 cmp_real(fp, "inputrec->expandedvals->wl-ratio", -1, expand1->wl_ratio, expand2->wl_ratio, ftol, abstol);
1113 cmp_int(fp, "inputrec->expandedvals->nstexpanded", -1, expand1->nstexpanded, expand2->nstexpanded);
1114 cmp_int(fp, "inputrec->expandedvals->lmc-seed", -1, expand1->lmc_seed, expand2->lmc_seed);
1115 cmp_real(fp, "inputrec->expandedvals->mc-temperature", -1, expand1->mc_temp, expand2->mc_temp, ftol, abstol);
1118 static void cmp_fepvals(FILE *fp, const t_lambda *fep1, const t_lambda *fep2, real ftol, real abstol)
1120 int i, j;
1121 cmp_int(fp, "inputrec->nstdhdl", -1, fep1->nstdhdl, fep2->nstdhdl);
1122 cmp_double(fp, "inputrec->fepvals->init_fep_state", -1, fep1->init_fep_state, fep2->init_fep_state, ftol, abstol);
1123 cmp_double(fp, "inputrec->fepvals->delta_lambda", -1, fep1->delta_lambda, fep2->delta_lambda, ftol, abstol);
1124 cmp_int(fp, "inputrec->fepvals->n_lambda", -1, fep1->n_lambda, fep2->n_lambda);
1125 for (i = 0; i < efptNR; i++)
1127 for (j = 0; j < std::min(fep1->n_lambda, fep2->n_lambda); j++)
1129 cmp_double(fp, "inputrec->fepvals->all_lambda", -1, fep1->all_lambda[i][j], fep2->all_lambda[i][j], ftol, abstol);
1132 cmp_int(fp, "inputrec->fepvals->lambda_neighbors", 1, fep1->lambda_neighbors,
1133 fep2->lambda_neighbors);
1134 cmp_real(fp, "inputrec->fepvals->sc_alpha", -1, fep1->sc_alpha, fep2->sc_alpha, ftol, abstol);
1135 cmp_int(fp, "inputrec->fepvals->sc_power", -1, fep1->sc_power, fep2->sc_power);
1136 cmp_real(fp, "inputrec->fepvals->sc_r_power", -1, fep1->sc_r_power, fep2->sc_r_power, ftol, abstol);
1137 cmp_real(fp, "inputrec->fepvals->sc_sigma", -1, fep1->sc_sigma, fep2->sc_sigma, ftol, abstol);
1138 cmp_int(fp, "inputrec->fepvals->edHdLPrintEnergy", -1, fep1->edHdLPrintEnergy, fep1->edHdLPrintEnergy);
1139 cmp_bool(fp, "inputrec->fepvals->bScCoul", -1, fep1->bScCoul, fep1->bScCoul);
1140 cmp_int(fp, "inputrec->separate_dhdl_file", -1, fep1->separate_dhdl_file, fep2->separate_dhdl_file);
1141 cmp_int(fp, "inputrec->dhdl_derivatives", -1, fep1->dhdl_derivatives, fep2->dhdl_derivatives);
1142 cmp_int(fp, "inputrec->dh_hist_size", -1, fep1->dh_hist_size, fep2->dh_hist_size);
1143 cmp_double(fp, "inputrec->dh_hist_spacing", -1, fep1->dh_hist_spacing, fep2->dh_hist_spacing, ftol, abstol);
1146 void cmp_inputrec(FILE *fp, const t_inputrec *ir1, const t_inputrec *ir2, real ftol, real abstol)
1148 fprintf(fp, "comparing inputrec\n");
1150 /* gcc 2.96 doesnt like these defines at all, but issues a huge list
1151 * of warnings. Maybe it will change in future versions, but for the
1152 * moment I've spelled them out instead. /EL 000820
1153 * #define CIB(s) cmp_int(fp,"inputrec->"#s,0,ir1->##s,ir2->##s)
1154 * #define CII(s) cmp_int(fp,"inputrec->"#s,0,ir1->##s,ir2->##s)
1155 * #define CIR(s) cmp_real(fp,"inputrec->"#s,0,ir1->##s,ir2->##s,ftol)
1157 cmp_int(fp, "inputrec->eI", -1, ir1->eI, ir2->eI);
1158 cmp_int64(fp, "inputrec->nsteps", ir1->nsteps, ir2->nsteps);
1159 cmp_int64(fp, "inputrec->init_step", ir1->init_step, ir2->init_step);
1160 cmp_int(fp, "inputrec->simulation_part", -1, ir1->simulation_part, ir2->simulation_part);
1161 cmp_int(fp, "inputrec->ePBC", -1, ir1->ePBC, ir2->ePBC);
1162 cmp_int(fp, "inputrec->bPeriodicMols", -1, ir1->bPeriodicMols, ir2->bPeriodicMols);
1163 cmp_int(fp, "inputrec->cutoff_scheme", -1, ir1->cutoff_scheme, ir2->cutoff_scheme);
1164 cmp_int(fp, "inputrec->ns_type", -1, ir1->ns_type, ir2->ns_type);
1165 cmp_int(fp, "inputrec->nstlist", -1, ir1->nstlist, ir2->nstlist);
1166 cmp_int(fp, "inputrec->nstcomm", -1, ir1->nstcomm, ir2->nstcomm);
1167 cmp_int(fp, "inputrec->comm_mode", -1, ir1->comm_mode, ir2->comm_mode);
1168 cmp_int(fp, "inputrec->nstlog", -1, ir1->nstlog, ir2->nstlog);
1169 cmp_int(fp, "inputrec->nstxout", -1, ir1->nstxout, ir2->nstxout);
1170 cmp_int(fp, "inputrec->nstvout", -1, ir1->nstvout, ir2->nstvout);
1171 cmp_int(fp, "inputrec->nstfout", -1, ir1->nstfout, ir2->nstfout);
1172 cmp_int(fp, "inputrec->nstcalcenergy", -1, ir1->nstcalcenergy, ir2->nstcalcenergy);
1173 cmp_int(fp, "inputrec->nstenergy", -1, ir1->nstenergy, ir2->nstenergy);
1174 cmp_int(fp, "inputrec->nstxout_compressed", -1, ir1->nstxout_compressed, ir2->nstxout_compressed);
1175 cmp_double(fp, "inputrec->init_t", -1, ir1->init_t, ir2->init_t, ftol, abstol);
1176 cmp_double(fp, "inputrec->delta_t", -1, ir1->delta_t, ir2->delta_t, ftol, abstol);
1177 cmp_real(fp, "inputrec->x_compression_precision", -1, ir1->x_compression_precision, ir2->x_compression_precision, ftol, abstol);
1178 cmp_real(fp, "inputrec->fourierspacing", -1, ir1->fourier_spacing, ir2->fourier_spacing, ftol, abstol);
1179 cmp_int(fp, "inputrec->nkx", -1, ir1->nkx, ir2->nkx);
1180 cmp_int(fp, "inputrec->nky", -1, ir1->nky, ir2->nky);
1181 cmp_int(fp, "inputrec->nkz", -1, ir1->nkz, ir2->nkz);
1182 cmp_int(fp, "inputrec->pme_order", -1, ir1->pme_order, ir2->pme_order);
1183 cmp_real(fp, "inputrec->ewald_rtol", -1, ir1->ewald_rtol, ir2->ewald_rtol, ftol, abstol);
1184 cmp_int(fp, "inputrec->ewald_geometry", -1, ir1->ewald_geometry, ir2->ewald_geometry);
1185 cmp_real(fp, "inputrec->epsilon_surface", -1, ir1->epsilon_surface, ir2->epsilon_surface, ftol, abstol);
1186 cmp_int(fp, "inputrec->bContinuation", -1, ir1->bContinuation, ir2->bContinuation);
1187 cmp_int(fp, "inputrec->bShakeSOR", -1, ir1->bShakeSOR, ir2->bShakeSOR);
1188 cmp_int(fp, "inputrec->etc", -1, ir1->etc, ir2->etc);
1189 cmp_int(fp, "inputrec->bPrintNHChains", -1, ir1->bPrintNHChains, ir2->bPrintNHChains);
1190 cmp_int(fp, "inputrec->epc", -1, ir1->epc, ir2->epc);
1191 cmp_int(fp, "inputrec->epct", -1, ir1->epct, ir2->epct);
1192 cmp_real(fp, "inputrec->tau_p", -1, ir1->tau_p, ir2->tau_p, ftol, abstol);
1193 cmp_rvec(fp, "inputrec->ref_p(x)", -1, ir1->ref_p[XX], ir2->ref_p[XX], ftol, abstol);
1194 cmp_rvec(fp, "inputrec->ref_p(y)", -1, ir1->ref_p[YY], ir2->ref_p[YY], ftol, abstol);
1195 cmp_rvec(fp, "inputrec->ref_p(z)", -1, ir1->ref_p[ZZ], ir2->ref_p[ZZ], ftol, abstol);
1196 cmp_rvec(fp, "inputrec->compress(x)", -1, ir1->compress[XX], ir2->compress[XX], ftol, abstol);
1197 cmp_rvec(fp, "inputrec->compress(y)", -1, ir1->compress[YY], ir2->compress[YY], ftol, abstol);
1198 cmp_rvec(fp, "inputrec->compress(z)", -1, ir1->compress[ZZ], ir2->compress[ZZ], ftol, abstol);
1199 cmp_int(fp, "refcoord_scaling", -1, ir1->refcoord_scaling, ir2->refcoord_scaling);
1200 cmp_rvec(fp, "inputrec->posres_com", -1, ir1->posres_com, ir2->posres_com, ftol, abstol);
1201 cmp_rvec(fp, "inputrec->posres_comB", -1, ir1->posres_comB, ir2->posres_comB, ftol, abstol);
1202 cmp_real(fp, "inputrec->verletbuf_tol", -1, ir1->verletbuf_tol, ir2->verletbuf_tol, ftol, abstol);
1203 cmp_real(fp, "inputrec->rlist", -1, ir1->rlist, ir2->rlist, ftol, abstol);
1204 cmp_real(fp, "inputrec->rtpi", -1, ir1->rtpi, ir2->rtpi, ftol, abstol);
1205 cmp_int(fp, "inputrec->coulombtype", -1, ir1->coulombtype, ir2->coulombtype);
1206 cmp_int(fp, "inputrec->coulomb_modifier", -1, ir1->coulomb_modifier, ir2->coulomb_modifier);
1207 cmp_real(fp, "inputrec->rcoulomb_switch", -1, ir1->rcoulomb_switch, ir2->rcoulomb_switch, ftol, abstol);
1208 cmp_real(fp, "inputrec->rcoulomb", -1, ir1->rcoulomb, ir2->rcoulomb, ftol, abstol);
1209 cmp_int(fp, "inputrec->vdwtype", -1, ir1->vdwtype, ir2->vdwtype);
1210 cmp_int(fp, "inputrec->vdw_modifier", -1, ir1->vdw_modifier, ir2->vdw_modifier); cmp_real(fp, "inputrec->rvdw_switch", -1, ir1->rvdw_switch, ir2->rvdw_switch, ftol, abstol);
1211 cmp_real(fp, "inputrec->rvdw", -1, ir1->rvdw, ir2->rvdw, ftol, abstol);
1212 cmp_real(fp, "inputrec->epsilon_r", -1, ir1->epsilon_r, ir2->epsilon_r, ftol, abstol);
1213 cmp_real(fp, "inputrec->epsilon_rf", -1, ir1->epsilon_rf, ir2->epsilon_rf, ftol, abstol);
1214 cmp_real(fp, "inputrec->tabext", -1, ir1->tabext, ir2->tabext, ftol, abstol);
1215 cmp_int(fp, "inputrec->implicit_solvent", -1, ir1->implicit_solvent, ir2->implicit_solvent);
1216 cmp_int(fp, "inputrec->gb_algorithm", -1, ir1->gb_algorithm, ir2->gb_algorithm);
1217 cmp_int(fp, "inputrec->nstgbradii", -1, ir1->nstgbradii, ir2->nstgbradii);
1218 cmp_real(fp, "inputrec->rgbradii", -1, ir1->rgbradii, ir2->rgbradii, ftol, abstol);
1219 cmp_real(fp, "inputrec->gb_saltconc", -1, ir1->gb_saltconc, ir2->gb_saltconc, ftol, abstol);
1220 cmp_real(fp, "inputrec->gb_epsilon_solvent", -1, ir1->gb_epsilon_solvent, ir2->gb_epsilon_solvent, ftol, abstol);
1221 cmp_real(fp, "inputrec->gb_obc_alpha", -1, ir1->gb_obc_alpha, ir2->gb_obc_alpha, ftol, abstol);
1222 cmp_real(fp, "inputrec->gb_obc_beta", -1, ir1->gb_obc_beta, ir2->gb_obc_beta, ftol, abstol);
1223 cmp_real(fp, "inputrec->gb_obc_gamma", -1, ir1->gb_obc_gamma, ir2->gb_obc_gamma, ftol, abstol);
1224 cmp_real(fp, "inputrec->gb_dielectric_offset", -1, ir1->gb_dielectric_offset, ir2->gb_dielectric_offset, ftol, abstol);
1225 cmp_int(fp, "inputrec->sa_algorithm", -1, ir1->sa_algorithm, ir2->sa_algorithm);
1226 cmp_real(fp, "inputrec->sa_surface_tension", -1, ir1->sa_surface_tension, ir2->sa_surface_tension, ftol, abstol);
1228 cmp_int(fp, "inputrec->eDispCorr", -1, ir1->eDispCorr, ir2->eDispCorr);
1229 cmp_real(fp, "inputrec->shake_tol", -1, ir1->shake_tol, ir2->shake_tol, ftol, abstol);
1230 cmp_int(fp, "inputrec->efep", -1, ir1->efep, ir2->efep);
1231 cmp_fepvals(fp, ir1->fepvals, ir2->fepvals, ftol, abstol);
1232 cmp_int(fp, "inputrec->bSimTemp", -1, ir1->bSimTemp, ir2->bSimTemp);
1233 if ((ir1->bSimTemp == ir2->bSimTemp) && (ir1->bSimTemp))
1235 cmp_simtempvals(fp, ir1->simtempvals, ir2->simtempvals, std::min(ir1->fepvals->n_lambda, ir2->fepvals->n_lambda), ftol, abstol);
1237 cmp_int(fp, "inputrec->bExpanded", -1, ir1->bExpanded, ir2->bExpanded);
1238 if ((ir1->bExpanded == ir2->bExpanded) && (ir1->bExpanded))
1240 cmp_expandedvals(fp, ir1->expandedvals, ir2->expandedvals, std::min(ir1->fepvals->n_lambda, ir2->fepvals->n_lambda), ftol, abstol);
1242 cmp_int(fp, "inputrec->nwall", -1, ir1->nwall, ir2->nwall);
1243 cmp_int(fp, "inputrec->wall_type", -1, ir1->wall_type, ir2->wall_type);
1244 cmp_int(fp, "inputrec->wall_atomtype[0]", -1, ir1->wall_atomtype[0], ir2->wall_atomtype[0]);
1245 cmp_int(fp, "inputrec->wall_atomtype[1]", -1, ir1->wall_atomtype[1], ir2->wall_atomtype[1]);
1246 cmp_real(fp, "inputrec->wall_density[0]", -1, ir1->wall_density[0], ir2->wall_density[0], ftol, abstol);
1247 cmp_real(fp, "inputrec->wall_density[1]", -1, ir1->wall_density[1], ir2->wall_density[1], ftol, abstol);
1248 cmp_real(fp, "inputrec->wall_ewald_zfac", -1, ir1->wall_ewald_zfac, ir2->wall_ewald_zfac, ftol, abstol);
1250 cmp_bool(fp, "inputrec->bPull", -1, ir1->bPull, ir2->bPull);
1251 if (ir1->bPull && ir2->bPull)
1253 cmp_pull(fp);
1256 cmp_int(fp, "inputrec->eDisre", -1, ir1->eDisre, ir2->eDisre);
1257 cmp_real(fp, "inputrec->dr_fc", -1, ir1->dr_fc, ir2->dr_fc, ftol, abstol);
1258 cmp_int(fp, "inputrec->eDisreWeighting", -1, ir1->eDisreWeighting, ir2->eDisreWeighting);
1259 cmp_int(fp, "inputrec->bDisreMixed", -1, ir1->bDisreMixed, ir2->bDisreMixed);
1260 cmp_int(fp, "inputrec->nstdisreout", -1, ir1->nstdisreout, ir2->nstdisreout);
1261 cmp_real(fp, "inputrec->dr_tau", -1, ir1->dr_tau, ir2->dr_tau, ftol, abstol);
1262 cmp_real(fp, "inputrec->orires_fc", -1, ir1->orires_fc, ir2->orires_fc, ftol, abstol);
1263 cmp_real(fp, "inputrec->orires_tau", -1, ir1->orires_tau, ir2->orires_tau, ftol, abstol);
1264 cmp_int(fp, "inputrec->nstorireout", -1, ir1->nstorireout, ir2->nstorireout);
1265 cmp_real(fp, "inputrec->em_stepsize", -1, ir1->em_stepsize, ir2->em_stepsize, ftol, abstol);
1266 cmp_real(fp, "inputrec->em_tol", -1, ir1->em_tol, ir2->em_tol, ftol, abstol);
1267 cmp_int(fp, "inputrec->niter", -1, ir1->niter, ir2->niter);
1268 cmp_real(fp, "inputrec->fc_stepsize", -1, ir1->fc_stepsize, ir2->fc_stepsize, ftol, abstol);
1269 cmp_int(fp, "inputrec->nstcgsteep", -1, ir1->nstcgsteep, ir2->nstcgsteep);
1270 cmp_int(fp, "inputrec->nbfgscorr", 0, ir1->nbfgscorr, ir2->nbfgscorr);
1271 cmp_int(fp, "inputrec->eConstrAlg", -1, ir1->eConstrAlg, ir2->eConstrAlg);
1272 cmp_int(fp, "inputrec->nProjOrder", -1, ir1->nProjOrder, ir2->nProjOrder);
1273 cmp_real(fp, "inputrec->LincsWarnAngle", -1, ir1->LincsWarnAngle, ir2->LincsWarnAngle, ftol, abstol);
1274 cmp_int(fp, "inputrec->nLincsIter", -1, ir1->nLincsIter, ir2->nLincsIter);
1275 cmp_real(fp, "inputrec->bd_fric", -1, ir1->bd_fric, ir2->bd_fric, ftol, abstol);
1276 cmp_int64(fp, "inputrec->ld_seed", ir1->ld_seed, ir2->ld_seed);
1277 cmp_real(fp, "inputrec->cos_accel", -1, ir1->cos_accel, ir2->cos_accel, ftol, abstol);
1278 cmp_rvec(fp, "inputrec->deform(a)", -1, ir1->deform[XX], ir2->deform[XX], ftol, abstol);
1279 cmp_rvec(fp, "inputrec->deform(b)", -1, ir1->deform[YY], ir2->deform[YY], ftol, abstol);
1280 cmp_rvec(fp, "inputrec->deform(c)", -1, ir1->deform[ZZ], ir2->deform[ZZ], ftol, abstol);
1283 cmp_int(fp, "inputrec->userint1", -1, ir1->userint1, ir2->userint1);
1284 cmp_int(fp, "inputrec->userint2", -1, ir1->userint2, ir2->userint2);
1285 cmp_int(fp, "inputrec->userint3", -1, ir1->userint3, ir2->userint3);
1286 cmp_int(fp, "inputrec->userint4", -1, ir1->userint4, ir2->userint4);
1287 cmp_real(fp, "inputrec->userreal1", -1, ir1->userreal1, ir2->userreal1, ftol, abstol);
1288 cmp_real(fp, "inputrec->userreal2", -1, ir1->userreal2, ir2->userreal2, ftol, abstol);
1289 cmp_real(fp, "inputrec->userreal3", -1, ir1->userreal3, ir2->userreal3, ftol, abstol);
1290 cmp_real(fp, "inputrec->userreal4", -1, ir1->userreal4, ir2->userreal4, ftol, abstol);
1291 cmp_grpopts(fp, &(ir1->opts), &(ir2->opts), ftol, abstol);
1292 gmx::TextWriter writer(fp);
1293 gmx::compareKeyValueTrees(&writer, *ir1->params, *ir2->params, ftol, abstol);
1296 void comp_pull_AB(FILE *fp, pull_params_t *pull, real ftol, real abstol)
1298 int i;
1300 for (i = 0; i < pull->ncoord; i++)
1302 fprintf(fp, "comparing pull coord %d\n", i);
1303 cmp_real(fp, "pull-coord->k", -1, pull->coord[i].k, pull->coord[i].kB, ftol, abstol);
1307 gmx_bool inputrecDeform(const t_inputrec *ir)
1309 return (ir->deform[XX][XX] != 0 || ir->deform[YY][YY] != 0 || ir->deform[ZZ][ZZ] != 0 ||
1310 ir->deform[YY][XX] != 0 || ir->deform[ZZ][XX] != 0 || ir->deform[ZZ][YY] != 0);
1313 gmx_bool inputrecDynamicBox(const t_inputrec *ir)
1315 return (ir->epc != epcNO || ir->eI == eiTPI || inputrecDeform(ir));
1318 gmx_bool inputrecPreserveShape(const t_inputrec *ir)
1320 return (ir->epc != epcNO && ir->deform[XX][XX] == 0 &&
1321 (ir->epct == epctISOTROPIC || ir->epct == epctSEMIISOTROPIC));
1324 gmx_bool inputrecNeedMutot(const t_inputrec *ir)
1326 return ((ir->coulombtype == eelEWALD || EEL_PME(ir->coulombtype)) &&
1327 (ir->ewald_geometry == eewg3DC || ir->epsilon_surface != 0));
1330 gmx_bool inputrecExclForces(const t_inputrec *ir)
1332 return (EEL_FULL(ir->coulombtype) || (EEL_RF(ir->coulombtype)) ||
1333 ir->implicit_solvent != eisNO);
1336 gmx_bool inputrecNptTrotter(const t_inputrec *ir)
1338 return ( ( (ir->eI == eiVV) || (ir->eI == eiVVAK) ) &&
1339 (ir->epc == epcMTTK) && (ir->etc == etcNOSEHOOVER) );
1342 gmx_bool inputrecNvtTrotter(const t_inputrec *ir)
1344 return ( ( (ir->eI == eiVV) || (ir->eI == eiVVAK) ) &&
1345 (ir->epc != epcMTTK) && (ir->etc == etcNOSEHOOVER) );
1348 gmx_bool inputrecNphTrotter(const t_inputrec *ir)
1350 return ( ( (ir->eI == eiVV) || (ir->eI == eiVVAK) ) &&
1351 (ir->epc == epcMTTK) && (ir->etc != etcNOSEHOOVER) );