a7e8e9c4e4833756e369109b0144bfbe5ed47123
[alexxy/gromacs.git] / src / gromacs / mdtypes / inputrec.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
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 by the GROMACS development team.
7  * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
8  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
9  * and including many others, as listed in the AUTHORS file in the
10  * top-level source directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38 #ifndef GMX_MDTYPES_INPUTREC_H
39 #define GMX_MDTYPES_INPUTREC_H
40
41 #include <cstdio>
42
43 #include <memory>
44 #include <vector>
45
46 #include "gromacs/math/vectypes.h"
47 #include "gromacs/mdtypes/md_enums.h"
48 #include "gromacs/utility/enumerationhelpers.h"
49 #include "gromacs/utility/real.h"
50
51 #define EGP_EXCL (1 << 0)
52 #define EGP_TABLE (1 << 1)
53
54 struct gmx_enfrot;
55 struct gmx_enfrotgrp;
56 struct pull_params_t;
57
58 namespace gmx
59 {
60 class Awh;
61 class AwhParams;
62 class KeyValueTreeObject;
63 struct MtsLevel;
64 } // namespace gmx
65
66 struct t_grpopts
67 {
68     //! Number of T-Coupl groups
69     int ngtc = 0;
70     //! Number of of Nose-Hoover chains per group
71     int nhchainlength = 0;
72     //! Number of Freeze groups
73     int ngfrz = 0;
74     //! Number of Energy groups
75     int ngener = 0;
76     //! Number of degrees of freedom in a group
77     real* nrdf = nullptr;
78     //! Coupling temperature    per group
79     real* ref_t = nullptr;
80     //! No/simple/periodic simulated annealing for each group
81     SimulatedAnnealing* annealing = nullptr;
82     //! Number of annealing time points per group
83     int* anneal_npoints = nullptr;
84     //! For each group: Time points
85     real** anneal_time = nullptr;
86     //! For each group: Temperature at these times. Final temp after all intervals is ref_t
87     real** anneal_temp = nullptr;
88     //! Tau coupling time
89     real* tau_t = nullptr;
90     //! Whether the group will be frozen in each direction
91     ivec* nFreeze = nullptr;
92     //! Exclusions/tables of energy group pairs
93     int* egp_flags = nullptr;
94
95     /* QMMM stuff */
96     //! Number of QM groups
97     int ngQM = 0;
98 };
99
100 struct t_simtemp
101 {
102     //! Simulated temperature scaling; linear or exponential
103     SimulatedTempering eSimTempScale = SimulatedTempering::Default;
104     //! The low temperature for simulated tempering
105     real simtemp_low = 0;
106     //! The high temperature for simulated tempering
107     real simtemp_high = 0;
108     //! The range of temperatures used for simulated tempering
109     std::vector<real> temperatures;
110 };
111
112 struct t_lambda
113 {
114     //! The frequency for calculating dhdl
115     int nstdhdl = 0;
116     //! 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)
117     double init_lambda = 0;
118     //! The initial number of the state
119     int init_fep_state = 0;
120     //! Change of lambda per time step (fraction of (0.1)
121     double delta_lambda = 0;
122     //! Print no, total or potential energies in dhdl
123     FreeEnergyPrintEnergy edHdLPrintEnergy = FreeEnergyPrintEnergy::Default;
124     //! The number of foreign lambda points
125     int n_lambda = 0;
126     //! The array of all lambda values
127     gmx::EnumerationArray<FreeEnergyPerturbationCouplingType, std::vector<double>> all_lambda;
128     //! The number of neighboring lambda states to calculate the energy for in up and down directions (-1 for all)
129     int lambda_neighbors = 0;
130     //! The first lambda to calculate energies for
131     int lambda_start_n = 0;
132     //! The last lambda +1 to calculate energies for
133     int lambda_stop_n = 0;
134     //! Free energy soft-core parameter
135     real sc_alpha = 0;
136     //! Lambda power for soft-core interactions
137     int sc_power = 0;
138     //! R power for soft-core interactions
139     real sc_r_power = 0;
140     //! Free energy soft-core sigma when c6 or c12=0
141     real sc_sigma = 0;
142     //! Free energy soft-core sigma for ?????
143     real sc_sigma_min = 0;
144     //! Use softcore for the coulomb portion as well (default FALSE)
145     bool bScCoul = false;
146     //! The specific soft-core function to use
147     SoftcoreType softcoreFunction = SoftcoreType::Beutler;
148     //! scale for the linearization point for the vdw interaction with gapsys soft-core
149     real scGapsysScaleLinpointLJ = 0.85;
150     //! scale for the linearization point for the coulomb interaction with gapsys soft-core
151     real scGapsysScaleLinpointQ = 0.3;
152     //! lower bound for c12/c6 in gapsys soft-core
153     real scGapsysSigmaLJ = 0.3;
154     //! Whether to print the dvdl term associated with this term; if it is not specified as separate, it is lumped with the FEP term
155     gmx::EnumerationArray<FreeEnergyPerturbationCouplingType, bool> separate_dvdl;
156     //! Whether to write a separate dhdl.xvg file note: NOT a gmx_bool, but an enum
157     SeparateDhdlFile separate_dhdl_file = SeparateDhdlFile::Default;
158     //! Whether to calculate+write dhdl derivatives note: NOT a gmx_bool, but an enum
159     DhDlDerivativeCalculation dhdl_derivatives = DhDlDerivativeCalculation::Default;
160     //! The maximum table size for the dH histogram
161     int dh_hist_size = 0;
162     //! The spacing for the dH histogram
163     double dh_hist_spacing = 0;
164 };
165
166 struct t_expanded
167 {
168     //! The frequency of expanded ensemble state changes
169     int nstexpanded = 0;
170     //! Which type of move updating do we use for lambda monte carlo (or no for none)
171     LambdaWeightCalculation elamstats = LambdaWeightCalculation::Default;
172     //! What move set will be we using for state space moves
173     LambdaMoveCalculation elmcmove = LambdaMoveCalculation::Default;
174     //! The method we use to decide of we have equilibrated the weights
175     LambdaWeightWillReachEquilibrium elmceq = LambdaWeightWillReachEquilibrium::Default;
176     //! The minumum number of samples at each lambda for deciding whether we have reached a minimum
177     int equil_n_at_lam = 0;
178     //! Wang-Landau delta at which we stop equilibrating weights
179     real equil_wl_delta = 0;
180     //! Use the ratio of weights (ratio of minimum to maximum) to decide when to stop equilibrating
181     real equil_ratio = 0;
182     //! After equil_steps steps we stop equilibrating the weights
183     int equil_steps = 0;
184     //! After equil_samples total samples (steps/nstfep), we stop equilibrating the weights
185     int equil_samples = 0;
186     //! Random number seed for lambda mc switches
187     int lmc_seed = 0;
188     //! Whether to use minumum variance weighting
189     bool minvar = false;
190     //! The number of samples needed before kicking into minvar routine
191     int minvarmin = 0;
192     //! The offset for the variance in MinVar
193     real minvar_const = 0;
194     //! Range of cvalues used for BAR
195     int c_range = 0;
196     //! Whether to print symmetrized matrices
197     bool bSymmetrizedTMatrix = false;
198     //! How frequently to print the transition matrices
199     int nstTij = 0;
200     //! Number of repetitions in the MC lambda jumps MRS -- VERIFY THIS
201     int lmc_repeats = 0;
202     //! Minimum number of samples for each state before free sampling MRS -- VERIFY THIS!
203     int lmc_forced_nstart = 0;
204     //! Distance in lambda space for the gibbs interval
205     int gibbsdeltalam = 0;
206     //! Scaling factor for Wang-Landau
207     real wl_scale = 0;
208     //! Ratio between largest and smallest number for freezing the weights
209     real wl_ratio = 0;
210     //! Starting delta for Wang-Landau
211     real init_wl_delta = 0;
212     //! Use one over t convergence for Wang-Landau when the delta get sufficiently small
213     bool bWLoneovert = false;
214     //! Did we initialize the weights? TODO: REMOVE FOR 5.0, no longer needed with new logic
215     bool bInit_weights = false;
216     //! To override the main temperature, or define it if it's not defined
217     real mc_temp = 0;
218     //! User-specified initial weights to start with
219     std::vector<real> init_lambda_weights;
220 };
221
222 struct t_rotgrp
223 {
224     //! Rotation type for this group
225     EnforcedRotationGroupType eType;
226     //! Use mass-weighed positions?
227     bool bMassW;
228     //! Number of atoms in the group
229     int nat;
230     //! The global atoms numbers
231     int* ind;
232     //! The reference positions
233     rvec* x_ref;
234     //! The normalized rotation vector
235     rvec inputVec;
236     //! Rate of rotation (degree/ps)
237     real rate;
238     //! Force constant (kJ/(mol nm^2)
239     real k;
240     //! Pivot point of rotation axis (nm)
241     rvec pivot;
242     //! Type of fit to determine actual group angle
243     RotationGroupFitting eFittype;
244     //! Number of angles around the reference angle for which the rotation potential is also evaluated (for fit type 'potential' only)
245     int PotAngle_nstep;
246     //! Distance between two angles in degrees (for fit type 'potential' only)
247     real PotAngle_step;
248     //! Slab distance (nm)
249     real slab_dist;
250     //! Minimum value the gaussian must have so that the force is actually evaluated
251     real min_gaussian;
252     //! Additive constant for radial motion2 and flexible2 potentials (nm^2)
253     real eps;
254 };
255
256 struct t_rot
257 {
258     //! Number of rotation groups
259     int ngrp;
260     //! Output frequency for main rotation outfile
261     int nstrout;
262     //! Output frequency for per-slab data
263     int nstsout;
264     //! Groups to rotate
265     t_rotgrp* grp;
266 };
267
268 struct t_IMD
269 {
270     //! Number of interactive atoms
271     int nat;
272     //! The global indices of the interactive atoms
273     int* ind;
274 };
275
276 struct t_swapGroup
277 {
278     //! Name of the swap group, e.g. NA, CL, SOL
279     char* molname;
280     //! Number of atoms in this group
281     int nat;
282     //! The global ion group atoms numbers
283     int* ind;
284     //! Requested number of molecules of this type per compartment
285     gmx::EnumerationArray<Compartment, int> nmolReq;
286 };
287
288 struct t_swapcoords
289 {
290     //! Period between when a swap is attempted
291     int nstswap;
292     //! Use mass-weighted positions in split group
293     bool massw_split[2];
294     /*! \brief Split cylinders defined by radius, upper and lower
295      * extension. The split cylinders define the channels and are
296      * each anchored in the center of the split group */
297     /**@{*/
298     real cyl0r, cyl1r;
299     real cyl0u, cyl1u;
300     real cyl0l, cyl1l;
301     /**@}*/
302     //! Coupling constant (number of swap attempt steps)
303     int nAverage;
304     //! Ion counts may deviate from the requested values by +-threshold before a swap is done
305     real threshold;
306     //! Offset of the swap layer (='bulk') with respect to the compartment-defining layers
307     gmx::EnumerationArray<Compartment, real> bulkOffset;
308     //! Number of groups to be controlled
309     int ngrp;
310     //! All swap groups, including split and solvent
311     t_swapGroup* grp;
312 };
313
314 struct t_inputrec // NOLINT (clang-analyzer-optin.performance.Padding)
315 {
316     t_inputrec();
317     explicit t_inputrec(const t_inputrec&) = delete;
318     t_inputrec& operator=(const t_inputrec&) = delete;
319     ~t_inputrec();
320
321     //! Integration method
322     IntegrationAlgorithm eI = IntegrationAlgorithm::Default;
323     //! Number of steps to be taken
324     int64_t nsteps = 0;
325     //! Used in checkpointing to separate chunks
326     int simulation_part = 0;
327     //! Start at a stepcount >0 (used w. convert-tpr)
328     int64_t init_step = 0;
329     //! Frequency of energy calc. and T/P coupl. upd.
330     int nstcalcenergy = 0;
331     //! Group or verlet cutoffs
332     CutoffScheme cutoff_scheme = CutoffScheme::Default;
333     //! Number of steps before pairlist is generated
334     int nstlist = 0;
335     //! Number of steps after which center of mass motion is removed
336     int nstcomm = 0;
337     //! Center of mass motion removal algorithm
338     ComRemovalAlgorithm comm_mode = ComRemovalAlgorithm::Default;
339     //! Number of steps after which print to logfile
340     int nstlog = 0;
341     //! Number of steps after which X is output
342     int nstxout = 0;
343     //! Number of steps after which V is output
344     int nstvout = 0;
345     //! Number of steps after which F is output
346     int nstfout = 0;
347     //! Number of steps after which energies printed
348     int nstenergy = 0;
349     //! Number of steps after which compressed trj (.xtc,.tng) is output
350     int nstxout_compressed = 0;
351     //! Initial time (ps)
352     double init_t = 0;
353     //! Time step (ps)
354     double delta_t = 0;
355     //! Whether we use multiple time stepping
356     bool useMts = false;
357     //! The multiple time stepping levels
358     std::vector<gmx::MtsLevel> mtsLevels;
359     //! Precision of x in compressed trajectory file
360     real x_compression_precision = 0;
361     //! Requested fourier_spacing, when nk? not set
362     real fourier_spacing = 0;
363     //! Number of k vectors in x dimension for fourier methods for long range electrost.
364     int nkx = 0;
365     //! Number of k vectors in y dimension for fourier methods for long range electrost.
366     int nky = 0;
367     //! Number of k vectors in z dimension for fourier methods for long range electrost.
368     int nkz = 0;
369     //! Interpolation order for PME
370     int pme_order = 0;
371     //! Real space tolerance for Ewald, determines the real/reciprocal space relative weight
372     real ewald_rtol = 0;
373     //! Real space tolerance for LJ-Ewald
374     real ewald_rtol_lj = 0;
375     //! Normal/3D ewald, or pseudo-2D LR corrections
376     EwaldGeometry ewald_geometry = EwaldGeometry::Default;
377     //! Epsilon for PME dipole correction
378     real epsilon_surface = 0;
379     //! Type of combination rule in LJ-PME
380     LongRangeVdW ljpme_combination_rule = LongRangeVdW::Default;
381     //! Type of periodic boundary conditions
382     PbcType pbcType = PbcType::Default;
383     //! Periodic molecules
384     bool bPeriodicMols = false;
385     //! Continuation run: starting state is correct (ie. constrained)
386     bool bContinuation = false;
387     //! Temperature coupling
388     TemperatureCoupling etc = TemperatureCoupling::Default;
389     //! Interval in steps for temperature coupling
390     int nsttcouple = 0;
391     //! Whether to print nose-hoover chains
392     bool bPrintNHChains = false;
393     //! Pressure coupling
394     PressureCoupling epc = PressureCoupling::Default;
395     //! Pressure coupling type
396     PressureCouplingType epct = PressureCouplingType::Default;
397     //! Interval in steps for pressure coupling
398     int nstpcouple = 0;
399     //! Pressure coupling time (ps)
400     real tau_p = 0;
401     //! Reference pressure (kJ/(mol nm^3))
402     tensor ref_p = { { 0 } };
403     //! Compressibility ((mol nm^3)/kJ)
404     tensor compress = { { 0 } };
405     //! How to scale absolute reference coordinates
406     RefCoordScaling refcoord_scaling = RefCoordScaling::Default;
407     //! The COM of the posres atoms
408     rvec posres_com = { 0, 0, 0 };
409     //! The B-state COM of the posres atoms
410     rvec posres_comB = { 0, 0, 0 };
411     //! Random seed for Andersen thermostat (obsolete)
412     int andersen_seed = 0;
413     //! Per atom pair energy drift tolerance (kJ/mol/ps/atom) for list buffer
414     real verletbuf_tol = 0;
415     //! Short range pairlist cut-off (nm)
416     real rlist = 0;
417     //! Radius for test particle insertion
418     real rtpi = 0;
419     //! Type of electrostatics treatment
420     CoulombInteractionType coulombtype = CoulombInteractionType::Default;
421     //! Modify the Coulomb interaction
422     InteractionModifiers coulomb_modifier = InteractionModifiers::Default;
423     //! Coulomb switch range start (nm)
424     real rcoulomb_switch = 0;
425     //! Coulomb cutoff (nm)
426     real rcoulomb = 0;
427     //! Relative dielectric constant
428     real epsilon_r = 0;
429     //! Relative dielectric constant of the RF
430     real epsilon_rf = 0;
431     //! Always false (no longer supported)
432     bool implicit_solvent = false;
433     //! Type of Van der Waals treatment
434     VanDerWaalsType vdwtype = VanDerWaalsType::Default;
435     //! Modify the Van der Waals interaction
436     InteractionModifiers vdw_modifier = InteractionModifiers::Default;
437     //! Van der Waals switch range start (nm)
438     real rvdw_switch = 0;
439     //! Van der Waals cutoff (nm)
440     real rvdw = 0;
441     //! Perform Long range dispersion corrections
442     DispersionCorrectionType eDispCorr = DispersionCorrectionType::Default;
443     //! Extension of the table beyond the cut-off, as well as the table length for 1-4 interac.
444     real tabext = 0;
445     //! Tolerance for shake
446     real shake_tol = 0;
447     //! Free energy calculations
448     FreeEnergyPerturbationType efep = FreeEnergyPerturbationType::Default;
449     //! Data for the FEP state
450     std::unique_ptr<t_lambda> fepvals;
451     //! Whether to do simulated tempering
452     bool bSimTemp = false;
453     //! Variables for simulated tempering
454     std::unique_ptr<t_simtemp> simtempvals;
455     //! Whether expanded ensembles are used
456     bool bExpanded = false;
457     //! Expanded ensemble parameters
458     std::unique_ptr<t_expanded> expandedvals;
459     //! Type of distance restraining
460     DistanceRestraintRefinement eDisre = DistanceRestraintRefinement::Default;
461     //! Force constant for time averaged distance restraints
462     real dr_fc = 0;
463     //! Type of weighting of pairs in one restraints
464     DistanceRestraintWeighting eDisreWeighting = DistanceRestraintWeighting::Default;
465     //! Use combination of time averaged and instantaneous violations
466     bool bDisreMixed = false;
467     //! Frequency of writing pair distances to enx
468     int nstdisreout = 0;
469     //! Time constant for memory function in disres
470     real dr_tau = 0;
471     //! Force constant for orientational restraints
472     real orires_fc = 0;
473     //! Time constant for memory function in orires
474     real orires_tau = 0;
475     //! Frequency of writing tr(SD) to energy output
476     int nstorireout = 0;
477     //! The stepsize for updating
478     real em_stepsize = 0;
479     //! The tolerance
480     real em_tol = 0;
481     //! Number of iterations for convergence of steepest descent in relax_shells
482     int niter = 0;
483     //! Stepsize for directional minimization in relax_shells
484     real fc_stepsize = 0;
485     //! Number of steps after which a steepest descents step is done while doing cg
486     int nstcgsteep = 0;
487     //! Number of corrections to the Hessian to keep
488     int nbfgscorr = 0;
489     //! Type of constraint algorithm
490     ConstraintAlgorithm eConstrAlg = ConstraintAlgorithm::Default;
491     //! Order of the LINCS Projection Algorithm
492     int nProjOrder = 0;
493     //! Warn if any bond rotates more than this many degrees
494     real LincsWarnAngle = 0;
495     //! Number of iterations in the final LINCS step
496     int nLincsIter = 0;
497     //! Use successive overrelaxation for shake
498     bool bShakeSOR = false;
499     //! Friction coefficient for BD (amu/ps)
500     real bd_fric = 0;
501     //! Random seed for SD and BD
502     int64_t ld_seed = 0;
503     //! The number of walls
504     int nwall = 0;
505     //! The type of walls
506     WallType wall_type = WallType::Default;
507     //! The potentail is linear for r<=wall_r_linpot
508     real wall_r_linpot = 0;
509     //! The atom type for walls
510     int wall_atomtype[2] = { 0, 0 };
511     //! Number density for walls
512     real wall_density[2] = { 0, 0 };
513     //! Scaling factor for the box for Ewald
514     real wall_ewald_zfac = 0;
515
516     /* COM pulling data */
517     //! Do we do COM pulling?
518     bool bPull = false;
519     //! The data for center of mass pulling
520     std::unique_ptr<pull_params_t> pull;
521
522     /* AWH bias data */
523     //! Whether to use AWH biasing for PMF calculations
524     bool bDoAwh = false;
525     //! AWH biasing parameters
526     std::unique_ptr<gmx::AwhParams> awhParams;
527
528     /* Enforced rotation data */
529     //! Whether to calculate enforced rotation potential(s)
530     bool bRot = false;
531     //! The data for enforced rotation potentials
532     t_rot* rot = nullptr;
533
534     //! Whether to do ion/water position exchanges (CompEL)
535     SwapType eSwapCoords = SwapType::Default;
536     //! Swap data structure.
537     t_swapcoords* swap = nullptr;
538
539     //! Whether the tpr makes an interactive MD session possible.
540     bool bIMD = false;
541     //! Interactive molecular dynamics
542     t_IMD* imd = nullptr;
543
544     //! Acceleration for viscosity calculation
545     real cos_accel = 0;
546     //! Triclinic deformation velocities (nm/ps)
547     tensor deform = { { 0 } };
548     /*! \brief User determined parameters */
549     /**@{*/
550     int  userint1  = 0;
551     int  userint2  = 0;
552     int  userint3  = 0;
553     int  userint4  = 0;
554     real userreal1 = 0;
555     real userreal2 = 0;
556     real userreal3 = 0;
557     real userreal4 = 0;
558     /**@}*/
559     //! Group options
560     t_grpopts opts;
561     //! QM/MM calculation
562     bool bQMMM = false;
563
564     /* Fields for removed features go here (better caching) */
565     //! Whether AdResS is enabled - always false if a valid .tpr was read
566     bool bAdress = false;
567     //! Whether twin-range scheme is active - always false if a valid .tpr was read
568     bool useTwinRange = false;
569     //! Whether we have constant acceleration - removed in GROMACS 2022
570     bool useConstantAcceleration = false;
571
572     //! KVT object that contains input parameters converted to the new style.
573     gmx::KeyValueTreeObject* params = nullptr;
574
575     //! KVT for storing simulation parameters that are not part of the mdp file.
576     std::unique_ptr<gmx::KeyValueTreeObject> internalParameters;
577 };
578
579 int ir_optimal_nstcalcenergy(const t_inputrec* ir);
580
581 int tcouple_min_integration_steps(TemperatureCoupling etc);
582
583 int ir_optimal_nsttcouple(const t_inputrec* ir);
584
585 int pcouple_min_integration_steps(PressureCoupling epc);
586
587 int ir_optimal_nstpcouple(const t_inputrec* ir);
588
589 /* Returns if the Coulomb force or potential is switched to zero */
590 bool ir_coulomb_switched(const t_inputrec* ir);
591
592 /* Returns if the Coulomb interactions are zero beyond the rcoulomb.
593  * Note: always returns TRUE for the Verlet cut-off scheme.
594  */
595 bool ir_coulomb_is_zero_at_cutoff(const t_inputrec* ir);
596
597 /* As ir_coulomb_is_zero_at_cutoff, but also returns TRUE for user tabulated
598  * interactions, since these might be zero beyond rcoulomb.
599  */
600 bool ir_coulomb_might_be_zero_at_cutoff(const t_inputrec* ir);
601
602 /* Returns if the Van der Waals force or potential is switched to zero */
603 bool ir_vdw_switched(const t_inputrec* ir);
604
605 /* Returns if the Van der Waals interactions are zero beyond the rvdw.
606  * Note: always returns TRUE for the Verlet cut-off scheme.
607  */
608 bool ir_vdw_is_zero_at_cutoff(const t_inputrec* ir);
609
610 /* As ir_vdw_is_zero_at_cutoff, but also returns TRUE for user tabulated
611  * interactions, since these might be zero beyond rvdw.
612  */
613 bool ir_vdw_might_be_zero_at_cutoff(const t_inputrec* ir);
614
615 /*! \brief Free memory from input record.
616  *
617  * All arrays and pointers will be freed.
618  *
619  * \param[in] ir The data structure
620  */
621 void done_inputrec(t_inputrec* ir);
622
623 void pr_inputrec(FILE* fp, int indent, const char* title, const t_inputrec* ir, bool bMDPformat);
624
625 void cmp_inputrec(FILE* fp, const t_inputrec* ir1, const t_inputrec* ir2, real ftol, real abstol);
626
627 void comp_pull_AB(FILE* fp, const pull_params_t& pull, real ftol, real abstol);
628
629
630 bool inputrecDeform(const t_inputrec* ir);
631
632 bool inputrecDynamicBox(const t_inputrec* ir);
633
634 bool inputrecPreserveShape(const t_inputrec* ir);
635
636 bool inputrecNeedMutot(const t_inputrec* ir);
637
638 bool inputrecTwinRange(const t_inputrec* ir);
639
640 bool inputrecExclForces(const t_inputrec* ir);
641
642 bool inputrecNptTrotter(const t_inputrec* ir);
643
644 bool inputrecNvtTrotter(const t_inputrec* ir);
645
646 bool inputrecNphTrotter(const t_inputrec* ir);
647
648 /*! \brief Return true if the simulation is 2D periodic with two walls. */
649 bool inputrecPbcXY2Walls(const t_inputrec* ir);
650
651 //! \brief Return true if the simulation has frozen atoms (non-trivial freeze groups).
652 bool inputrecFrozenAtoms(const t_inputrec* ir);
653
654 /*! \brief Returns true for MD integator with T and/or P-coupling that supports
655  * calculating a conserved energy quantity.
656  *
657  * Note that dynamical integrators without T and P coupling (ie NVE)
658  * return false, i.e. the return value refers to whether there
659  * is a conserved quantity different than the total energy.
660  */
661 bool integratorHasConservedEnergyQuantity(const t_inputrec* ir);
662
663 /*! \brief Returns true when temperature is coupled or constant. */
664 bool integratorHasReferenceTemperature(const t_inputrec* ir);
665
666 /*! \brief Return the number of bounded dimensions
667  *
668  * \param[in] ir The input record with MD parameters
669  * \return the number of dimensions in which
670  * the coordinates of the particles are bounded, starting at X.
671  */
672 int inputrec2nboundeddim(const t_inputrec* ir);
673
674 /*! \brief Returns the number of degrees of freedom in center of mass motion
675  *
676  * \param[in] ir  The inputrec structure
677  * \return the number of degrees of freedom of the center of mass
678  */
679 int ndof_com(const t_inputrec* ir);
680
681 /*! \brief Returns the maximum reference temperature over all coupled groups
682  *
683  * Returns 0 for energy minimization and normal mode computation.
684  * Returns -1 for MD without temperature coupling.
685  *
686  * \param[in] ir  The inputrec structure
687  */
688 real maxReferenceTemperature(const t_inputrec& ir);
689
690 /*! \brief Returns whether there is an Ewald surface contribution
691  */
692 bool haveEwaldSurfaceContribution(const t_inputrec& ir);
693
694 /*! \brief Check if calculation of the specific FEP type was requested.
695  *
696  * \param[in] ir       Input record.
697  * \param[in] fepType  Free-energy perturbation type to check for.
698  *
699  * \returns If the \p fepType is perturbed in this run.
700  */
701 bool haveFreeEnergyType(const t_inputrec& ir, int fepType);
702
703 #endif /* GMX_MDTYPES_INPUTREC_H */