2#ifndef STORMM_NML_DYNAMICS_H
3#define STORMM_NML_DYNAMICS_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"
12#include "namelist_common.h"
13#include "namelist_emulator.h"
18using constants::PrecisionModel;
19using energy::VdwSumMethod;
20using parse::WrapTextSearch;
21using structure::ApplyConstraints;
22using structure::RattleMethod;
23using trajectory::ThermostatKind;
26constexpr int default_dynamics_nstlim = 100;
30constexpr int default_dynamics_ntpr = 0;
31constexpr int default_dynamics_ntwx = 0;
36constexpr int default_dynamics_nscm = 10000;
39constexpr double default_dynamics_time_step = 1.0;
42constexpr double default_rattle_tolerance = 1.0e-6;
45constexpr int default_rattle_max_iter = 20;
48constexpr char default_geometry_constraint_behavior[] =
"off";
52constexpr char default_rattle_protocol[] =
"sequential";
55constexpr double minimum_dynamics_time_step = 0.0009765625;
58constexpr double minimum_rattle_tolerance = 1.0e-9;
62constexpr int maximum_rattle_iterations = 100;
65constexpr char default_thermostat_kind[] =
"none";
71constexpr char default_thermostat_cache_config[] =
"single";
75constexpr int maximum_thermostat_cache_depth = 15;
80constexpr int default_thermostat_cache_depth = 1;
84constexpr int default_andersen_frequency = 10000;
87constexpr double default_langevin_frequency = 0.001;
91constexpr double default_simulation_temperature = 298.15;
96constexpr int default_thermostat_random_seed = 1329440765;
102constexpr int default_tstat_evo_window_start = 0;
103constexpr int default_tstat_evo_window_end = 0;
114constexpr int maximum_nt_warp_multiplicity = 8;
115constexpr int default_nt_warp_multiplicity = 1;
140 ExceptionResponse policy_in = ExceptionResponse::DIE,
141 WrapTextSearch wrap = WrapTextSearch::NO);
368 void setUseShake(ApplyConstraints use_shake_in = ApplyConstraints::YES);
378 void setUseSettle(ApplyConstraints use_settle_in = ApplyConstraints::YES);
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(
"@="));
476 ExceptionResponse policy;
481 int total_step_count;
483 int diagnostic_frequency;
485 int trajectory_frequency;
487 int com_motion_purge_frequency;
491 double electrostatic_cutoff;
493 double van_der_waals_cutoff;
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;
539 int andersen_frequency;
541 double langevin_frequency;
543 int nt_warp_multiplicity;
548 std::string thermostat_cache_config;
552 std::vector<double> initial_temperature_targets;
556 std::vector<double> final_temperature_targets;
560 std::vector<std::string> thermostat_labels;
563 std::vector<int> thermostat_label_indices;
567 std::vector<std::string> thermostat_masks;
573 void validateStepCount();
576 void validateDiagnosticPrintFrequency();
579 void validateTrajectoryPrintFrequency();
584 void validateCenterOfMassMotionPurgeFrequency();
587 void validateTimeStep();
590 void validateRattleTolerance();
593 void validateRattleIterations();
598 void validateTemperature(
double t)
const;
601 void validateThermostatKind();
604 void validateCacheDepth();
607 void validateCacheConfiguration();
610 void validateNTWarpMultiplicity();
627 ExceptionResponse policy = ExceptionResponse::DIE,
628 WrapTextSearch wrap = WrapTextSearch::NO);
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