STORMM Source Documentation
Loading...
Searching...
No Matches
mdlmol_dataitem.h
1// -*-c++-*-
2#ifndef STORMM_MOLOBJ_DATAITEM_H
3#define STORMM_MOLOBJ_DATAITEM_H
4
5#include <string>
6#include <vector>
7#include "copyright.h"
8#include "Constants/behavior.h"
9#include "DataTypes/stormm_vector_types.h"
10#include "Parsing/textfile.h"
11#include "Potential/energy_enumerators.h"
12#include "molecule_format_enumerators.h"
13#include "mdlmol_request.h"
14
15namespace stormm {
16namespace structure {
17
18using constants::ExceptionResponse;
19using constants::ModificationPolicy;
20using parse::TextFile;
21
29public:
30
63 MdlMolDataItem(const std::string &item_name_in = std::string(""),
64 const std::string &external_regno_in = std::string(""),
65 int internal_regno_in = -1, int maccs_ii_number_in = -1, uint header_info = 0U,
66 const std::vector<std::string> &body_in = {},
67 ModificationPolicy mpol = ModificationPolicy::DO_NOT_MODIFY,
68 ExceptionResponse notify = ExceptionResponse::WARN);
69
70 MdlMolDataItem(const TextFile &tf, int line_number, int *line_advance,
71 int compound_line_end = -1, const std::string &title = std::string(""),
72 ModificationPolicy mpol = ModificationPolicy::DO_NOT_MODIFY,
73 ExceptionResponse notify = ExceptionResponse::WARN);
74
75 MdlMolDataItem(const MdlMolDataRequest &ask, const std::vector<std::string> &body_in,
76 ModificationPolicy mpol = ModificationPolicy::DO_NOT_MODIFY,
77 ExceptionResponse notify = ExceptionResponse::WARN);
79
83 MdlMolDataItem(const MdlMolDataItem &original) = default;
84 MdlMolDataItem(MdlMolDataItem &&original) = default;
85 MdlMolDataItem& operator=(const MdlMolDataItem &other) = default;
86 MdlMolDataItem& operator=(MdlMolDataItem &&other) = default;
88
91 bool placeInternalRegnoInHeader() const;
92
95 bool placeExternalRegnoInHeader() const;
96
99 bool placeTitleInHeader() const;
100
102 bool placeMaccsIIFieldInHeader() const;
103
105 bool noteArchivesInHeader() const;
106
109 const std::string& getItemName() const;
110
113 const std::string& getOutputItemName() const;
114
116 const std::string& getExternalRegistryNumber() const;
117
120 int getInternalRegistryNumber() const;
121
123 int getMaccsFieldNumber() const;
124
129 StateVariable getTrackedState() const;
130
132 int getDataLineCount() const;
133
137 const std::string& getDataLine(const int line_index) const;
138
140 const std::vector<std::string>& getBody() const;
141
144 MdlMolDataItemKind getKind() const;
145
161 std::string parseString(int element_number, int line_number) const;
162 std::string parseString(int start_pos, int length, int line_number) const;
164
168 llint parseInteger(int element_number, int line_number) const;
169 llint parseInteger(int start_pos, int length, int line_number) const;
171
175 ullint parseUnsigned(int element_number, int line_number) const;
176 ullint parseUnsigned(int start_pos, int length, int line_number) const;
178
182 double parseReal(int element_number, int line_number) const;
183 double parseReal(int start_pos, int length, int line_number) const;
185
189 char4 parseChar4(int element_number, int line_number) const;
190 char4 parseChar4(int start_pos, int length, int line_number) const;
192
199 bool matchItemName(const std::string &item_name_comp, const std::string &ext_regno_comp,
200 int maccs_ii_no_comp = -1) const;
201
202 bool matchItemName(const std::string &item_name_comp, int maccs_ii_no_comp = -1) const;
203
204 bool matchRegistryNumber(const std::string &ext_regno_comp, int maccs_ii_no_comp = -1) const;
205
206 bool matchMaccsField(int maccs_ii_no_comp) const;
208
215 void setItemName(const std::string &item_name_in,
216 ModificationPolicy mpol = ModificationPolicy::DO_NOT_MODIFY,
217 ExceptionResponse notify = ExceptionResponse::WARN);
218
223 void addDataLine(const std::string &text);
224
225private:
226 MdlMolDataItemKind kind;
230 StateVariable tracked_state;
233 std::string item_name;
235 std::string output_item_name;
237 std::string external_regno;
238 int internal_regno;
240 int maccs_ii_number;
241 bool use_internal_regno;
243 bool use_external_regno;
244 bool use_item_name;
245 bool use_maccs_ii_number;
247 bool note_archives;
248
250 std::vector<std::string> body;
251
253 void validateItemName(ModificationPolicy mpol = ModificationPolicy::DO_NOT_MODIFY,
254 ExceptionResponse notify = ExceptionResponse::WARN);
255};
256
271uint getDataItemHeaderCode(bool use_internal_regno = false, bool use_external_regno = false,
272 bool use_item_name = true, bool use_maccs_ii_field = false,
273 bool state_from_archives = false);
274
275uint getDataItemHeaderCode(const MdlMolDataRequest &ask);
277
278} // namespace structure
279} // namespace stormm
280
281#endif
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RA...
Definition textfile.h:45
int getInternalRegistryNumber() const
Get the internal registry number. This will return -1 if no such registry number exists.
Definition mdlmol_dataitem.cpp:257
int getDataLineCount() const
Get the data line count.
Definition mdlmol_dataitem.cpp:272
const std::vector< std::string > & getBody() const
Get all data lines.
Definition mdlmol_dataitem.cpp:286
void addDataLine(const std::string &text)
Add a line to the data item.
Definition mdlmol_dataitem.cpp:494
std::string parseString(int element_number, int line_number) const
Retrieve a string from the data lines of a data item, assuming that individual words on each line are...
Definition mdlmol_dataitem.cpp:296
MdlMolDataItem(const MdlMolDataItem &original)=default
The default copy and move constructors, as well as copy and move assignment operators,...
const std::string & getItemName() const
Get a const reference to the item name, if it exists. If there is no item name, a const reference to ...
Definition mdlmol_dataitem.cpp:242
llint parseInteger(int element_number, int line_number) const
Retrieve a signed integer from the data lines of a data item. The assumptions of parseString() above ...
Definition mdlmol_dataitem.cpp:341
bool placeTitleInHeader() const
Indicate whether to display the data item name (title) in the header line, between angular brackets.
Definition mdlmol_dataitem.cpp:227
bool placeMaccsIIFieldInHeader() const
Indicate whether to display the MACCS-II field number in the header.
Definition mdlmol_dataitem.cpp:232
int getMaccsFieldNumber() const
Get the MACCS-II database field number.
Definition mdlmol_dataitem.cpp:262
bool matchItemName(const std::string &item_name_comp, const std::string &ext_regno_comp, int maccs_ii_no_comp=-1) const
Match this data item with a series of identification tags.
Definition mdlmol_dataitem.cpp:459
bool placeExternalRegnoInHeader() const
Indicate whether to display the (user-supplied) external identification number in the header line.
Definition mdlmol_dataitem.cpp:222
double parseReal(int element_number, int line_number) const
Retrieve a real number from the data lines of a data item. The assumptions of parseString() above app...
Definition mdlmol_dataitem.cpp:398
bool placeInternalRegnoInHeader() const
Indicate whether to display the internal identification number (based on the position of the molecule...
Definition mdlmol_dataitem.cpp:217
ullint parseUnsigned(int element_number, int line_number) const
Retrieve an unsigned integer from the data lines of a data item. The assumptions of parseString() abo...
Definition mdlmol_dataitem.cpp:369
StateVariable getTrackedState() const
Get the state variable enumeration for this data item. This is used in the case of a STATE_VARIABLE k...
Definition mdlmol_dataitem.cpp:267
const std::string & getOutputItemName() const
Get a const reference to the output item name, if it exists. If there is no item name,...
Definition mdlmol_dataitem.cpp:247
bool noteArchivesInHeader() const
Indicate that the "FROM ARCHIVES" tag should go in the header line.
Definition mdlmol_dataitem.cpp:237
char4 parseChar4(int element_number, int line_number) const
Retrieve a tuple of four characters from the data lines of a data item. Assumptions from parseString(...
Definition mdlmol_dataitem.cpp:429
void setItemName(const std::string &item_name_in, ModificationPolicy mpol=ModificationPolicy::DO_NOT_MODIFY, ExceptionResponse notify=ExceptionResponse::WARN)
Set the item name and apply checks to the result.
Definition mdlmol_dataitem.cpp:487
const std::string & getDataLine(const int line_index) const
Get a particular data lines from the item body.
Definition mdlmol_dataitem.cpp:277
MdlMolDataItem(const std::string &item_name_in=std::string(""), const std::string &external_regno_in=std::string(""), int internal_regno_in=-1, int maccs_ii_number_in=-1, uint header_info=0U, const std::vector< std::string > &body_in={}, ModificationPolicy mpol=ModificationPolicy::DO_NOT_MODIFY, ExceptionResponse notify=ExceptionResponse::WARN)
The constructor takes the original text file and the number of the first line of the data item,...
Definition mdlmol_dataitem.cpp:19
const std::string & getExternalRegistryNumber() const
Get the external registry number.
Definition mdlmol_dataitem.cpp:252
MdlMolDataItemKind getKind() const
Get the custom data item type. Here, the "NATIVE" code indicates that no custom enumeration is presen...
Definition mdlmol_dataitem.cpp:291
A request for one of a sanctioned list of information types to be included in a data item of an SD fi...
Definition mdlmol_request.h:20
Definition stormm_vector_types.h:141