STORMM Source Documentation
Loading...
Searching...
No Matches
test_system_manager.h
1// -*-c++-*-
2#ifndef STORMM_TEST_SYSTEM_MANAGER_H
3#define STORMM_TEST_SYSTEM_MANAGER_H
4
5#include "copyright.h"
6#include <string>
7#include <vector>
8#include "Accelerator/gpu_details.h"
9#include "Constants/behavior.h"
10#include "Constants/fixed_precision.h"
11#include "Constants/scaling.h"
12#include "FileManagement/file_listing.h"
13#include "Math/rounding.h"
14#include "Namelists/nml_dynamics.h"
15#include "Numerics/split_fixed_precision.h"
16#include "Random/random.h"
17#include "Synthesis/atomgraph_synthesis.h"
18#include "Synthesis/condensate.h"
19#include "Synthesis/phasespace_synthesis.h"
20#include "Synthesis/systemcache.h"
21#include "Topology/atomgraph.h"
22#include "Topology/atomgraph_enumerators.h"
23#include "Trajectory/coordinateframe.h"
24#include "Trajectory/coordinate_series.h"
25#include "Trajectory/phasespace.h"
26#include "test_environment.h"
27
28namespace stormm {
29namespace testing {
30
31using card::GpuDetails;
32using constants::ExceptionResponse;
33using stmath::roundUp;
34using namelist::DynamicsControls;
35using numerics::hostDoubleToInt95;
36using numerics::hostSplitFPSum;
37using numerics::default_velocity_scale_bits;
38using numerics::default_force_scale_bits;
39using random::Xoshiro256ppGenerator;
40using synthesis::Condensate;
41using synthesis::AtomGraphSynthesis;
42using synthesis::PhaseSpaceSynthesis;
43using synthesis::PsSynthesisWriter;
44using synthesis::SystemCache;
45using topology::AtomGraph;
46using topology::UnitCellType;
47using trajectory::CoordinateFileKind;
48using trajectory::CoordinateFrame;
49using trajectory::CoordinateSeries;
50using trajectory::CoordinateSeriesWriter;
51using trajectory::PhaseSpace;
52
59public:
60
71
72 TestSystemManager(const std::string &topology_base_in, const std::string &topology_extn_in,
73 const std::vector<std::string> &topology_names_in,
74 const std::string &coordinate_base_in, const std::string &coordinate_extn_in,
75 const std::vector<std::string> &coordinate_names_in,
76 ExceptionResponse policy = ExceptionResponse::WARN,
77 TestPriority fault_response_in = TestPriority::ABORT,
78 TestPriority all_go_response_in = TestPriority::CRITICAL,
79 const DynamicsControls &dyncon = DynamicsControls());
80
81 TestSystemManager(const std::string &topology_base_in, const std::string &topology_extn_in,
82 const std::vector<std::string> &topology_names_in,
83 const std::string &coordinate_base_in, const std::string &coordinate_extn_in,
84 const std::vector<std::string> &coordinate_names_in,
85 const DynamicsControls &dyncon,
86 ExceptionResponse policy = ExceptionResponse::WARN);
87
88 TestSystemManager(const std::string &topology_base_in,
89 const std::vector<std::string> &topology_names_in,
90 const std::string &coordinate_base_in,
91 const std::vector<std::string> &coordinate_names_in,
92 ExceptionResponse policy = ExceptionResponse::WARN,
93 TestPriority fault_response_in = TestPriority::ABORT,
94 TestPriority all_go_response_in = TestPriority::CRITICAL,
95 const DynamicsControls &dyncon = DynamicsControls());
96
97 TestSystemManager(const std::string &topology_base_in,
98 const std::vector<std::string> &topology_names_in,
99 const std::string &coordinate_base_in,
100 const std::vector<std::string> &coordinate_names_in,
101 const DynamicsControls &dyncon,
102 ExceptionResponse policy = ExceptionResponse::WARN);
103
104 TestSystemManager(const std::vector<std::string> &topology_names_in,
105 const std::vector<std::string> &coordinate_names_in,
106 ExceptionResponse policy = ExceptionResponse::WARN,
107 TestPriority fault_response_in = TestPriority::ABORT,
108 TestPriority all_go_response_in = TestPriority::CRITICAL,
109 const DynamicsControls &dyncon = DynamicsControls());
110
111 TestSystemManager(const std::vector<std::string> &topology_names_in,
112 const std::vector<std::string> &coordinate_names_in,
113 const DynamicsControls &dyncon,
114 ExceptionResponse policy = ExceptionResponse::WARN);
116
125 int getSystemCount() const;
126 int getSystemCount(UnitCellType query_bc) const;
127 int getSystemCount(const std::vector<UnitCellType> &query_bc) const;
129
138 std::vector<int> getQualifyingSystems(UnitCellType uc_choice) const;
139 std::vector<int> getQualifyingSystems(const std::vector<UnitCellType> &uc_choice) const;
140 std::vector<int> getQualifyingSystems(int critical_atom_count, RelationalOperator rel) const;
142
144 std::string getTopologyBasePath() const;
145
147 std::string getCoordinateBasePath() const;
148
150 std::string getTopologyExtension() const;
151
153 std::string getCoordinateExtension() const;
154
156 std::string getTopologyFile(int index) const;
157
159 std::string getCoordinateFile(int index) const;
160
172 TestPriority getTestingStatus() const;
173 TestPriority getTestingStatus(int index) const;
174 TestPriority getTestingStatus(const std::vector<int> &indices) const;
176
180 CoordinateFrame exportCoordinateFrame(int index) const;
181
185 PhaseSpace exportPhaseSpace(int index) const;
186
190 AtomGraph exportAtomGraph(int index) const;
191
200 const PhaseSpace& viewCoordinates(int index);
201 const std::vector<PhaseSpace>& viewCoordinates();
203
212 const AtomGraph& getTopologyReference(int index) const;
213 const std::vector<AtomGraph>& getTopologyReference() const;
215
225 AtomGraph* getTopologyPointer(int index);
226 const AtomGraph* getTopologyPointer(int index) const;
227 std::vector<AtomGraph*> getTopologyPointer();
228 const std::vector<AtomGraph*> getTopologyPointer() const;
230
240 template <typename T>
241 CoordinateSeries<T> exportCoordinateSeries(const int base_system, int frame_count,
242 double perturbation_sigma = 0.0,
243 int xrs_seed = 915083, int scale_bits = 0) const;
244
262 PhaseSpaceSynthesis exportPhaseSpaceSynthesis(const std::vector<int> &index_key,
263 double perturbation_sigma = 0.0,
264 int xrs_seed = 7108262, int scale_bits = 40,
265 int vel_bits = default_velocity_scale_bits,
266 int frc_bits = default_force_scale_bits) const;
267 PhaseSpaceSynthesis exportPhaseSpaceSynthesis(UnitCellType uc_choice) const;
268 PhaseSpaceSynthesis exportPhaseSpaceSynthesis(const std::vector<UnitCellType> &uc_choice) const;
270
288 exportAtomGraphSynthesis(const std::vector<int> &index_key,
289 ExceptionResponse policy = ExceptionResponse::SILENT,
290 const GpuDetails &gpu = null_gpu) const;
291
293 exportAtomGraphSynthesis(UnitCellType uc_choice,
294 ExceptionResponse policy = ExceptionResponse::SILENT,
295 const GpuDetails &gpu = null_gpu) const;
296
298 exportAtomGraphSynthesis(const std::vector<UnitCellType> &uc_choice,
299 ExceptionResponse policy = ExceptionResponse::SILENT,
300 const GpuDetails &gpu = null_gpu) const;
302
319 SystemCache exportSystemCache(const std::vector<int> &index_key, const TestEnvironment &oe,
320 const std::vector<std::string> &x_name_list = {},
321 const std::vector<CoordinateFileKind> &x_type_list = {},
322 const std::vector<std::string> &r_name_list = {},
323 const std::vector<CoordinateFileKind> &r_type_list = {},
324 const std::vector<std::string> &label_list = {});
325
326 SystemCache exportSystemCache(const std::string &fnml);
328
329private:
330 int system_count;
331 std::string topology_base;
334 std::string topology_extn;
336 std::string coordinate_base;
337 std::string coordinate_extn;
338 TestPriority fault_response;
339 TestPriority all_go_response;
340 bool fault_found;
342
343 // Vectors of names and flags describing the file parsing
344 std::vector<std::string> topology_names;
345 std::vector<std::string> coordinate_names;
346 std::vector<bool> topology_exist;
347 std::vector<bool> topology_success;
348 std::vector<bool> coordinate_exist;
349 std::vector<bool> coordinate_success;
350 std::vector<bool> compatibility;
352
355 std::vector<AtomGraph> all_topologies;
356
359 std::vector<PhaseSpace> all_coordinates;
360
365 void checkIndexing(int index, const char* caller) const;
366};
367
368} // namespace testing
369} // namespace stormm
370
371#include "test_system_manager.tpp"
372
373#endif
Pertinent aspects of one particular GPU. Condensing the data for each GPU in this manner helps to ens...
Definition gpu_details.h:27
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
Simple but central struct to store the primitive form of the collection of systems that most STORMM a...
Definition systemcache.h:63
Object for parsing as well as storing environment and command-line input relevant to unit testing (Te...
Definition test_environment.h:21
std::string getCoordinateExtension() const
Return the extension for coordinates.
Definition test_system_manager.cpp:407
AtomGraphSynthesis exportAtomGraphSynthesis(const std::vector< int > &index_key, ExceptionResponse policy=ExceptionResponse::SILENT, const GpuDetails &gpu=null_gpu) const
Get a synthesis of topologies based on a series of system indices from the manager.
Definition test_system_manager.cpp:573
std::string getTopologyExtension() const
Return the extension for topologies.
Definition test_system_manager.cpp:402
AtomGraph exportAtomGraph(int index) const
Export the topology for one system.
Definition test_system_manager.cpp:458
TestSystemManager()
The constructor takes lists of topologies, then lists of coordinates, with a one-to-one correspondenc...
Definition test_system_manager.cpp:47
std::string getTopologyBasePath() const
Return the base path for topologies.
Definition test_system_manager.cpp:392
std::string getCoordinateFile(int index) const
Return the full name of a coordinate file according to some index in the list.
Definition test_system_manager.cpp:418
CoordinateSeries< T > exportCoordinateSeries(const int base_system, int frame_count, double perturbation_sigma=0.0, int xrs_seed=915083, int scale_bits=0) const
Get a coordinate series out of the object, based on one system from its repository.
CoordinateFrame exportCoordinateFrame(int index) const
Get a copy of the coordinates for one system as a CoordinateFrame object.
Definition test_system_manager.cpp:446
PhaseSpaceSynthesis exportPhaseSpaceSynthesis(const std::vector< int > &index_key, double perturbation_sigma=0.0, int xrs_seed=7108262, int scale_bits=40, int vel_bits=default_velocity_scale_bits, int frc_bits=default_force_scale_bits) const
Get a synthesis of coordinates with fixed-precision storage ready for positions, velocities,...
Definition test_system_manager.cpp:516
int getSystemCount() const
Get the number of systems in the object.
Definition test_system_manager.cpp:277
TestPriority getTestingStatus() const
Get the planned course of action for subsequent tests in the event that a file is non-existent,...
Definition test_system_manager.cpp:424
const AtomGraph & getTopologyReference(int index) const
Get a const reference to the topology for one or more systems.
Definition test_system_manager.cpp:475
std::string getTopologyFile(int index) const
Return the full name of a topology file according to some index in the list.
Definition test_system_manager.cpp:412
AtomGraph * getTopologyPointer(int index)
Get a pointer to one or more topologies.
Definition test_system_manager.cpp:486
SystemCache exportSystemCache(const std::vector< int > &index_key, const TestEnvironment &oe, const std::vector< std::string > &x_name_list={}, const std::vector< CoordinateFileKind > &x_type_list={}, const std::vector< std::string > &r_name_list={}, const std::vector< CoordinateFileKind > &r_type_list={}, const std::vector< std::string > &label_list={})
Produce a SystemCache based on a compilation of the systems read into the manager.
Definition test_system_manager.cpp:607
PhaseSpace exportPhaseSpace(int index) const
Get a copy of the coordinates for one system as a PhaseSpace object.
Definition test_system_manager.cpp:452
std::vector< int > getQualifyingSystems(UnitCellType uc_choice) const
Get a list of all topologies meeting a specific unit cell type.
Definition test_system_manager.cpp:310
const PhaseSpace & viewCoordinates(int index)
Get a const reference to the coordinates for one or more systems.
Definition test_system_manager.cpp:464
std::string getCoordinateBasePath() const
Return the base path for coordinates.
Definition test_system_manager.cpp:397
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
Store the coordinates and box information for a frame, only. This abridged struct can serve when the ...
Definition coordinateframe.h:111
Store the coordinates and box information for a series of frames, in one of several levels of precisi...
Definition coordinate_series.h:137
An object to complement a topology and hold positions, velocities, and forces of all particles in a s...
Definition phasespace.h:141