2#ifndef STORMM_WATCHER_H
3#define STORMM_WATCHER_H
6#include "Accelerator/hybrid.h"
7#include "Constants/behavior.h"
8#include "DataTypes/stormm_vector_types.h"
9#include "Synthesis/atomgraph_synthesis.h"
10#include "Synthesis/phasespace_synthesis.h"
16using card::HybridTargetLevel;
17using constants::ExceptionResponse;
18using synthesis::AtomGraphSynthesis;
19using synthesis::PhaseSpaceSynthesis;
22constexpr int default_max_watcher_reports = 1000;
25constexpr int default_watcher_force_threshold = 128.0;
28constexpr int default_watcher_speed_threshold = 1.0;
32constexpr float minimum_force_threshold = 1.0;
36constexpr float minimum_speed_threshold = 1.0;
45 WatcherWriter(
int nsystem_in,
int max_reports_in,
float force_limit_in,
float speed_limit_in,
46 bool track_purge_in,
int* nforce_in,
int* nspeed_in,
int* nrattle_in,
47 int* nshake_in,
float4* forces_in,
int* force_steps_in,
int* force_stages_in,
48 float4* speeds_in,
int* speed_steps_in,
int* speed_stages_in,
49 uint2* rattle_fails_in,
uint2* shake_fails_in,
float* rattle_ext_in,
50 float* shake_ext_in,
float* xvel_purge_in,
float* yvel_purge_in,
51 float* zvel_purge_in,
float* xang_purge_in,
float* yang_purge_in,
52 float* zang_purge_in);
113 WatcherReader(
int nsystem_in,
int max_reports_in,
float force_limit_in,
float speed_limit_in,
114 bool track_purge_in,
const int* nforce_in,
const int* nspeed_in,
115 const int* nrattle_in,
const int* nshake_in,
const float4* forces_in,
116 const int* force_steps_in,
const int* force_stages_in,
const float4* speeds_in,
117 const int* speed_steps_in,
const int* speed_stages_in,
118 const uint2* rattle_fails_in,
const uint2* shake_fails_in,
119 const float* rattle_ext_in,
const float* shake_ext_in,
const float* xvel_purge_in,
120 const float* yvel_purge_in,
const float* zvel_purge_in,
const float* xang_purge_in,
121 const float* yang_purge_in,
const float* zang_purge_in);
189 float force_threshold_in = default_watcher_force_threshold,
190 float speed_threshold_in = default_watcher_speed_threshold,
191 bool track_momentum_purge_in =
false,
int max_reports_in = default_max_watcher_reports,
192 ExceptionResponse policy_in = ExceptionResponse::WARN);
195 float force_threshold_in = default_watcher_force_threshold,
196 float speed_threshold_in = default_watcher_speed_threshold,
197 bool track_momentum_purge_in =
false,
int max_reports_in = default_max_watcher_reports,
198 ExceptionResponse policy_in = ExceptionResponse::WARN);
232 std::vector<float4>
getLargeForces(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
238 std::vector<int>
getLargeForceSteps(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
246 std::vector<DynamicsStepStage>
261 std::vector<float4>
getHighSpeeds(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
267 std::vector<int>
getHighSpeedSteps(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
273 std::vector<DynamicsStepStage>
294 std::vector<uint2>
getRattleFailures(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
301 std::vector<uint2>
getShakeFailures(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
308 std::vector<float>
getRattleViolations(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
315 std::vector<float>
getShakeViolations(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
325 const WatcherReader data(HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
344 ExceptionResponse policy;
349 float force_threshold;
363 float speed_threshold;
399 bool track_momentum_purge;
432 void validateForceThreshold()
const;
435 void validateSpeedThreshold()
const;
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
const WatcherReader data(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the object's abstract.
Definition watcher.cpp:488
void setForceThreshold(float force_threshold_in)
Set the threshold at which the object will report large forces.
Definition watcher.cpp:520
int getLargeForceCount(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the number of large forces on atoms found throughout the simulation.
Definition watcher.cpp:277
std::vector< uint2 > getRattleFailures(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the list of RATTLE violations–group IDs in the "x" member of the tuple (as listed in the associat...
Definition watcher.cpp:432
std::vector< float > getShakeViolations(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the violation of a constraint which failed to converge, or the maximum violation of any constrain...
Definition watcher.cpp:474
int getSystemCount() const
Get the number of systems from the associated coordinate synthesis.
Definition watcher.cpp:267
std::vector< int > getHighSpeedSteps(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the list of step counts at which each high velocity in the list of all high veloicities was obser...
Definition watcher.cpp:371
int getFailedShakeCount(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the number of times the SHAKE constraint iteration limit was reached (without the requested conve...
Definition watcher.cpp:419
float getForceThreshold() const
Get the threshold at which the object will report large forces on atoms.
Definition watcher.cpp:272
std::vector< float4 > getLargeForces(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the list of large forces observed over the course of simulations on a set of systems.
Definition watcher.cpp:290
int getHighSpeedCount(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the number of high velocities encountered in the simulation.
Definition watcher.cpp:344
std::vector< int > getLargeForceSteps(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the list of step counts at which each large force in the list of all large forces was observed.
Definition watcher.cpp:304
std::vector< float4 > getHighSpeeds(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the list of high velocities observed over the course of simulations on a set of systems.
Definition watcher.cpp:357
int getFailedRattleCount(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the number of times the RATTLE constraint iteration limit was reached (without the requested conv...
Definition watcher.cpp:406
void setSpeedThreshold(float speed_threshold_in)
Set the threshold at which the object will report high particle speeds.
Definition watcher.cpp:526
Watcher(const PhaseSpaceSynthesis *poly_ps, const AtomGraphSynthesis &poly_ag, float force_threshold_in=default_watcher_force_threshold, float speed_threshold_in=default_watcher_speed_threshold, bool track_momentum_purge_in=false, int max_reports_in=default_max_watcher_reports, ExceptionResponse policy_in=ExceptionResponse::WARN)
The constructor requires a coordinate synthesis in order to allocate the proper amount of space for t...
Definition watcher.cpp:66
std::vector< DynamicsStepStage > getLargeForceStages(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the points in the integration cycle at which each of the large forces were observed....
Definition watcher.cpp:318
int getReportCount() const
Get the maximum number of reports that the object is designed to hold.
Definition watcher.cpp:262
std::vector< DynamicsStepStage > getHighSpeedStages(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the points in the integration cycle at which each high particle velocity was found.
Definition watcher.cpp:385
float getSpeedThreshold() const
Get the threshold at which the object will report large velocities on atoms.
Definition watcher.cpp:339
std::vector< float > getRattleViolations(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the violation of a constraint which failed to converge, or the maximum violation of any constrain...
Definition watcher.cpp:460
std::vector< uint2 > getShakeFailures(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the list of SHAKE violations–group IDs in the "x" member of the tuple (as listed in the associate...
Definition watcher.cpp:446
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
Definition stormm_vector_types.h:69
Definition stormm_vector_types.h:40
The read-only abstract for the Watcher class is available to make reports out of a Watcher object pas...
Definition watcher.h:107
const int * speed_stages
Definition watcher.h:159
const float * zang_purge
Angular momentum purges about the Z axis for each system.
Definition watcher.h:174
const float * xang_purge
Angular momentum purges about the X axis for each system.
Definition watcher.h:172
const float4 * forces
Cartesian components and atom indices of large forces.
Definition watcher.h:152
const float * yvel_purge
A compendium of Cartesian Y velocity purges for each system.
Definition watcher.h:170
WatcherReader(const WatcherReader &original)=default
Like most abstracts, the presence of const members makes copy and move assignment impossible except i...
const float speed_limit
Definition watcher.h:139
const int * force_steps
Steps on which each large force is observed.
Definition watcher.h:153
WatcherReader(int nsystem_in, int max_reports_in, float force_limit_in, float speed_limit_in, bool track_purge_in, const int *nforce_in, const int *nspeed_in, const int *nrattle_in, const int *nshake_in, const float4 *forces_in, const int *force_steps_in, const int *force_stages_in, const float4 *speeds_in, const int *speed_steps_in, const int *speed_stages_in, const uint2 *rattle_fails_in, const uint2 *shake_fails_in, const float *rattle_ext_in, const float *shake_ext_in, const float *xvel_purge_in, const float *yvel_purge_in, const float *zvel_purge_in, const float *xang_purge_in, const float *yang_purge_in, const float *zang_purge_in)
As with other abstracts, the constructor takes a list of all relevant pointers and critical constants...
Definition watcher.cpp:33
const float4 * speeds
Definition watcher.h:156
const int * force_stages
Definition watcher.h:154
const float * shake_ext
The extent to which each SHAKE group failed to converge.
Definition watcher.h:165
const int nsystem
The number of systems tracked by the Watcher object.
Definition watcher.h:136
const int * speed_steps
Steps on which each high speed is observed.
Definition watcher.h:158
const int * nforce
The number of forces observed to violate the stated bounds.
Definition watcher.h:145
const uint2 * rattle_fails
Details of RATTLE group convergence failures.
Definition watcher.h:161
const float * yang_purge
Angular momentum purges about the Y axis for each system.
Definition watcher.h:173
const int * nspeed
Definition watcher.h:146
const int max_reports
The maximum number of reports to present in any given category.
Definition watcher.h:137
const float * xvel_purge
Definition watcher.h:166
const int * nshake
Definition watcher.h:150
const float force_limit
The largest force (magnitude) that will not be reported.
Definition watcher.h:138
const float * zvel_purge
A compendium of Cartesian Z velocity purges for each system.
Definition watcher.h:171
const int * nrattle
Definition watcher.h:148
const float * rattle_ext
Definition watcher.h:163
const uint2 * shake_fails
Details of SHAKE group convergence failures.
Definition watcher.h:162
const bool track_purge
Definition watcher.h:141
The writeable abstract for a Watcher class will be provided as a formal argument to various molecular...
Definition watcher.h:40
float4 * speeds
Definition watcher.h:84
int * nshake
Definition watcher.h:78
const float force_limit
The largest force (magnitude) that will not be reported.
Definition watcher.h:66
WatcherWriter(int nsystem_in, int max_reports_in, float force_limit_in, float speed_limit_in, bool track_purge_in, int *nforce_in, int *nspeed_in, int *nrattle_in, int *nshake_in, float4 *forces_in, int *force_steps_in, int *force_stages_in, float4 *speeds_in, int *speed_steps_in, int *speed_stages_in, uint2 *rattle_fails_in, uint2 *shake_fails_in, float *rattle_ext_in, float *shake_ext_in, float *xvel_purge_in, float *yvel_purge_in, float *zvel_purge_in, float *xang_purge_in, float *yang_purge_in, float *zang_purge_in)
As with other abstracts, the constructor takes a list of all relevant pointers and critical constants...
Definition watcher.cpp:14
int * force_stages
Definition watcher.h:82
int * speed_stages
Definition watcher.h:87
float * shake_ext
The extent to which each SHAKE group failed to converge.
Definition watcher.h:93
int * force_steps
Steps on which each large force is observed.
Definition watcher.h:81
float * xvel_purge
Definition watcher.h:94
float * yvel_purge
A compendium of Cartesian Y velocity purges for each system.
Definition watcher.h:98
const int nsystem
The number of systems tracked by the Watcher object.
Definition watcher.h:64
int * nspeed
Definition watcher.h:74
int * nrattle
Definition watcher.h:76
WatcherWriter(const WatcherWriter &original)=default
Like most abstracts, the presence of const members makes copy and move assignment impossible except i...
float * zang_purge
Angular momentum purges about the Z axis for each system.
Definition watcher.h:102
float * zvel_purge
A compendium of Cartesian Z velocity purges for each system.
Definition watcher.h:99
uint2 * shake_fails
Details of SHAKE group convergence failures.
Definition watcher.h:90
int * nforce
The number of forces observed to violate the stated bounds.
Definition watcher.h:73
float4 * forces
Cartesian components and atom indices of large forces.
Definition watcher.h:80
const int max_reports
The maximum number of reports to present in any given category.
Definition watcher.h:65
const bool track_purge
Definition watcher.h:69
float * xang_purge
Angular momentum purges about the X axis for each system.
Definition watcher.h:100
uint2 * rattle_fails
Details of RATTLE group convergence failures.
Definition watcher.h:89
float * rattle_ext
Definition watcher.h:91
const float speed_limit
Definition watcher.h:67
float * yang_purge
Angular momentum purges about the Y axis for each system.
Definition watcher.h:101
int * speed_steps
Steps on which each high speed is observed.
Definition watcher.h:86