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,2016,2017,2018,2019, 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 #ifndef GMX_MDTYPES_INPUTREC_H
38 #define GMX_MDTYPES_INPUTREC_H
44 #include "gromacs/math/vectypes.h"
45 #include "gromacs/mdtypes/md_enums.h"
46 #include "gromacs/utility/basedefinitions.h"
47 #include "gromacs/utility/real.h"
49 #define EGP_EXCL (1 << 0)
50 #define EGP_TABLE (1 << 1)
60 class KeyValueTreeObject;
65 //! Number of T-Coupl groups
67 //! Number of of Nose-Hoover chains per group
69 //! Number of Accelerate groups
71 //! Number of Freeze groups
73 //! Number of Energy groups
75 //! Number of degrees of freedom in a group
77 //! Coupling temperature per group
79 //! No/simple/periodic simulated annealing for each group
81 //! Number of annealing time points per group
83 //! For each group: Time points
85 //! For each group: Temperature at these times. Final temp after all intervals is ref_t
89 //! Acceleration per group
91 //! Whether the group will be frozen in each direction
93 //! Exclusions/tables of energy group pairs
97 //! Number of QM groups
99 //! Level of theory in the QM calculation
101 //! Basisset in the QM calculation
103 //! Total charge in the QM region
105 //! Spin multiplicicty in the QM region
107 //! Surface hopping (diabatic hop only)
109 //! Number of orbiatls in the active space
111 //! Number of electrons in the active space
113 //! At which gap (A.U.) the SA is switched on
115 //! At which gap (A.U.) the SA is switched off
117 //! In how many steps SA goes from 1-1 to 0.5-0.5
123 //! Simulated temperature scaling; linear or exponential
125 //! The low temperature for simulated tempering
127 //! The high temperature for simulated tempering
129 //! The range of temperatures used for simulated tempering
135 //! The frequency for calculating dhdl
137 //! Fractional value of lambda (usually will use init_fep_state, this will only be for slow growth, and for legacy free energy code. Only has a valid value if positive)
139 //! The initial number of the state
141 //! Change of lambda per time step (fraction of (0.1)
143 //! Print no, total or potential energies in dhdl
144 int edHdLPrintEnergy;
145 //! The number of foreign lambda points
147 //! The array of all lambda values
149 //! The number of neighboring lambda states to calculate the energy for in up and down directions (-1 for all)
150 int lambda_neighbors;
151 //! The first lambda to calculate energies for
153 //! The last lambda +1 to calculate energies for
155 //! Free energy soft-core parameter
157 //! Lambda power for soft-core interactions
159 //! R power for soft-core interactions
161 //! Free energy soft-core sigma when c6 or c12=0
163 //! Free energy soft-core sigma for ?????
165 //! Use softcore for the coulomb portion as well (default FALSE)
167 //! Whether to print the dvdl term associated with this term; if it is not specified as separate, it is lumped with the FEP term
168 gmx_bool separate_dvdl[efptNR];
169 //! Whether to write a separate dhdl.xvg file note: NOT a gmx_bool, but an enum
170 int separate_dhdl_file;
171 //! Whether to calculate+write dhdl derivatives note: NOT a gmx_bool, but an enum
172 int dhdl_derivatives;
173 //! The maximum table size for the dH histogram
175 //! The spacing for the dH histogram
176 double dh_hist_spacing;
181 //! The frequency of expanded ensemble state changes
183 //! Which type of move updating do we use for lambda monte carlo (or no for none)
185 //! What move set will be we using for state space moves
187 //! The method we use to decide of we have equilibrated the weights
189 //! The minumum number of samples at each lambda for deciding whether we have reached a minimum
191 //! Wang-Landau delta at which we stop equilibrating weights
193 //! Use the ratio of weights (ratio of minimum to maximum) to decide when to stop equilibrating
195 //! After equil_steps steps we stop equilibrating the weights
197 //! After equil_samples total samples (steps/nstfep), we stop equilibrating the weights
199 //! Random number seed for lambda mc switches
201 //! Whether to use minumum variance weighting
203 //! The number of samples needed before kicking into minvar routine
205 //! The offset for the variance in MinVar
207 //! Range of cvalues used for BAR
209 //! Whether to print symmetrized matrices
210 gmx_bool bSymmetrizedTMatrix;
211 //! How frequently to print the transition matrices
213 //! Number of repetitions in the MC lambda jumps MRS -- VERIFY THIS
215 //! Minimum number of samples for each state before free sampling MRS -- VERIFY THIS!
216 int lmc_forced_nstart;
217 //! Distance in lambda space for the gibbs interval
219 //! Scaling factor for Wang-Landau
221 //! Ratio between largest and smallest number for freezing the weights
223 //! Starting delta for Wang-Landau
225 //! Use one over t convergence for Wang-Landau when the delta get sufficiently small
226 gmx_bool bWLoneovert;
227 //! Did we initialize the weights? TODO: REMOVE FOR 5.0, no longer needed with new logic
228 gmx_bool bInit_weights;
229 //! To override the main temperature, or define it if it's not defined
231 //! User-specified initial weights to start with
232 real* init_lambda_weights;
237 //! Rotation type for this group
239 //! Use mass-weighed positions?
241 //! Number of atoms in the group
243 //! The global atoms numbers
245 //! The reference positions
247 //! The normalized rotation vector
249 //! Rate of rotation (degree/ps)
251 //! Force constant (kJ/(mol nm^2)
253 //! Pivot point of rotation axis (nm)
255 //! Type of fit to determine actual group angle
257 //! Number of angles around the reference angle for which the rotation potential is also evaluated (for fit type 'potential' only)
259 //! Distance between two angles in degrees (for fit type 'potential' only)
261 //! Slab distance (nm)
263 //! Minimum value the gaussian must have so that the force is actually evaluated
265 //! Additive constant for radial motion2 and flexible2 potentials (nm^2)
271 //! Number of rotation groups
273 //! Output frequency for main rotation outfile
275 //! Output frequency for per-slab data
283 //! Number of interactive atoms
285 //! The global indices of the interactive atoms
291 //! Name of the swap group, e.g. NA, CL, SOL
293 //! Number of atoms in this group
295 //! The global ion group atoms numbers
297 //! Requested number of molecules of this type per compartment
298 int nmolReq[eCompNR];
303 //! Period between when a swap is attempted
305 //! Use mass-weighted positions in split group
306 gmx_bool massw_split[2];
307 /*! \brief Split cylinders defined by radius, upper and lower
308 * extension. The split cylinders define the channels and are
309 * each anchored in the center of the split group */
315 //! Coupling constant (number of swap attempt steps)
317 //! Ion counts may deviate from the requested values by +-threshold before a swap is done
319 //! Offset of the swap layer (='bulk') with respect to the compartment-defining layers
320 real bulkOffset[eCompNR];
321 //! Number of groups to be controlled
323 //! All swap groups, including split and solvent
327 struct t_inputrec // NOLINT (clang-analyzer-optin.performance.Padding)
330 explicit t_inputrec(const t_inputrec&) = delete;
331 t_inputrec& operator=(const t_inputrec&) = delete;
334 //! Integration method
336 //! Number of steps to be taken
338 //! Used in checkpointing to separate chunks
340 //! Start at a stepcount >0 (used w. convert-tpr)
342 //! Frequency of energy calc. and T/P coupl. upd.
344 //! Group or verlet cutoffs
346 //! Number of steps before pairlist is generated
348 //! Number of steps after which center of mass motion is removed
350 //! Center of mass motion removal algorithm
352 //! Number of steps after which print to logfile
354 //! Number of steps after which X is output
356 //! Number of steps after which V is output
358 //! Number of steps after which F is output
360 //! Number of steps after which energies printed
362 //! Number of steps after which compressed trj (.xtc,.tng) is output
363 int nstxout_compressed;
364 //! Initial time (ps)
368 //! Precision of x in compressed trajectory file
369 real x_compression_precision;
370 //! Requested fourier_spacing, when nk? not set
371 real fourier_spacing;
372 //! Number of k vectors in x dimension for fourier methods for long range electrost.
374 //! Number of k vectors in y dimension for fourier methods for long range electrost.
376 //! Number of k vectors in z dimension for fourier methods for long range electrost.
378 //! Interpolation order for PME
380 //! Real space tolerance for Ewald, determines the real/reciprocal space relative weight
382 //! Real space tolerance for LJ-Ewald
384 //! Normal/3D ewald, or pseudo-2D LR corrections
386 //! Epsilon for PME dipole correction
387 real epsilon_surface;
388 //! Type of combination rule in LJ-PME
389 int ljpme_combination_rule;
390 //! Type of periodic boundary conditions
392 //! Periodic molecules
394 //! Continuation run: starting state is correct (ie. constrained)
395 gmx_bool bContinuation;
396 //! Temperature coupling
398 //! Interval in steps for temperature coupling
400 //! Whether to print nose-hoover chains
401 gmx_bool bPrintNHChains;
402 //! Pressure coupling
404 //! Pressure coupling type
406 //! Interval in steps for pressure coupling
408 //! Pressure coupling time (ps)
410 //! Reference pressure (kJ/(mol nm^3))
412 //! Compressibility ((mol nm^3)/kJ)
414 //! How to scale absolute reference coordinates
415 int refcoord_scaling;
416 //! The COM of the posres atoms
418 //! The B-state COM of the posres atoms
420 //! Random seed for Andersen thermostat (obsolete)
422 //! Per atom pair energy drift tolerance (kJ/mol/ps/atom) for list buffer
424 //! Short range pairlist cut-off (nm)
426 //! Radius for test particle insertion
428 //! Type of electrostatics treatment
430 //! Modify the Coulomb interaction
431 int coulomb_modifier;
432 //! Coulomb switch range start (nm)
433 real rcoulomb_switch;
434 //! Coulomb cutoff (nm)
436 //! Relative dielectric constant
438 //! Relative dielectric constant of the RF
440 //! Always false (no longer supported)
441 bool implicit_solvent;
442 //! Type of Van der Waals treatment
444 //! Modify the Van der Waals interaction
446 //! Van der Waals switch range start (nm)
448 //! Van der Waals cutoff (nm)
450 //! Perform Long range dispersion corrections
452 //! Extension of the table beyond the cut-off, as well as the table length for 1-4 interac.
454 //! Tolerance for shake
456 //! Free energy calculations
458 //! Data for the FEP state
460 //! Whether to do simulated tempering
462 //! Variables for simulated tempering
463 t_simtemp* simtempvals;
464 //! Whether expanded ensembles are used
466 //! Expanded ensemble parameters
467 t_expanded* expandedvals;
468 //! Type of distance restraining
470 //! Force constant for time averaged distance restraints
472 //! Type of weighting of pairs in one restraints
474 //! Use combination of time averaged and instantaneous violations
475 gmx_bool bDisreMixed;
476 //! Frequency of writing pair distances to enx
478 //! Time constant for memory function in disres
480 //! Force constant for orientational restraints
482 //! Time constant for memory function in orires
484 //! Frequency of writing tr(SD) to energy output
486 //! The stepsize for updating
490 //! Number of iterations for convergence of steepest descent in relax_shells
492 //! Stepsize for directional minimization in relax_shells
494 //! Number of steps after which a steepest descents step is done while doing cg
496 //! Number of corrections to the Hessian to keep
498 //! Type of constraint algorithm
500 //! Order of the LINCS Projection Algorithm
502 //! Warn if any bond rotates more than this many degrees
504 //! Number of iterations in the final LINCS step
506 //! Use successive overrelaxation for shake
508 //! Friction coefficient for BD (amu/ps)
510 //! Random seed for SD and BD
512 //! The number of walls
514 //! The type of walls
516 //! The potentail is linear for r<=wall_r_linpot
518 //! The atom type for walls
519 int wall_atomtype[2];
520 //! Number density for walls
521 real wall_density[2];
522 //! Scaling factor for the box for Ewald
523 real wall_ewald_zfac;
525 /* COM pulling data */
526 //! Do we do COM pulling?
528 //! The data for center of mass pulling
532 //! Whether to use AWH biasing for PMF calculations
534 //! AWH biasing parameters
535 gmx::AwhParams* awhParams;
537 /* Enforced rotation data */
538 //! Whether to calculate enforced rotation potential(s)
540 //! The data for enforced rotation potentials
543 //! Whether to do ion/water position exchanges (CompEL)
545 //! Swap data structure.
548 //! Whether the tpr makes an interactive MD session possible.
550 //! Interactive molecular dynamics
553 //! Acceleration for viscosity calculation
555 //! Triclinic deformation velocities (nm/ps)
557 /*! \brief User determined parameters */
570 //! QM/MM calculation
572 //! Constraints on QM bonds
574 //! Scheme: ONIOM or normal
576 //! Factor for scaling the MM charges in QM calc.
579 /* Fields for removed features go here (better caching) */
580 //! Whether AdResS is enabled - always false if a valid .tpr was read
582 //! Whether twin-range scheme is active - always false if a valid .tpr was read
583 gmx_bool useTwinRange;
585 //! KVT object that contains input parameters converted to the new style.
586 gmx::KeyValueTreeObject* params;
588 //! KVT for storing simulation parameters that are not part of the mdp file.
589 std::unique_ptr<gmx::KeyValueTreeObject> internalParameters;
592 int ir_optimal_nstcalcenergy(const t_inputrec* ir);
594 int tcouple_min_integration_steps(int etc);
596 int ir_optimal_nsttcouple(const t_inputrec* ir);
598 int pcouple_min_integration_steps(int epc);
600 int ir_optimal_nstpcouple(const t_inputrec* ir);
602 /* Returns if the Coulomb force or potential is switched to zero */
603 gmx_bool ir_coulomb_switched(const t_inputrec* ir);
605 /* Returns if the Coulomb interactions are zero beyond the rcoulomb.
606 * Note: always returns TRUE for the Verlet cut-off scheme.
608 gmx_bool ir_coulomb_is_zero_at_cutoff(const t_inputrec* ir);
610 /* As ir_coulomb_is_zero_at_cutoff, but also returns TRUE for user tabulated
611 * interactions, since these might be zero beyond rcoulomb.
613 gmx_bool ir_coulomb_might_be_zero_at_cutoff(const t_inputrec* ir);
615 /* Returns if the Van der Waals force or potential is switched to zero */
616 gmx_bool ir_vdw_switched(const t_inputrec* ir);
618 /* Returns if the Van der Waals interactions are zero beyond the rvdw.
619 * Note: always returns TRUE for the Verlet cut-off scheme.
621 gmx_bool ir_vdw_is_zero_at_cutoff(const t_inputrec* ir);
623 /* As ir_vdw_is_zero_at_cutoff, but also returns TRUE for user tabulated
624 * interactions, since these might be zero beyond rvdw.
626 gmx_bool ir_vdw_might_be_zero_at_cutoff(const t_inputrec* ir);
628 /*! \brief Free memory from input record.
630 * All arrays and pointers will be freed.
632 * \param[in] ir The data structure
634 void done_inputrec(t_inputrec* ir);
636 void pr_inputrec(FILE* fp, int indent, const char* title, const t_inputrec* ir, gmx_bool bMDPformat);
638 void cmp_inputrec(FILE* fp, const t_inputrec* ir1, const t_inputrec* ir2, real ftol, real abstol);
640 void comp_pull_AB(FILE* fp, pull_params_t* pull, real ftol, real abstol);
643 gmx_bool inputrecDeform(const t_inputrec* ir);
645 gmx_bool inputrecDynamicBox(const t_inputrec* ir);
647 gmx_bool inputrecPreserveShape(const t_inputrec* ir);
649 gmx_bool inputrecNeedMutot(const t_inputrec* ir);
651 gmx_bool inputrecTwinRange(const t_inputrec* ir);
653 gmx_bool inputrecExclForces(const t_inputrec* ir);
655 gmx_bool inputrecNptTrotter(const t_inputrec* ir);
657 gmx_bool inputrecNvtTrotter(const t_inputrec* ir);
659 gmx_bool inputrecNphTrotter(const t_inputrec* ir);
661 /*! \brief Return true if the simulation is 2D periodic with two walls. */
662 bool inputrecPbcXY2Walls(const t_inputrec* ir);
664 /*! \brief Returns true for MD integator with T and/or P-coupling that supports
665 * calculating the conserved energy quantity.
667 bool integratorHasConservedEnergyQuantity(const t_inputrec* ir);
669 /*! \brief Returns true when temperature is coupled or constant. */
670 bool integratorHasReferenceTemperature(const t_inputrec* ir);
672 /*! \brief Return the number of bounded dimensions
674 * \param[in] ir The input record with MD parameters
675 * \return the number of dimensions in which
676 * the coordinates of the particles are bounded, starting at X.
678 int inputrec2nboundeddim(const t_inputrec* ir);
680 /*! \brief Returns the number of degrees of freedom in center of mass motion
682 * \param[in] ir The inputrec structure
683 * \return the number of degrees of freedom of the center of mass
685 int ndof_com(const t_inputrec* ir);
687 /*! \brief Returns the maximum reference temperature over all coupled groups
689 * Returns 0 for energy minimization and normal mode computation.
690 * Returns -1 for MD without temperature coupling.
692 * \param[in] ir The inputrec structure
694 real maxReferenceTemperature(const t_inputrec& ir);
696 /*! \brief Returns whether there is an Ewald surface contribution
698 bool haveEwaldSurfaceContribution(const t_inputrec& ir);
700 #endif /* GMX_MDTYPES_INPUTREC_H */