STORMM Source Documentation
Loading...
Searching...
No Matches
thermostat.h
1// -*-c++-*-
2#ifndef STORMM_THERMOSTAT_H
3#define STORMM_THERMOSTAT_H
4
5#include <string>
6#include <vector>
7#include "copyright.h"
8#include "Accelerator/gpu_details.h"
9#include "Accelerator/hybrid.h"
10#include "Constants/behavior.h"
11#include "Constants/scaling.h"
12#include "Constants/symbol_values.h"
13#include "DataTypes/common_types.h"
14#include "Math/vector_ops.h"
15#include "Namelists/nml_dynamics.h"
16#include "Reporting/error_format.h"
17#include "Structure/structure_enumerators.h"
18#include "Synthesis/atomgraph_synthesis.h"
19#include "Synthesis/synthesis_cache_map.h"
20#include "Topology/atomgraph.h"
21#include "Topology/atomgraph_abstracts.h"
22#include "trajectory_enumerators.h"
23
24namespace stormm {
25namespace trajectory {
26
27using card::GpuDetails;
28using card::Hybrid;
29using card::HybridTargetLevel;
30using constants::PrecisionModel;
31using data_types::isSignedIntegralScalarType;
32using namelist::default_andersen_frequency;
33using namelist::default_langevin_frequency;
34using namelist::default_rattle_tolerance;
35using namelist::default_simulation_temperature;
36using namelist::default_thermostat_cache_depth;
37using namelist::default_thermostat_random_seed;
38using namelist::default_tstat_evo_window_start;
39using namelist::default_tstat_evo_window_end;
40using namelist::DynamicsControls;
41using namelist::maximum_thermostat_cache_depth;
42using stmath::findBin;
43using structure::ApplyConstraints;
44using symbols::boltzmann_constant_gafs;
45using symbols::boltzmann_constant_gafs_f;
46using synthesis::AtomGraphSynthesis;
47using synthesis::PhaseSpaceSynthesis;
48using synthesis::PsSynthesisWriter;
49using synthesis::SyAtomUpdateKit;
50using synthesis::SynthesisCacheMap;
51using synthesis::SystemCache;
52using topology::ChemicalDetailsKit;
53
58template <typename T> struct ThermostatWriter {
59
62 ThermostatWriter(ThermostatKind kind_in, ThermostatPartition layout_in, int natom_in,
63 size_t padded_natom_in, int npart_in, int step_in, int depth_in,
64 int init_evolution_in, int end_evolution_in, T init_temperature_in,
65 T final_temperature_in, T dt_in, bool csnt_geom_in, T rattle_tol_in,
66 int rattle_iter_in, int andr_cyc_in, T gamma_ln_in, T ln_implicit_in,
67 T ln_explicit_in, bool load_synthesis_forces_in,
68 const int4* partition_bounds_in, const T* init_temperatures_in,
69 const T* final_temperatures_in, ullint2* state_xy_in, ullint2* state_zw_in,
70 PrecisionModel rng_mode_in, double* cache_in, float* sp_cache_in);
71
75 ThermostatWriter(const ThermostatWriter &original) = default;
76 ThermostatWriter(ThermostatWriter &&original) = default;
78
79 const ThermostatKind kind;
80 const ThermostatPartition layout;
82 const int natom;
83 const size_t padded_natom;
84 const int npart;
87 int step;
88 const int depth;
91 const int init_evolution;
95 const int end_evolution;
100 const T dt;
101 const bool cnst_geom;
102 const T rattle_tol;
103 const int rattle_iter;
105 const int andr_cyc;
108 const T gamma_ln;
112 const T ln_implicit;
114 const T ln_explicit;
123 ullint2* state_xy;
124 ullint2* state_zw;
125 const PrecisionModel rng_mode;
128 double* cache;
130 float* sp_cache;
132};
133
135template <typename T> struct ThermostatReader {
136
141 ThermostatReader(ThermostatKind kind_in, ThermostatPartition layout_in, int natom_in,
142 size_t padded_natom_in, int npart_in, int step_in, int depth_in,
143 int init_evolution_in, int end_evolution_in, T init_temperature_in,
144 T final_temperature_in, T dt_in, bool csnt_geom_in, T rattle_tol_in,
145 int rattle_iter_in, int andr_cyc_in, T gamma_ln_in, T ln_implicit_in,
146 T ln_explicit_in, bool load_synthesis_forces_in,
147 const int4* partition_bounds_in, const T* init_temperatures_in,
148 const T* final_temperatures_in, const ullint2* state_xy_in,
149 const ullint2* state_zw_in, PrecisionModel rng_mode_in, const double* cache_in,
150 const float* sp_cache_in);
151
153
156
160 ThermostatReader(const ThermostatReader &original) = default;
161 ThermostatReader(ThermostatReader &&original) = default;
163
164 const ThermostatKind kind;
165 const ThermostatPartition layout;
167 const int natom;
168 const size_t padded_natom;
169 const int npart;
172 const int step;
173 const int depth;
176 const int init_evolution;
180 const int end_evolution;
186 const T dt;
187 const bool cnst_geom;
188 const T rattle_tol;
189 const int rattle_iter;
191 const int andr_cyc;
194 const T gamma_ln;
196 const T ln_implicit;
198 const T ln_explicit;
207 const ullint2* state_xy;
208 const ullint2* state_zw;
209 const PrecisionModel rng_mode;
212 const double* cache;
214 const float* sp_cache;
216};
217
222public:
223
236 Thermostat(ThermostatKind kind_in = ThermostatKind::NONE,
237 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
238 int random_seed_in = default_thermostat_random_seed,
239 const GpuDetails &gpu = null_gpu);
240
241 Thermostat(int atom_count_in, ThermostatKind kind_in, double temperature_in,
242 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
243 int random_seed_in = default_thermostat_random_seed,
244 const GpuDetails &gpu = null_gpu);
245
246 Thermostat(int atom_count_in, ThermostatKind kind_in, double init_temperature_in,
247 double final_temperature_in, int initial_evolution_step_in,
248 int final_evolution_step_in, PrecisionModel cache_config_in = PrecisionModel::SINGLE,
249 int random_seed_in = default_thermostat_random_seed,
250 const GpuDetails &gpu = null_gpu);
251
252 Thermostat(int atom_count_in, ThermostatKind kind_in,
253 const std::vector<double> &initial_temperatures_in,
254 const std::vector<double> &final_temperatures_in,
255 const std::vector<int2> &paritions_in,
256 int initial_evolution_step_in = default_tstat_evo_window_start,
257 int final_evolution_step_in = default_tstat_evo_window_end,
258 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
259 int random_seed_in = default_thermostat_random_seed,
260 const GpuDetails &gpu = null_gpu);
261
262 Thermostat(const AtomGraph *ag, ThermostatKind kind_in,
263 double initial_temperature_in, double final_temperature_in,
264 int initial_evolution_step_in, int final_evolution_step_in,
265 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
266 int random_seed_in = default_thermostat_random_seed,
267 const GpuDetails &gpu = null_gpu);
268
269 Thermostat(const AtomGraph &ag, ThermostatKind kind_in,
270 double initial_temperature_in,
271 double final_temperature_in,
272 int initial_evolution_step_in, int final_evolution_step_in,
273 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
274 int random_seed_in = default_thermostat_random_seed,
275 const GpuDetails &gpu = null_gpu);
276
277 Thermostat(const AtomGraph *ag, ThermostatKind kind_in,
278 double temperature_in = default_simulation_temperature,
279 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
280 int random_seed_in = default_thermostat_random_seed,
281 const GpuDetails &gpu = null_gpu);
282
283 Thermostat(const AtomGraph &ag, ThermostatKind kind_in,
284 double temperature_in = default_simulation_temperature,
285 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
286 int random_seed_in = default_thermostat_random_seed,
287 const GpuDetails &gpu = null_gpu);
288
289 Thermostat(const AtomGraph *ag, ThermostatKind kind_in,
290 const std::vector<double> &initial_temperatures_in,
291 const std::vector<double> &final_temperatures_in,
292 const std::vector<int2> &paritions_in,
293 int initial_evolution_step_in = default_tstat_evo_window_start,
294 int final_evolution_step_in = default_tstat_evo_window_end,
295 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
296 int random_seed_in = default_thermostat_random_seed,
297 const GpuDetails &gpu = null_gpu);
298
299 Thermostat(const AtomGraph &ag, ThermostatKind kind_in,
300 const std::vector<double> &initial_temperatures_in,
301 const std::vector<double> &final_temperatures_in,
302 const std::vector<int2> &paritions_in,
303 int initial_evolution_step_in = default_tstat_evo_window_start,
304 int final_evolution_step_in = default_tstat_evo_window_end,
305 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
306 int random_seed_in = default_thermostat_random_seed,
307 const GpuDetails &gpu = null_gpu);
308
309 Thermostat(const AtomGraphSynthesis *poly_ag, ThermostatKind kind_in,
310 double initial_temperature_in, double final_temperature_in,
311 int initial_evolution_step_in, int final_evolution_step_in,
312 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
313 int random_seed_in = default_thermostat_random_seed,
314 const GpuDetails &gpu = null_gpu);
315
316 Thermostat(const AtomGraphSynthesis &poly_ag, ThermostatKind kind_in,
317 double initial_temperature_in, double final_temperature_in,
318 int initial_evolution_step_in, int final_evolution_step_in,
319 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
320 int random_seed_in = default_thermostat_random_seed,
321 const GpuDetails &gpu = null_gpu);
322
323 Thermostat(const AtomGraphSynthesis *poly_ag, ThermostatKind kind_in,
324 double temperature_in = default_simulation_temperature,
325 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
326 int random_seed_in = default_thermostat_random_seed,
327 const GpuDetails &gpu = null_gpu);
328
329 Thermostat(const AtomGraphSynthesis &poly_ag, ThermostatKind kind_in,
330 double temperature_in = default_simulation_temperature,
331 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
332 int random_seed_in = default_thermostat_random_seed,
333 const GpuDetails &gpu = null_gpu);
334
335 Thermostat(const AtomGraphSynthesis *poly_ag, ThermostatKind kind_in,
336 const std::vector<double> &initial_temperatures_in,
337 const std::vector<double> &final_temperatures_in,
338 const std::vector<int2> &paritions_in,
339 int initial_evolution_step_in = default_tstat_evo_window_start,
340 int final_evolution_step_in = default_tstat_evo_window_end,
341 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
342 int random_seed_in = default_thermostat_random_seed,
343 const GpuDetails &gpu = null_gpu);
344
345 Thermostat(const AtomGraphSynthesis &poly_ag, ThermostatKind kind_in,
346 const std::vector<double> &initial_temperatures_in,
347 const std::vector<double> &final_temperatures_in,
348 const std::vector<int2> &paritions_in,
349 int initial_evolution_step_in = default_tstat_evo_window_start,
350 int final_evolution_step_in = default_tstat_evo_window_end,
351 PrecisionModel cache_config_in = PrecisionModel::SINGLE,
352 int random_seed_in = default_thermostat_random_seed,
353 const GpuDetails &gpu = null_gpu);
354
355 Thermostat(const AtomGraphSynthesis *poly_ag, const DynamicsControls &dyncon,
356 const SystemCache &sc, const std::vector<int> &sc_origins,
357 const GpuDetails &gpu = null_gpu);
358
359 Thermostat(const AtomGraphSynthesis &poly_ag, const DynamicsControls &dyncon,
360 const SystemCache &sc, const std::vector<int> &sc_origins,
361 const GpuDetails &gpu = null_gpu);
363
370 Thermostat(const Thermostat& original) = default;
371 Thermostat(Thermostat&& original) = default;
372 Thermostat& operator=(const Thermostat& original) = default;
373 Thermostat& operator=(Thermostat&& original) = default;
375
377 ThermostatKind getKind() const;
378
381 ThermostatPartition getBathPartitions() const;
382
384 PrecisionModel getCacheConfiguration() const;
385
387 int getAtomCount() const;
388
391 int getStepNumber() const;
392
394 int getRandomSeed() const;
395
399 int getRandomCacheDepth() const;
400
404 int getInitialEvolutionStep() const;
405
409 int getFinalEvolutionStep() const;
410
413 ullint4 getGeneratorState(int atom_index,
414 HybridTargetLevel tier = HybridTargetLevel::HOST) const;
415
426 double getCachedRandomResult(int atom_index, int cache_row,
427 HybridTargetLevel tier = HybridTargetLevel::HOST) const;
428
433 double getInitialTemperature(int atom_index = 0) const;
434
438 double getFinalTemperature(int atom_index = 0) const;
439
444 template <typename T> std::vector<T> getTemperatureSpread(int step_number = 0) const;
445
450 std::vector<int4> getPartitionMap() const;
451
456 template <typename Tcalc> Tcalc getAtomTarget(int atom_index = 0) const;
457
462 template <typename Tcalc>
463 Tcalc getPartitionTarget(int index = 0) const;
464
469 int getPartitionConstrainedDoF(int index = 0) const;
470
475 int getPartitionFreeDoF(int index = 0) const;
476
478 int getAndersenResetFrequency() const;
479
481 double getLangevinCollisionFrequency() const;
482
485 double getLangevinImplicitFactor() const;
486
489 double getLangevinExplicitFactor() const;
490
492 double getTimeStep() const;
493
495 ApplyConstraints constrainGeometry() const;
496
498 double getRattleTolerance() const;
499
501 int getRattleIterations() const;
502
505 bool loadSynthesisForces() const;
506
508 // const reference.
509 const Thermostat* getSelfPointer() const;
510
519 const ThermostatReader<double> dpData(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
520 ThermostatWriter<double> dpData(HybridTargetLevel tier = HybridTargetLevel::HOST);
521 const ThermostatReader<float> spData(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
522 ThermostatWriter<float> spData(HybridTargetLevel tier = HybridTargetLevel::HOST);
524
536 void setAtomCount(int atom_count_in, int new_seed = -1, const GpuDetails &gpu = null_gpu);
537
552 void setTemperature(double initial_temperature_in, double final_temperature_in = -1.0);
553 void setTemperature(const std::vector<double> &initial_temperatures_in,
554 const std::vector<double> &final_temperatures_in,
555 const std::vector<int2> &partitions_in);
557
562
571 void setEvolutionWindow(int init_step_in, int final_step_in);
572
580 void setCacheConfiguration(PrecisionModel cache_config_in, const GpuDetails &gpu = null_gpu);
581
590 void setRandomCacheDepth(int depth_in, const GpuDetails &gpu = null_gpu);
591
596 void setLangevinCollisionFrequency(double langevin_frequency_in);
597
601 void setAndersenResetFrequency(int andersen_frequency_in);
602
606 void setTimeStep(double time_step_in);
607
610 void incrementStep();
611
614 void decrementStep();
615
619 void setGeometryConstraints(ApplyConstraints cnst_geometry_in);
620
624 void setRattleTolerance(double rattle_tolerance_in);
625
630 void setRattleIterations(int rattle_iterations_in);
631
641 void setSynthesisForceLoading(bool load_synthesis_forces_in = true);
642
644 void validateTemperature(double temperature_in);
645
650
655
669 void initializeRandomStates(int new_seed = default_thermostat_random_seed,
670 int scrub_cycles = 25,
671 HybridTargetLevel tier = HybridTargetLevel::HOST,
672 const GpuDetails &gpu = null_gpu);
673
683 void refresh(size_t index_start, size_t index_end, int refresh_depth = 0);
684
685#ifdef STORMM_USE_HPC
690 void upload();
691
695 void download();
696
698 void uploadPartitions();
699
701 void downloadPartitions();
702#endif
703
704private:
705 ThermostatKind kind;
706 ThermostatPartition bath_layout;
711 PrecisionModel cache_config;
722 int atom_count;
726 size_t padded_atom_count;
727 int partition_count;
729 int step_number;
734 int random_seed;
736 int random_cache_depth;
737 int initial_evolution_step;
738 int final_evolution_step;
739 double initial_temperature;
740 double final_temperature;
741 int andersen_frequency;
743 double langevin_frequency;
745 double time_step;
748 ApplyConstraints cnst_geometry;
750 double rattle_tolerance;
751 int rattle_iterations;
753 bool load_synthesis_forces;
760
766 Hybrid<double> initial_temperatures;
767 Hybrid<float> sp_initial_temperatures;
769
772 Hybrid<double> final_temperatures;
773 Hybrid<float> sp_final_temperatures;
775
782 Hybrid<int4> partitions;
783
788 Hybrid<ullint2> random_state_vector_xy;
789 Hybrid<ullint2> random_state_vector_zw;
791
794 Hybrid<double> random_cache;
795 Hybrid<float> sp_random_cache;
797
801 AtomGraph *ag_pointer;
802 AtomGraphSynthesis *poly_ag_pointer;
804
815 void allocateRandomStorage(int new_seed = -1, const GpuDetails &gpu = null_gpu);
816
818 void resizeTemperatureArrays();
819};
820
824std::string getThermostatName(ThermostatKind kind);
825
839template <typename Tcalc>
840Tcalc getAtomTemperatureTarget(const ThermostatReader<Tcalc> &tstr, int atom_index = 0);
841
842template <typename Tcalc>
843Tcalc getAtomTemperatureTarget(const ThermostatWriter<Tcalc> &tstw, int atom_index = 0);
844
845double getAtomTemperatureTarget(const Thermostat &tst, int atom_index = 0);
847
861template <typename Tcalc>
862Tcalc getPartitionTemperatureTarget(const ThermostatReader<Tcalc> &tstr, int index = 0);
863
864template <typename Tcalc>
865Tcalc getPartitionTemperatureTarget(const ThermostatWriter<Tcalc> &tstw, int index = 0);
866
867double getPartitionTemperatureTarget(const Thermostat &tst, int index = 0);
869
908template <typename Tcoord, typename Tcalc>
909void andersenVelocityReset(Tcoord* xvel, Tcoord* yvel, Tcoord* zvel, int* xvel_ovrf,
910 int* yvel_ovrf, int* zvel_ovrf, const Tcalc* inv_masses,
911 const ThermostatReader<Tcalc> &tstr, Tcalc vel_scale_factor = 1.0);
912
913template <typename Tcoord, typename Tcalc>
914void andersenVelocityReset(Tcoord* xvel, Tcoord* yvel, Tcoord* zvel, const Tcalc* masses,
915 const ThermostatReader<Tcalc> &tstr, Tcalc vel_scale_factor = 1.0);
916
917void andersenVelocityReset(PhaseSpaceWriter *psw, const ChemicalDetailsKit &cdk,
918 const ThermostatReader<double> &tstr);
919
920void andersenVelocityReset(PhaseSpace *ps, const AtomGraph &ag, const Thermostat &tst);
921
922template <typename Tcalc, typename Tcalc2, typename Tcalc4>
923void andersenVelocityReset(PsSynthesisWriter *poly_psw,
925 const ThermostatReader<Tcalc> &tstr);
926
927#ifdef STORMM_USE_HPC
928void andersenVelocityReset(PsSynthesisWriter *poly_psw,
929 const SyAtomUpdateKit<void, void, void> &poly_auk,
930 const ThermostatReader<void> &tstr,
931 PrecisionModel prec = PrecisionModel::SINGLE,
932 const GpuDetails &gpu = null_gpu);
933#endif
934
935void andersenVelocityReset(PhaseSpaceSynthesis *poly_ps, const AtomGraphSynthesis *poly_ag,
936 const Thermostat *tst, PrecisionModel prec = PrecisionModel::SINGLE);
937
938void andersenVelocityReset(PhaseSpaceSynthesis *poly_ps, const AtomGraphSynthesis &poly_ag,
939 const Thermostat &tst, PrecisionModel prec = PrecisionModel::SINGLE);
941
959void velocityKickStart(PhaseSpace *ps, const AtomGraph *ag, Thermostat *tst,
960 const DynamicsControls &dyncon,
961 EnforceExactTemperature scale_temp = EnforceExactTemperature::YES);
962
963void velocityKickStart(PhaseSpace *ps, const AtomGraph &ag, Thermostat *tst,
964 const DynamicsControls &dyncon,
965 EnforceExactTemperature scale_temp = EnforceExactTemperature::YES);
966
967void velocityKickStart(PhaseSpaceSynthesis *poly_ps, const AtomGraphSynthesis *poly_ag,
968 Thermostat *tst, const DynamicsControls &dyncon,
969 PrecisionModel prec = PrecisionModel::SINGLE,
970 EnforceExactTemperature scale_temp = EnforceExactTemperature::YES,
971 const GpuDetails &gpu = null_gpu);
972
973void velocityKickStart(PhaseSpaceSynthesis *poly_ps, const AtomGraphSynthesis &poly_ag,
974 Thermostat *tst, const DynamicsControls &dyncon,
975 PrecisionModel prec = PrecisionModel::SINGLE,
976 EnforceExactTemperature scale_temp = EnforceExactTemperature::YES,
977 const GpuDetails &gpu = null_gpu);
979
980} // namespace trajectory
981} // namespace stormm
982
983#include "thermostat.tpp"
984
985#endif
Pertinent aspects of one particular GPU. Condensing the data for each GPU in this manner helps to ens...
Definition gpu_details.h:27
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
Thermostat(ThermostatKind kind_in=ThermostatKind::NONE, PrecisionModel cache_config_in=PrecisionModel::SINGLE, int random_seed_in=default_thermostat_random_seed, const GpuDetails &gpu=null_gpu)
Constructors for the Thermostat object. Any information can be added via setter functions after const...
Definition thermostat.cpp:50
Object to encapsulate molecular dynamics control information. Like other namelist encapsualtors,...
Definition nml_dynamics.h:123
A collection of one or more AtomGraph objects, with similar components arranged in contiguous arrays ...
Definition atomgraph_synthesis.h:55
A fixed-precision representation of coordinates, velocities, and forces to manage a set of simulation...
Definition phasespace_synthesis.h:325
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
Object to encapsulate molecular dynamics control information. Like other namelist encapsualtors,...
Definition nml_dynamics.h:123
An object to complement a topology and hold positions, velocities, and forces of all particles in a s...
Definition phasespace.h:141
Simple but central struct to store the primitive form of the collection of systems that most STORMM a...
Definition systemcache.h:63
Store the parameters for a simulation thermostat. Includes Berendsen, Andersen, and Langevin methods....
Definition thermostat.h:221
void setRattleTolerance(double rattle_tolerance_in)
Set the convergence criterion for RATTLE.
Definition thermostat.cpp:994
int getRandomCacheDepth() const
Get the random number cache depth. The quantity of random numbers that will be produced and cached fo...
Definition thermostat.cpp:490
void setRattleIterations(int rattle_iterations_in)
Set the maximum number of iterations to take when attempting to converge RATTLE bond length constrain...
Definition thermostat.cpp:999
void setLangevinCollisionFrequency(double langevin_frequency_in)
Set the collision frequency for the Langevin thermostat. This will also set the scaled form of the va...
Definition thermostat.cpp:958
int getFinalEvolutionStep() const
Get the step at which the temperature evolution is expected to be complete. This is the step when the...
Definition thermostat.cpp:500
double getInitialTemperature(int atom_index=0) const
Get the initial target temperature for this thermostat, in units of Kelvin.
Definition thermostat.cpp:556
int getRandomSeed() const
Get the random seed used to initialize Xoshiro256++ state vectors.
Definition thermostat.cpp:485
ApplyConstraints constrainGeometry() const
Get the order whether to apply geometric constraints.
Definition thermostat.cpp:622
void decrementStep()
Decrease the step count by one. This will cause the simulation's official step counter to backtrack.
Definition thermostat.cpp:984
void incrementStep()
Increase the step count by one. This will advance the simulation's official step counter.
Definition thermostat.cpp:979
void setTemperature(double initial_temperature_in, double final_temperature_in=-1.0)
Set the initial target temperature.
Definition thermostat.cpp:720
int getPartitionConstrainedDoF(int index=0) const
Get the number of constrained degrees of freedom for a particular partition of this thermostat.
Definition thermostat.cpp:585
double getFinalTemperature(int atom_index=0) const
Get the end-point target temperature for this thermostat, in units of Kelvin.
Definition thermostat.cpp:568
ThermostatPartition getBathPartitions() const
Indicate whether this thermostat applies a common target temperature to all atoms,...
Definition thermostat.cpp:465
void setCacheConfiguration(PrecisionModel cache_config_in, const GpuDetails &gpu=null_gpu)
Set the random number cache configuration.
Definition thermostat.cpp:939
void setAtomCount(int atom_count_in, int new_seed=-1, const GpuDetails &gpu=null_gpu)
Set the number of atoms for which the thermostat is responsible.
Definition thermostat.cpp:713
void setTimeStep(double time_step_in)
Set the time step. This will also set the scaled form of the value.
Definition thermostat.cpp:974
int getAtomCount() const
Get the total number of atoms that this thermostat can serve.
Definition thermostat.cpp:475
Tcalc getAtomTarget(int atom_index=0) const
Get the current target temperature for this thermostat, in units of Kelvin, for a specific atom.
void validateTemperature(double temperature_in)
Validate the initial or final target temperature.
Definition thermostat.cpp:1009
const ThermostatReader< double > dpData(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the abstract.
Definition thermostat.cpp:647
void setRandomCacheDepth(int depth_in, const GpuDetails &gpu=null_gpu)
Set the random number cache depth. This value is kept on a tight leash, as it can easily lead to allo...
Definition thermostat.cpp:946
int getAndersenResetFrequency() const
Get the Andersen reset frequency.
Definition thermostat.cpp:597
std::vector< int4 > getPartitionMap() const
Get the partition boundaries between different segments of the thermostat as a vector of integer tupl...
Definition thermostat.cpp:580
double getRattleTolerance() const
Get the convergence criterion for RATTLE bond length constraints.
Definition thermostat.cpp:627
void refresh(size_t index_start, size_t index_end, int refresh_depth=0)
Fill or refill the random number cache for a subset of the atoms, advancing the thermostat's random n...
Definition thermostat.cpp:1101
ThermostatKind getKind() const
Get the kind of thermostat.
Definition thermostat.cpp:460
ullint4 getGeneratorState(int atom_index, HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the generator state for a particular atom. For retrieving large numbers of states,...
Definition thermostat.cpp:505
void initializeRandomStates(int new_seed=default_thermostat_random_seed, int scrub_cycles=25, HybridTargetLevel tier=HybridTargetLevel::HOST, const GpuDetails &gpu=null_gpu)
Initialize the random state vectors of a thermostat, whether for Langevin or Andersen thermostating....
Definition thermostat.cpp:1046
void setSynthesisForceLoading(bool load_synthesis_forces_in=true)
Set the integrator to take prior force computations residing in the PhaseSpaceSynthesis into account....
Definition thermostat.cpp:1004
double getLangevinCollisionFrequency() const
Get the collision frequency for the Langevin thermostat (in units of femtoseconds).
Definition thermostat.cpp:602
int getPartitionFreeDoF(int index=0) const
Get the number of degrees of freedom for a particular partition of this thermostat,...
Definition thermostat.cpp:591
Thermostat(const Thermostat &original)=default
The default copy and move constructors and assignment operators are best for this object with no POIN...
void validateEvolutionWindow()
Validate the initial and final steps for applying the temperature evolution.
Definition thermostat.cpp:1017
std::vector< T > getTemperatureSpread(int step_number=0) const
Get the spread of temperature targets for all segments of the thermostat at a specific time step.
double getCachedRandomResult(int atom_index, int cache_row, HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get one of the cached random numbers. This function returns the result as a double-precision real,...
Definition thermostat.cpp:528
void validateRandomCacheDepth()
Validate the random number cache depth. A maxmimum cache depth of 15 (45 total random numbers per ato...
Definition thermostat.cpp:1027
double getLangevinExplicitFactor() const
Get the "explicit" Langevin factor, the portion of the velocity update to apply on the second half of...
Definition thermostat.cpp:612
int getStepNumber() const
Get the step number according to this thermostat. The thermostat will serve as an official reference ...
Definition thermostat.cpp:480
void setAndersenResetFrequency(int andersen_frequency_in)
Set the Andersen velocity reassignment frequency. This will be taken from user input.
Definition thermostat.cpp:953
Thermostat(ThermostatKind kind_in=ThermostatKind::NONE, PrecisionModel cache_config_in=PrecisionModel::SINGLE, int random_seed_in=default_thermostat_random_seed, const GpuDetails &gpu=null_gpu)
Constructors for the Thermostat object. Any information can be added via setter functions after const...
Definition thermostat.cpp:50
int getInitialEvolutionStep() const
Get the step at which to begin changing the temperature from its initial value T(init) to its final v...
Definition thermostat.cpp:495
double getTimeStep() const
Get the time step, in units of femtoseconds.
Definition thermostat.cpp:617
Tcalc getPartitionTarget(int index=0) const
Get the current target temperature for a specific partition within this thermostat,...
double getLangevinImplicitFactor() const
Get the "implicit" Langevin factor, the portion of the velocity update to apply immediately after for...
Definition thermostat.cpp:607
PrecisionModel getCacheConfiguration() const
Get the random number caching precision.
Definition thermostat.cpp:470
void checkCompartments(const AtomGraphSynthesis *poly_ag)
Check the compartmentalization if the thermostat regulates a synthesis of systems.
bool loadSynthesisForces() const
Get an indication of whether extra forces should be loaded from the synthesis in periodic systems.
Definition thermostat.cpp:637
void setEvolutionWindow(int init_step_in, int final_step_in)
Set the step at which temperature evolution, away from T(init), shall begin.
Definition thermostat.cpp:932
int getRattleIterations() const
Get the number of RATTLE iterations to attempt.
Definition thermostat.cpp:632
void setGeometryConstraints(ApplyConstraints cnst_geometry_in)
Set the instruction for carrying out geometric constraints during dynamics.
Definition thermostat.cpp:989
const Thermostat * getSelfPointer() const
Get a pointer to the object itself, useful if it has been passed to a function by.
Definition thermostat.cpp:642
Definition stormm_vector_types.h:33
ThermostatWriter(ThermostatKind kind_in, ThermostatPartition layout_in, int natom_in, size_t padded_natom_in, int npart_in, int step_in, int depth_in, int init_evolution_in, int end_evolution_in, T init_temperature_in, T final_temperature_in, T dt_in, bool csnt_geom_in, T rattle_tol_in, int rattle_iter_in, int andr_cyc_in, T gamma_ln_in, T ln_implicit_in, T ln_explicit_in, bool load_synthesis_forces_in, const int4 *partition_bounds_in, const T *init_temperatures_in, const T *final_temperatures_in, ullint2 *state_xy_in, ullint2 *state_zw_in, PrecisionModel rng_mode_in, double *cache_in, float *sp_cache_in)
The constructor takes the usual list of parent object attributes with pointers applicable on either t...
ThermostatReader(ThermostatKind kind_in, ThermostatPartition layout_in, int natom_in, size_t padded_natom_in, int npart_in, int step_in, int depth_in, int init_evolution_in, int end_evolution_in, T init_temperature_in, T final_temperature_in, T dt_in, bool csnt_geom_in, T rattle_tol_in, int rattle_iter_in, int andr_cyc_in, T gamma_ln_in, T ln_implicit_in, T ln_explicit_in, bool load_synthesis_forces_in, const int4 *partition_bounds_in, const T *init_temperatures_in, const T *final_temperatures_in, const ullint2 *state_xy_in, const ullint2 *state_zw_in, PrecisionModel rng_mode_in, const double *cache_in, const float *sp_cache_in)
The constructor takes the usual list of parent object attributes with pointers applicable on either t...
The writer for a PhaseSpaceSynthesis object, containing all of the data relevant for propagating dyna...
Definition phasespace_synthesis.h:87
Collect the virtual site details and constraint parameters of the topology synthesis into a single ab...
Definition synthesis_abstracts.h:257
Information on atoms and residues which may be useful for applying atom masks or identifying specific...
Definition atomgraph_abstracts.h:382
Collect constants and pointers to the components of a modifiable PhaseSpace object.
Definition phasespace.h:31
Read-only abstract for the Thermostat object.
Definition thermostat.h:135
const int npart
Definition thermostat.h:169
const T gamma_ln
Definition thermostat.h:194
const T rattle_tol
Convergence criterion for RATTLE bond length constraints.
Definition thermostat.h:188
const bool load_synthesis_forces
Definition thermostat.h:200
const int natom
Number of atoms controlled by this thermostat.
Definition thermostat.h:167
const int rattle_iter
Definition thermostat.h:189
const ThermostatKind kind
The type of this thermostat, i.e. Andersen.
Definition thermostat.h:164
const int init_evolution
Definition thermostat.h:176
const T * final_temperatures
Array of final target gemperatures for each atom.
Definition thermostat.h:206
const ullint2 * state_zw
Second 128 bits of each 256-bit state vector.
Definition thermostat.h:208
const int depth
Definition thermostat.h:173
const int step
Current step number of the simulation.
Definition thermostat.h:172
const double * cache
Definition thermostat.h:212
const T init_temperature
Definition thermostat.h:182
ThermostatReader(ThermostatKind kind_in, ThermostatPartition layout_in, int natom_in, size_t padded_natom_in, int npart_in, int step_in, int depth_in, int init_evolution_in, int end_evolution_in, T init_temperature_in, T final_temperature_in, T dt_in, bool csnt_geom_in, T rattle_tol_in, int rattle_iter_in, int andr_cyc_in, T gamma_ln_in, T ln_implicit_in, T ln_explicit_in, bool load_synthesis_forces_in, const int4 *partition_bounds_in, const T *init_temperatures_in, const T *final_temperatures_in, const ullint2 *state_xy_in, const ullint2 *state_zw_in, PrecisionModel rng_mode_in, const double *cache_in, const float *sp_cache_in)
The constructor takes the usual list of parent object attributes with pointers applicable on either t...
const T ln_implicit
Definition thermostat.h:196
const T dt
The time step, in units of femtoseconds.
Definition thermostat.h:186
ThermostatReader(const ThermostatReader &original)=default
The copy and move assignment operators will be implicitly deleted due to the presence of const member...
const T * init_temperatures
Array of initial target temperatures for each atom.
Definition thermostat.h:205
const int andr_cyc
Definition thermostat.h:191
const int end_evolution
Definition thermostat.h:180
const size_t padded_natom
The number of atoms padded by the warp size.
Definition thermostat.h:168
const T ln_explicit
Definition thermostat.h:198
const PrecisionModel rng_mode
Definition thermostat.h:209
const T final_temperature
Definition thermostat.h:184
const float * sp_cache
Definition thermostat.h:214
const int4 * partition_bounds
Definition thermostat.h:202
const bool cnst_geom
Indicate whether to apply geometry constraints.
Definition thermostat.h:187
const ThermostatPartition layout
Definition thermostat.h:165
const ullint2 * state_xy
First 128 bits of each 256-bit state vector.
Definition thermostat.h:207
Partially writeable abstract for the Thermostat object. As with the MMControlKit struct (see the libr...
Definition thermostat.h:58
const bool cnst_geom
Indicate whether to apply geometry constraints.
Definition thermostat.h:101
const size_t padded_natom
The number of atoms padded by the warp size.
Definition thermostat.h:83
const int depth
Definition thermostat.h:88
const T dt
The time step, in units of femtoseconds.
Definition thermostat.h:100
double * cache
Definition thermostat.h:128
int step
Current step number of the simulation.
Definition thermostat.h:87
const T gamma_ln
Definition thermostat.h:108
const bool load_synthesis_forces
Definition thermostat.h:116
const T * final_temperatures
Array of final target gemperatures for each atom.
Definition thermostat.h:122
const int rattle_iter
Definition thermostat.h:103
const T final_temperature
Final target temperature, common to all atoms.
Definition thermostat.h:99
const int4 * partition_bounds
Definition thermostat.h:118
const T rattle_tol
Convergence criterion for RATTLE bond length constraints.
Definition thermostat.h:102
ThermostatWriter(const ThermostatWriter &original)=default
The copy and move assignment operators will be implicitly deleted due to the presence of const member...
ThermostatWriter(ThermostatKind kind_in, ThermostatPartition layout_in, int natom_in, size_t padded_natom_in, int npart_in, int step_in, int depth_in, int init_evolution_in, int end_evolution_in, T init_temperature_in, T final_temperature_in, T dt_in, bool csnt_geom_in, T rattle_tol_in, int rattle_iter_in, int andr_cyc_in, T gamma_ln_in, T ln_implicit_in, T ln_explicit_in, bool load_synthesis_forces_in, const int4 *partition_bounds_in, const T *init_temperatures_in, const T *final_temperatures_in, ullint2 *state_xy_in, ullint2 *state_zw_in, PrecisionModel rng_mode_in, double *cache_in, float *sp_cache_in)
The constructor takes the usual list of parent object attributes with pointers applicable on either t...
ullint2 * state_xy
First 128 bits of each 256-bit state vector.
Definition thermostat.h:123
float * sp_cache
Definition thermostat.h:130
const T ln_explicit
Definition thermostat.h:114
const ThermostatPartition layout
Definition thermostat.h:80
const ThermostatKind kind
The type of this thermostat, i.e. Andersen.
Definition thermostat.h:79
const int end_evolution
Definition thermostat.h:95
const int natom
Number of atoms controlled by this thermostat.
Definition thermostat.h:82
ullint2 * state_zw
Second 128 bits of each 256-bit state vector.
Definition thermostat.h:124
const T * init_temperatures
Array of initial target temperatures for each atom.
Definition thermostat.h:121
const T ln_implicit
Definition thermostat.h:112
const int init_evolution
Definition thermostat.h:91
const PrecisionModel rng_mode
Definition thermostat.h:125
const T init_temperature
Definition thermostat.h:97
const int npart
Definition thermostat.h:84
const int andr_cyc
Definition thermostat.h:105