STORMM Source Documentation
Loading...
Searching...
No Matches
nml_dynamics.h
1// -*-c++-*-
2#ifndef STORMM_NML_DYNAMICS_H
3#define STORMM_NML_DYNAMICS_H
4
5#include "copyright.h"
6#include "Constants/behavior.h"
7#include "Parsing/textfile.h"
8#include "Potential/energy_enumerators.h"
9#include "Structure/structure_enumerators.h"
10#include "Trajectory/trajectory_enumerators.h"
11#include "input.h"
12#include "namelist_common.h"
13#include "namelist_emulator.h"
14
15namespace stormm {
16namespace namelist {
17
18using constants::PrecisionModel;
19using energy::VdwSumMethod;
20using parse::WrapTextSearch;
21using structure::ApplyConstraints;
22using structure::RattleMethod;
23using trajectory::ThermostatKind;
24
26constexpr int default_dynamics_nstlim = 100;
27
30constexpr int default_dynamics_ntpr = 0;
31constexpr int default_dynamics_ntwx = 0;
33
36constexpr int default_dynamics_nscm = 10000;
37
39constexpr double default_dynamics_time_step = 1.0;
40
42constexpr double default_rattle_tolerance = 1.0e-6;
43
45constexpr int default_rattle_max_iter = 20;
46
48constexpr char default_geometry_constraint_behavior[] = "off";
49
52constexpr char default_rattle_protocol[] = "sequential";
53
55constexpr double minimum_dynamics_time_step = 0.0009765625;
56
58constexpr double minimum_rattle_tolerance = 1.0e-9;
59
62constexpr int maximum_rattle_iterations = 100;
63
65constexpr char default_thermostat_kind[] = "none";
66
71constexpr char default_thermostat_cache_config[] = "single";
72
75constexpr int maximum_thermostat_cache_depth = 15;
76
80constexpr int default_thermostat_cache_depth = 1;
81
84constexpr int default_andersen_frequency = 10000;
85
87constexpr double default_langevin_frequency = 0.001;
88
91constexpr double default_simulation_temperature = 298.15;
92
96constexpr int default_thermostat_random_seed = 1329440765;
97
102constexpr int default_tstat_evo_window_start = 0;
103constexpr int default_tstat_evo_window_end = 0;
105
114constexpr int maximum_nt_warp_multiplicity = 8;
115constexpr int default_nt_warp_multiplicity = 1;
117
124public:
125
137 DynamicsControls(ExceptionResponse policy_in = ExceptionResponse::DIE);
138
139 DynamicsControls(const TextFile &tf, int *start_line, bool *found_nml,
140 ExceptionResponse policy_in = ExceptionResponse::DIE,
141 WrapTextSearch wrap = WrapTextSearch::NO);
143
147 DynamicsControls(const DynamicsControls &original) = default;
148 DynamicsControls(DynamicsControls &&original) = default;
149 DynamicsControls& operator=(const DynamicsControls &original) = default;
150 DynamicsControls& operator=(DynamicsControls &&original) = default;
152
154 int getStepCount() const;
155
158 int getDiagnosticPrintFrequency() const;
159
161 int getTrajectoryPrintFrequency() const;
162
165
167 double getTimeStep() const;
168
170 double getElectrostaticCutoff() const;
171
173 double getVanDerWaalsCutoff() const;
174
176 VdwSumMethod getVdwSummation() const;
177
179 double getCoulombConstant() const;
180
182 double getElec14Screening() const;
183
185 double getVdw14Screening() const;
186
189 bool coulombSetByUser() const;
190
193 bool elec14SetByUser() const;
194
197 bool vdw14SetByUser() const;
198
201 ApplyConstraints constrainGeometry() const;
202
205 ApplyConstraints useShake() const;
206
209 ApplyConstraints useSettle() const;
210
212 double getRattleTolerance() const;
213
215 int getRattleIterations() const;
216
220 RattleMethod getCpuRattleMethod() const;
221
223 ThermostatKind getThermostatKind() const;
224
227 int getThermostatEvolutionStart() const;
228
231 int getThermostatEvolutionEnd() const;
232
234 int getThermostatCacheDepth() const;
235
237 int getThermostatSeed() const;
238
246 int getThermostatLayerCount() const;
247
250 int getAndersenFrequency() const;
251
253 double getLangevinFrequency() const;
254
256 PrecisionModel getThermostatCacheConfig() const;
257
259 const std::vector<double>& getInitialTemperatureTargets() const;
260
262 const std::vector<double>& getFinalTemperatureTargets() const;
263
266 const std::vector<std::string>& getThermostatLabels() const;
267
270 const std::vector<int>& getThermostatLabelIndices() const;
271
273 const std::vector<std::string>& getThermostatMasks() const;
274
276 int getNTWarpMultiplicity() const;
277
279 const NamelistEmulator& getTranscript() const;
280
284 void setStepCount(int total_step_count_in);
285
289 void setDiagnosticPrintFrequency(int diagnostic_frequency_in);
290
294 void setTrajectoryPrintFrequency(int trajectory_frequency_in);
295
299 void setCenterOfMassMotionPurgeFrequency(int com_motion_purge_ferquency_in);
300
304 void setTimeStep(double time_step_in);
305
309 void setElectrostaticCutoff(double cutoff_in);
310
314 void setVanDerWaalsCutoff(double cutoff_in);
315
320 void setCutoff(double cutoff_in);
321
331 void setVdwSummation(const std::string &vdw_method_in);
332 void setVdwSummation(const VdwSumMethod vdw_method_in);
334
338 void setCoulombConstant(double coulomb_in);
339
343 void setElec14Screening(double screening_in);
344
348 void setVdw14Screening(double screening_in);
349
358 void setGeometricConstraints(const std::string &constrain_geometry_in);
359 void setGeometricConstraints(ApplyConstraints constrain_geometry_in = ApplyConstraints::YES);
361
367 void setUseShake(const std::string &use_shake_in);
368 void setUseShake(ApplyConstraints use_shake_in = ApplyConstraints::YES);
370
377 void setUseSettle(const std::string &use_settle_in);
378 void setUseSettle(ApplyConstraints use_settle_in = ApplyConstraints::YES);
380
390 void setCpuRattleMethod(const std::string &rattle_protocol_in);
391
395 void setRattleTolerance(double rattle_tolerance_in);
396
405 void setThermostatKind(const std::string &thermostat_kind_in);
406 void setThermostatKind(ThermostatKind thermostat_kind_in);
408
413 void setThermostatEvolutionStart(int thermo_evolution_start_in);
414
419 void setThermostatEvolutionEnd(int step_number);
420
424 void setThermostatCacheDepth(int depth_in);
425
429 void setThermostatSeed(int igseed);
430
434 void setAndersenFrequency(int frequency_in);
435
439 void setLangevinFrequency(double frequency_in);
440
449 void setThermostatCacheConfig(const std::string &cache_config_in);
450 void setThermostatCacheConfig(PrecisionModel cache_config_in);
452
464 void setThermostatGroup(double initial_target = default_simulation_temperature,
465 double final_target = default_simulation_temperature,
466 const std::string &label = std::string("all"), int label_index = -1,
467 const std::string &mask = std::string("@="));
468
473 void setNTWarpMultiplicity(int mult_in);
474
475private:
476 ExceptionResponse policy;
481 int total_step_count;
483 int diagnostic_frequency;
485 int trajectory_frequency;
487 int com_motion_purge_frequency;
490 double time_step;
491 double electrostatic_cutoff;
493 double van_der_waals_cutoff;
495 double coulomb;
496 VdwSumMethod vdw_style;
498 double elec_14_screening;
501 double vdw_14_screening;
503 bool coulomb_set_by_user;
506 bool elec_14_set_by_user;
510 bool vdw_14_set_by_user;
514 std::string constrain_geometry;
517 std::string use_shake;
519 std::string use_settle;
521 double rattle_tolerance;
522 int rattle_iterations;
524 std::string rattle_protocol;
527 std::string thermostat_kind;
529 int thermo_evolution_start;
531 int thermo_evolution_end;
533 int thermostat_cache_depth;
538 int thermostat_seed;
539 int andersen_frequency;
541 double langevin_frequency;
543 int nt_warp_multiplicity;
546
548 std::string thermostat_cache_config;
549
552 std::vector<double> initial_temperature_targets;
553
556 std::vector<double> final_temperature_targets;
557
560 std::vector<std::string> thermostat_labels;
561
563 std::vector<int> thermostat_label_indices;
564
567 std::vector<std::string> thermostat_masks;
568
570 NamelistEmulator nml_transcript;
571
573 void validateStepCount();
574
576 void validateDiagnosticPrintFrequency();
577
579 void validateTrajectoryPrintFrequency();
580
584 void validateCenterOfMassMotionPurgeFrequency();
585
587 void validateTimeStep();
588
590 void validateRattleTolerance();
591
593 void validateRattleIterations();
594
598 void validateTemperature(double t) const;
599
601 void validateThermostatKind();
602
604 void validateCacheDepth();
605
607 void validateCacheConfiguration();
608
610 void validateNTWarpMultiplicity();
611};
612
626NamelistEmulator dynamicsInput(const TextFile &tf, int *start_line, bool *found,
627 ExceptionResponse policy = ExceptionResponse::DIE,
628 WrapTextSearch wrap = WrapTextSearch::NO);
629
630} // namespace namelist
631} // namespace stormm
632
633#endif
DynamicsControls(ExceptionResponse policy_in=ExceptionResponse::DIE)
The constructor can prepare an object with default settings or read the corresponding namelist to acc...
Definition nml_dynamics.cpp:27
DynamicsControls(ExceptionResponse policy_in=ExceptionResponse::DIE)
The constructor can prepare an object with default settings or read the corresponding namelist to acc...
Definition nml_dynamics.cpp:27
double getTimeStep() const
Get the simulation time step.
Definition nml_dynamics.cpp:163
double getCoulombConstant() const
Get the value of Coulomb's constant.
Definition nml_dynamics.cpp:178
RattleMethod getCpuRattleMethod() const
Get the CPU-based method of implementing RATTLE for multiple constrained bonds connected to one centr...
Definition nml_dynamics.cpp:238
void setUseSettle(const std::string &use_settle_in)
Stipulate whether three-atom isosceles arrangements with two light atoms (e.g. water) will be held ri...
Definition nml_dynamics.cpp:463
void setLangevinFrequency(double frequency_in)
Set the stochastic collision frequency for a Langevin thermostat.
Definition nml_dynamics.cpp:557
void setNTWarpMultiplicity(int mult_in)
Get the warp multiplicity for non-bonded pairwise calculations. This applies only to periodic dynamic...
Definition nml_dynamics.cpp:586
ThermostatKind getThermostatKind() const
Get the thermostat kind.
Definition nml_dynamics.cpp:243
bool elec14SetByUser() const
Report whether the electrostatic 1:4 scaling was set explicitly or left at its default value.
Definition nml_dynamics.cpp:203
void setCenterOfMassMotionPurgeFrequency(int com_motion_purge_ferquency_in)
Set the center of mass motion purge frequency.
Definition nml_dynamics.cpp:352
ApplyConstraints constrainGeometry() const
Indicate whether general geometric constraints (RATTLE for hub-and-spoke bonded groups,...
Definition nml_dynamics.cpp:213
void setVdw14Screening(double screening_in)
Set the screening factor for 1:4 van-der Waals interactions.
Definition nml_dynamics.cpp:401
double getVanDerWaalsCutoff() const
Get the van-der Waals pairwise cutoff in periodic simulations.
Definition nml_dynamics.cpp:173
int getCenterOfMassMotionPurgeFrequency() const
Get the frequency for purging motion of the system's center of mass.
Definition nml_dynamics.cpp:158
double getRattleTolerance() const
Get the RATTLE tolerance.
Definition nml_dynamics.cpp:228
double getElectrostaticCutoff() const
Get the electrostatic pairwise cutoff in periodic simulations.
Definition nml_dynamics.cpp:168
int getTrajectoryPrintFrequency() const
Get the printing frequency for trajectory snapshots.
Definition nml_dynamics.cpp:153
const std::vector< double > & getFinalTemperatureTargets() const
Get the vector of final temperature targets for all groups of atoms and systems.
Definition nml_dynamics.cpp:303
void setCpuRattleMethod(const std::string &rattle_protocol_in)
Set the RATTLE protocol to be used in CPU operations (the GPU will always use the "CENTER_SUM" approa...
Definition nml_dynamics.cpp:491
void setThermostatSeed(int igseed)
Set the random seed to be used in the thermostat's random number generators.
Definition nml_dynamics.cpp:547
void setUseShake(const std::string &use_shake_in)
Stipulate whether bonds to hydrogen atoms will be held rigid at their equilibrium length....
Definition nml_dynamics.cpp:435
void setThermostatEvolutionStart(int thermo_evolution_start_in)
Set the starting step for temperature evolution from the initial temperature profile to the final tem...
Definition nml_dynamics.cpp:531
int getDiagnosticPrintFrequency() const
Get the printing frequency for energies and other state variables of the system or collection of syst...
Definition nml_dynamics.cpp:148
void setTrajectoryPrintFrequency(int trajectory_frequency_in)
Set the trajectory snapshot printing frequency.
Definition nml_dynamics.cpp:345
int getRattleIterations() const
Get the maximum number of RATTLE iterations.
Definition nml_dynamics.cpp:233
bool vdw14SetByUser() const
Report whether the van-der Waals 1:4 scaling was set explicitly or left at its default value.
Definition nml_dynamics.cpp:208
void setThermostatKind(const std::string &thermostat_kind_in)
Get the thermostat kind.
Definition nml_dynamics.cpp:520
void setTimeStep(double time_step_in)
Set the simulation time step.
Definition nml_dynamics.cpp:357
int getAndersenFrequency() const
Get the frequncy of velocity reassignments for a "massive" Andersen thermostat, one in which all velo...
Definition nml_dynamics.cpp:283
void setRattleTolerance(double rattle_tolerance_in)
Set the simulation RATTLE tolerance.
Definition nml_dynamics.cpp:514
void setCutoff(double cutoff_in)
Set the cutoffs for short-ranged van-der Waals as well as electrostatic interactions in a periodic si...
Definition nml_dynamics.cpp:373
double getLangevinFrequency() const
Get the Langevin collison frequency, in units of inverse femtoseconds.
Definition nml_dynamics.cpp:288
int getThermostatLayerCount() const
Get the number of distinct layers to the thermostat, the number of different temperature and system g...
Definition nml_dynamics.cpp:268
int getThermostatEvolutionEnd() const
Get the final step for temperature evolution from the initial temperature profile to the final temper...
Definition nml_dynamics.cpp:253
void setElec14Screening(double screening_in)
Set the screening factor for 1:4 electrostatic interactions.
Definition nml_dynamics.cpp:395
bool coulombSetByUser() const
Report whether the value of Coulomb's constant was set explicitly or left at the default value.
Definition nml_dynamics.cpp:198
ApplyConstraints useShake() const
Indicate whether SHAKE (and, by extension, RATTLE in the velocity-Verlet integrator) should be implem...
Definition nml_dynamics.cpp:218
void setVdwSummation(const std::string &vdw_method_in)
Set the strategy for evaluating the tails of van-der Waals (Lennard-Jones) interactions.
Definition nml_dynamics.cpp:379
void setElectrostaticCutoff(double cutoff_in)
Set the short-ranged electrostatic cutoff for the simulation.
Definition nml_dynamics.cpp:363
const NamelistEmulator & getTranscript() const
Get the original namelist emulator object as a transcript of the user input.
Definition nml_dynamics.cpp:328
DynamicsControls(const DynamicsControls &original)=default
As with other control objects, copy and move constructors, plus copy and move assignment operators,...
const std::vector< double > & getInitialTemperatureTargets() const
Get the vector of initial temperature targets for all groups of atoms and systems.
Definition nml_dynamics.cpp:298
double getElec14Screening() const
Get the electrostatic 1:4 screening value.
Definition nml_dynamics.cpp:188
double getVdw14Screening() const
Get the van-der Waals 1:4 screening value.
Definition nml_dynamics.cpp:193
int getStepCount() const
Get the total number of dynamics steps.
Definition nml_dynamics.cpp:143
void setDiagnosticPrintFrequency(int diagnostic_frequency_in)
Set the diagnostic printing frequency.
Definition nml_dynamics.cpp:339
int getThermostatEvolutionStart() const
Get the starting step for temperature evolution from the initial temperature profile to the final tem...
Definition nml_dynamics.cpp:248
const std::vector< std::string > & getThermostatMasks() const
Get the atom mask strings for each thermostated group of atoms.
Definition nml_dynamics.cpp:318
void setThermostatGroup(double initial_target=default_simulation_temperature, double final_target=default_simulation_temperature, const std::string &label=std::string("all"), int label_index=-1, const std::string &mask=std::string("@="))
Get the vector of initial temperature targets for all groups of atoms and systems.
Definition nml_dynamics.cpp:573
void setStepCount(int total_step_count_in)
Set the total number of dynamics steps.
Definition nml_dynamics.cpp:333
void setThermostatCacheConfig(const std::string &cache_config_in)
Set the thermostat cache configuration.
Definition nml_dynamics.cpp:562
void setVanDerWaalsCutoff(double cutoff_in)
Set the short-ranged van-der Waals cutoff for the simulation.
Definition nml_dynamics.cpp:368
void setCoulombConstant(double coulomb_in)
Set the value of Coulomb's constant.
Definition nml_dynamics.cpp:389
void setThermostatCacheDepth(int depth_in)
Set the depth of the thermostat's random number cache.
Definition nml_dynamics.cpp:541
ApplyConstraints useSettle() const
Indicate whether SHAKE (and, by extension, RATTLE in the velocity-Verlet integrator) should be implem...
Definition nml_dynamics.cpp:223
int getThermostatSeed() const
Get the random seed to be used in the thermostat's random number generators.
Definition nml_dynamics.cpp:263
const std::vector< int > & getThermostatLabelIndices() const
Get the indices of systems within the label groups to which each thermostated group of atoms belongs.
Definition nml_dynamics.cpp:313
void setAndersenFrequency(int frequency_in)
Set the velocity restart frequency for a "massive" Andersen thermostat.
Definition nml_dynamics.cpp:552
PrecisionModel getThermostatCacheConfig() const
Get the thermostat cache configuration.
Definition nml_dynamics.cpp:293
int getThermostatCacheDepth() const
Get the depth of the thermostat's random number cache.
Definition nml_dynamics.cpp:258
void setGeometricConstraints(const std::string &constrain_geometry_in)
Stipulate whether geometric constraints will be implemented.
Definition nml_dynamics.cpp:407
void setThermostatEvolutionEnd(int step_number)
Set the final step for temperature evolution from the initial temperature profile to the final temper...
Definition nml_dynamics.cpp:536
const std::vector< std::string > & getThermostatLabels() const
Get the list of label groups within the systems cache to which each thermostated group of atoms belon...
Definition nml_dynamics.cpp:308
VdwSumMethod getVdwSummation() const
Get the method for computing van-der Waals interactions between particles.
Definition nml_dynamics.cpp:183
int getNTWarpMultiplicity() const
Get the warp multiplicity for non-bonded pairwise calculations.
Definition nml_dynamics.cpp:323
Collection of variables to transcribe information contained within a namelist.
Definition namelist_emulator.h:30
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RA...
Definition textfile.h:45