2#ifndef STORMM_SYSTEM_PREP_H
3#define STORMM_SYSTEM_PREP_H
7#include "Accelerator/gpu_details.h"
8#include "Chemistry/chemical_features.h"
9#include "Chemistry/chemistry_enumerators.h"
10#include "Constants/behavior.h"
11#include "Constants/fixed_precision.h"
12#include "FileManagement/file_enumerators.h"
13#include "MoleculeFormat/mdlmol.h"
14#include "Namelists/nml_dynamics.h"
15#include "Namelists/nml_files.h"
16#include "Namelists/nml_restraint.h"
17#include "Potential/forward_exclusionmask.h"
18#include "Potential/static_exclusionmask.h"
19#include "Restraints/restraint_apparatus.h"
20#include "Topology/atomgraph.h"
21#include "Trajectory/coordinateframe.h"
22#include "Trajectory/phasespace.h"
23#include "Trajectory/trajectory_enumerators.h"
24#include "UnitTesting/stopwatch.h"
25#include "atomgraph_synthesis.h"
26#include "phasespace_synthesis.h"
27#include "static_mask_synthesis.h"
32using card::GpuDetails;
33using chemistry::ChemicalFeatures;
34using chemistry::MapRotatableGroups;
35using constants::ExceptionResponse;
36using diskutil::PrintSituation;
37using energy::ForwardExclusionMask;
38using energy::StaticExclusionMask;
39using namelist::DynamicsControls;
40using namelist::FilesControls;
41using namelist::RestraintControls;
42using numerics::default_globalpos_scale_bits;
43using numerics::default_velocity_scale_bits;
44using numerics::default_force_scale_bits;
45using restraints::RestraintApparatus;
46using structure::MdlMol;
47using testing::StopWatch;
48using topology::AtomGraph;
49using trajectory::CoordinateFileKind;
50using trajectory::CoordinateFileRole;
51using trajectory::CoordinateFrame;
52using trajectory::CoordinateFrameReader;
53using trajectory::CoordinateFrameWriter;
54using trajectory::detectCoordinateFileKind;
55using trajectory::PhaseSpace;
56using trajectory::TrajectoryFusion;
84 SystemCache(ExceptionResponse policy_in = ExceptionResponse::DIE,
85 MapRotatableGroups map_chemfe_rotators = MapRotatableGroups::NO,
86 PrintSituation expectation_in = PrintSituation::OPEN_NEW);
89 const DynamicsControls &dyncon, ExceptionResponse policy_in = ExceptionResponse::DIE,
90 MapRotatableGroups map_chemfe_rotators = MapRotatableGroups::NO,
91 PrintSituation expectation_in = PrintSituation::OPEN_NEW,
95 ExceptionResponse policy_in = ExceptionResponse::DIE,
96 MapRotatableGroups map_chemfe_rotators = MapRotatableGroups::NO,
97 PrintSituation expectation_in = PrintSituation::OPEN_NEW,
101 MapRotatableGroups map_chemfe_rotators = MapRotatableGroups::NO,
102 PrintSituation expectation_in = PrintSituation::OPEN_NEW,
208 const std::string&
getLabel(
int label_index)
const;
241 const std::string &query_label)
const;
244 const std::string &query_label)
const;
268 ExceptionResponse xcpt = ExceptionResponse::DIE)
const;
271 ExceptionResponse xcpt = ExceptionResponse::DIE)
const;
274 ExceptionResponse xcpt = ExceptionResponse::DIE)
const;
309 const ExceptionResponse policy = ExceptionResponse::DIE)
const;
342 int velocity_scale_bits = default_velocity_scale_bits,
343 int force_scale_bits = default_force_scale_bits)
const;
504 const std::string &query_label)
const;
506 const std::string &query_label)
const;
528 const std::string &query_label)
const;
530 const std::string &query_label)
const;
563 const std::string &query_label)
const;
565 const std::string &query_label)
const;
583 const std::string &query_label)
const;
585 const std::string &query_label)
const;
603 const std::string &query_label)
const;
605 const std::string &query_label)
const;
650 ExceptionResponse policy;
658 PrintSituation expectation;
679 TrajectoryFusion file_merger_protocol;
683 std::vector<AtomGraph> topology_cache;
687 std::vector<PhaseSpace> coordinates_cache;
690 std::vector<MdlMol> sdf_cache;
693 std::vector<std::string> label_cache;
696 std::vector<ChemicalFeatures> features_cache;
699 std::vector<RestraintApparatus> restraints_cache;
702 std::vector<StaticExclusionMask> static_masks_cache;
705 std::vector<ForwardExclusionMask> forward_masks_cache;
710 std::vector<int> topology_indices;
713 std::vector<int> label_indices;
716 std::vector<int> label_degeneracy;
721 std::vector<int> restraint_indices;
725 std::vector<int> example_indices;
731 std::vector<int> topology_cases;
734 std::vector<int> topology_case_bounds;
737 std::vector<std::string> system_input_coordinate_names;
740 std::vector<std::string> system_trajectory_names;
743 std::vector<std::string> system_checkpoint_names;
746 std::vector<std::string> system_labels;
750 std::vector<int> trajectory_subindices;
753 std::vector<int> trajectory_degeneracy;
757 std::vector<int> checkpoint_subindices;
760 std::vector<int> checkpoint_degeneracy;
764 std::vector<int> label_cases;
767 std::vector<int> label_case_bounds;
770 std::vector<CoordinateFileKind> system_input_coordinate_kinds;
773 std::vector<CoordinateFileKind> system_trajectory_kinds;
776 std::vector<CoordinateFileKind> system_checkpoint_kinds;
782 void checkSystemBounds(
int index,
const char* caller)
const;
788 void checkTopologyBounds(
int index,
const char* caller)
const;
794 void checkLabelBounds(
int index,
const char* caller)
const;
807 bool determineFileMerger(CoordinateFileRole purpose,
int system_index)
const;
825 std::string nondegenerateName(
const std::string &fname_in, CoordinateFileRole purpose,
826 int system_index)
const;
839void extendTopologyList(std::vector<AtomGraph> *list,
const std::string &fname,
841 ExceptionResponse policy = ExceptionResponse::DIE,
842 const std::string &caller = std::string(
""));
866 const std::vector<int> &cached_system_indices);
Pertinent aspects of one particular GPU. Condensing the data for each GPU in this manner helps to ens...
Definition gpu_details.h:27
An object to store information about chemical motifs: participation in rings, planarity,...
Definition chemical_features.h:400
This exclusion mask relies on the reality that, in most topologies, the bulk of one atom's exclusions...
Definition forward_exclusionmask.h:43
A simple pair list for an all-to-all calculation with exclusion masks. The list stores masks for 16 x...
Definition static_exclusionmask.h:81
SystemCache(ExceptionResponse policy_in=ExceptionResponse::DIE, MapRotatableGroups map_chemfe_rotators=MapRotatableGroups::NO, PrintSituation expectation_in=PrintSituation::OPEN_NEW)
The constructor takes the output of &files namelist reading, perhaps with some additional command-lin...
Definition systemcache.cpp:57
Object to encapsulate molecular dynamics control information. Like other namelist encapsualtors,...
Definition nml_dynamics.h:123
Distill the results of file identification, producing clean lists of free topologies,...
Definition nml_files.h:229
A collection of all restraints pertaining to a specific topology for the purposes of one simulation,...
Definition restraint_apparatus.h:109
A molecular three-dimensional feature. This special class of MOL object properies has its own data li...
Definition mdlmol.h:101
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
An exclusion mask object for a compilation of systems. All systems are represented in full detail,...
Definition static_mask_synthesis.h:54
Simple but central struct to store the primitive form of the collection of systems that most STORMM a...
Definition systemcache.h:63
const StaticExclusionMask * getSystemStaticMaskPointer(int index) const
Get a pointer to the static exclusion mask for a particular system. These masks will only have been c...
Definition systemcache.cpp:1677
SystemCache(const SystemCache &original)=default
The default copy and move constructors, copy and move assignment operators will be effective for this...
int getTopologyCacheIndex(const AtomGraph *ag) const
Match a topology to one in the cache. If no match is found, the function will return the number of to...
Definition systemcache.cpp:1168
const std::vector< StaticExclusionMask * > getUniqueStaticMaskPointers() const
Get a vector of all unique static exclusion masks in the system cache, ordered as they appear in the ...
Definition systemcache.cpp:1659
const MdlMol * getStructureDataEntryPointer(int index) const
Get a pointer to one of the MDL MOL objects in the cache.
Definition systemcache.cpp:1545
CoordinateFileKind getTrajectoryKind(const int system_index) const
Get the coordinate file type associated with a particular system's trajectory.
Definition systemcache.cpp:1853
void setTrajectoryFusionProtocol(TrajectoryFusion file_merger_protocol_in)
Set the trajectory fusion protocol.
Definition systemcache.cpp:1962
const SystemCache * getSelfPointer() const
Get a const pointer to the object itself.
Definition systemcache.cpp:1947
const StaticExclusionMask & getSystemStaticMask(int index) const
Get a reference to the static exclusion mask for a particular system. These masks will only have been...
Definition systemcache.cpp:1691
int getSystemLabelIndex(int system_index) const
Get the index of the cached label associated with a particular system in the cache.
Definition systemcache.cpp:1809
const std::string & getLabel(int label_index) const
Get a label from the cache by the numerical index in which it appears in the list of all labels.
Definition systemcache.cpp:1232
const ChemicalFeatures * getFeaturesPointer(int index) const
Get a pointer to the chemical features for a particular system in the cache.
Definition systemcache.cpp:1587
AtomGraphSynthesis exportTopologySynthesis(const GpuDetails &gpu=null_gpu, const ExceptionResponse policy=ExceptionResponse::DIE) const
Return a synthesis of the topologies in the cache, laid out as appropriate for all systems including ...
Definition systemcache.cpp:1482
const AtomGraph * getSystemTopologyPointer(int index) const
Get a pointer to a topology in the cache associated with a particular coordinate set.
Definition systemcache.cpp:1441
const std::vector< AtomGraph * > getTopologiesMatchingLabel(const std::string &query_label) const
Get a list of topologies associated with a particular label. This will return a vector of pointers to...
Definition systemcache.cpp:1196
int getTopologyCount() const
Get the number of topologies.
Definition systemcache.cpp:1095
int getSystemExampleIndex(int topology_index) const
Get the index of a coordinate set which provides an example of the system that one of the topologies ...
Definition systemcache.cpp:1125
PrintSituation getPrintingProtocol() const
When multiple systems' coordinates are to be combined into a particular file, the file may be opened ...
Definition systemcache.cpp:1919
const RestraintApparatus & getRestraints(int index) const
Get a reference to the restraint apparatus for a particular system.
Definition systemcache.cpp:1653
std::vector< int > getMatchingSystemIndices(const AtomGraph *query_ag, const std::string &query_label) const
Return the indices of all systems from within the cache, matching a particular topology and / or a la...
Definition systemcache.cpp:1271
const AtomGraph & getSystemTopology(int index) const
Return a reference to the topology that describes a particular set of coordinates within the SystemCa...
Definition systemcache.cpp:1476
PhaseSpaceSynthesis exportCoordinateSynthesis(int globalpos_scale_bits=default_globalpos_scale_bits, int velocity_scale_bits=default_velocity_scale_bits, int force_scale_bits=default_force_scale_bits) const
Create and return a coordinate synthesis based on entries in the cache.
Definition systemcache.cpp:1537
TrajectoryFusion getTrajectoryFusionProtocol() const
Get the trajectory fusion protocol.
Definition systemcache.cpp:1957
int getTopologyCaseCount(int topology_index) const
Get the number of systems described by a topology of the given index in this cache.
Definition systemcache.cpp:1719
void setPrintingProtocol(const PrintSituation expectation_in)
Set the printing protocol.
Definition systemcache.cpp:1952
const RestraintApparatus * getRestraintPointer(int index) const
Get a pointer to the restraint apparatus for a particular system.
Definition systemcache.cpp:1623
const ForwardExclusionMask * getSystemForwardMaskPointer(int index) const
Get a pointer to the forward exclusion mask for a particular system. These masks will only have been ...
Definition systemcache.cpp:1698
std::vector< std::string > getLabelsMatchingTopology(const AtomGraph *query_ag) const
Get a list of labels associated with a particular topology. This will return copies of each label str...
Definition systemcache.cpp:1238
CoordinateFileKind getInputCoordinatesKind(const int system_index) const
Get the coordinate file type associated with a particular system's input. Raise an error if the syste...
Definition systemcache.cpp:1820
const PhaseSpace & getCoordinates(int index) const
Return a reference to a set of coordinates, velocities, and forces in the cache.
Definition systemcache.cpp:1526
int getFirstMatchingSystemIndex(const AtomGraph *query_ag, ExceptionResponse xcpt=ExceptionResponse::DIE) const
Get the index of the first system matching the topology and / or system label.
Definition systemcache.cpp:1361
const PhaseSpace * getCoordinatePointer(int index) const
Get a pointer to a set of coordinates, velocities, and forces in the cache.
Definition systemcache.cpp:1490
int getSystemTopologyIndex(int coord_index) const
Get the topology index of one of the coordinate sets contained in this cache. This will apply a bound...
Definition systemcache.cpp:1110
const std::string & getSystemLabel(int system_index) const
Get the label associated with a particular system in the cache.
Definition systemcache.cpp:1814
int getLabelCount() const
Get the number of unique labels across all systems.
Definition systemcache.cpp:1100
const MdlMol & getStructureDataEntry(int index) const
Return a reference to one of the MDL MOL entries in the cache.
Definition systemcache.cpp:1576
const AtomGraph * getTopologyPointer(int topology_index) const
Get pointers to one or all of the unique topologies from within the compact topology cache.
Definition systemcache.cpp:1130
int getLabelCacheIndex(const std::string &query) const
Get the index of a particular string label within the cache. The index is found by a deep match to th...
Definition systemcache.cpp:1261
int getSystemCount() const
Get the number of systems.
Definition systemcache.cpp:1090
std::string getTrajectoryName(int system_index) const
Get the name of the trajectory file associated with one of the systems. The name will be manipulated ...
Definition systemcache.cpp:1741
int getRestraintCount() const
Get the number of different restraint apparatuses. Many restraint apparatuses may be unique in the se...
Definition systemcache.cpp:1105
const ChemicalFeatures & getFeatures(int index) const
Get a reference to the chemical features for a particular system in the cache.
Definition systemcache.cpp:1617
const ForwardExclusionMask & getSystemForwardMask(int index) const
Get a reference to the forward exclusion mask for a particular system. These masks will only have bee...
Definition systemcache.cpp:1712
const AtomGraph & getTopology(int topology_index) const
Get a reference to one of the unique topologies from within the topology cache, based on an index int...
Definition systemcache.cpp:1162
std::string getCheckpointName(int system_index) const
Get the name of the checkpoint (restart) file associated with one of the systems. This name will also...
Definition systemcache.cpp:1775
const std::string & getInputCoordinatesName(int system_index) const
Get the input coordinate file name for a particular system. This is not subject to manipulations to d...
Definition systemcache.cpp:1735
SystemCache(ExceptionResponse policy_in=ExceptionResponse::DIE, MapRotatableGroups map_chemfe_rotators=MapRotatableGroups::NO, PrintSituation expectation_in=PrintSituation::OPEN_NEW)
The constructor takes the output of &files namelist reading, perhaps with some additional command-lin...
Definition systemcache.cpp:57
std::vector< int > getTopologicalCases(int topology_index) const
Get a list of indices for all systems in the cache described by the topology of interest.
Definition systemcache.cpp:1724
CoordinateFileKind getCheckpointKind(const int system_index) const
Get the coordinate file type associated with a particular system's checkpoint file.
Definition systemcache.cpp:1886
Object for managing calls to the C-standard function gettimeofday(), calculating deltas and categoriz...
Definition stopwatch.h:23
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
An object to complement a topology and hold positions, velocities, and forces of all particles in a s...
Definition phasespace.h:141