STORMM Source Documentation
Loading...
Searching...
No Matches
stormm::structure::MdlMolDataItem Class Reference

Store a data item from within an SD file. Data items begin with a line of the form "> <ITEM_NAME>" (additional specifications are possible), end with a single blank line, and can contain customized format information. The information will be read as a series of raw strings, one per line and each representing a whole line. Once read, member functions of the class can extract specific integer, real, char4, or string coded data from within the item. More...

#include <mdlmol_dataitem.h>

Public Member Functions

bool placeInternalRegnoInHeader () const
 Indicate whether to display the internal identification number (based on the position of the molecule in the SD file) in the header line.
 
bool placeExternalRegnoInHeader () const
 Indicate whether to display the (user-supplied) external identification number in the header line.
 
bool placeTitleInHeader () const
 Indicate whether to display the data item name (title) in the header line, between angular brackets.
 
bool placeMaccsIIFieldInHeader () const
 Indicate whether to display the MACCS-II field number in the header.
 
bool noteArchivesInHeader () const
 Indicate that the "FROM ARCHIVES" tag should go in the header line.
 
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 a blank string will be returned.
 
const std::string & getOutputItemName () const
 Get a const reference to the output item name, if it exists. If there is no item name, a const reference to a blank string will be returned.
 
const std::string & getExternalRegistryNumber () const
 Get the external registry number.
 
int getInternalRegistryNumber () const
 Get the internal registry number. This will return -1 if no such registry number exists.
 
int getMaccsFieldNumber () const
 Get the MACCS-II database field number.
 
StateVariable getTrackedState () const
 Get the state variable enumeration for this data item. This is used in the case of a STATE_VARIABLE kind of data item, to signal that a particular component of the molecular mechanics energy, or some intensive or expansive system property, should be retrieved.
 
int getDataLineCount () const
 Get the data line count.
 
const std::string & getDataLine (const int line_index) const
 Get a particular data lines from the item body.
 
const std::vector< std::string > & getBody () const
 Get all data lines.
 
MdlMolDataItemKind getKind () const
 Get the custom data item type. Here, the "NATIVE" code indicates that no custom enumeration is present.
 
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.
 
void addDataLine (const std::string &text)
 Add a line to the data item.
 
 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, or the information pertinent to the header line and a series of strings that will form the body of data in the item. Any information submitted as part of a string such as an atom or bond index, which could then go to an output file, must be in the Fortran array indexing (starting at 1). Integer information read from the data body can be adjusted to meet internal array indexing.
 
 MdlMolDataItem (const TextFile &tf, int line_number, int *line_advance, int compound_line_end=-1, const std::string &title=std::string(""), ModificationPolicy mpol=ModificationPolicy::DO_NOT_MODIFY, ExceptionResponse notify=ExceptionResponse::WARN)
 
 MdlMolDataItem (const MdlMolDataRequest &ask, const std::vector< std::string > &body_in, ModificationPolicy mpol=ModificationPolicy::DO_NOT_MODIFY, ExceptionResponse notify=ExceptionResponse::WARN)
 
 MdlMolDataItem (const MdlMolDataItem &original)=default
 The default copy and move constructors, as well as copy and move assignment operators, are applicable to this object which has no const members or pointers to repair.
 
 MdlMolDataItem (MdlMolDataItem &&original)=default
 
MdlMolDataItemoperator= (const MdlMolDataItem &other)=default
 
MdlMolDataItemoperator= (MdlMolDataItem &&other)=default
 
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 separated by one or more white space characters and that the quotation marks "" and '' collect everything between them into a single word.
 
std::string parseString (int start_pos, int length, int line_number) const
 
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 apply, as do the overloads and descriptions of formal arguments.
 
llint parseInteger (int start_pos, int length, int line_number) const
 
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() above apply, as do the overloads and descriptions of formal arguments.
 
ullint parseUnsigned (int start_pos, int length, int line_number) const
 
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 apply, as do the overloads and descriptions of formal arguments.
 
double parseReal (int start_pos, int length, int line_number) const
 
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() above apply, as do overloads and descriptions of formal arguments.
 
char4 parseChar4 (int start_pos, int length, int line_number) const
 
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.
 
bool matchItemName (const std::string &item_name_comp, int maccs_ii_no_comp=-1) const
 
bool matchRegistryNumber (const std::string &ext_regno_comp, int maccs_ii_no_comp=-1) const
 
bool matchMaccsField (int maccs_ii_no_comp) const
 

Detailed Description

Store a data item from within an SD file. Data items begin with a line of the form "> <ITEM_NAME>" (additional specifications are possible), end with a single blank line, and can contain customized format information. The information will be read as a series of raw strings, one per line and each representing a whole line. Once read, member functions of the class can extract specific integer, real, char4, or string coded data from within the item.

Constructor & Destructor Documentation

◆ MdlMolDataItem()

stormm::structure::MdlMolDataItem::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, or the information pertinent to the header line and a series of strings that will form the body of data in the item. Any information submitted as part of a string such as an atom or bond index, which could then go to an output file, must be in the Fortran array indexing (starting at 1). Integer information read from the data body can be adjusted to meet internal array indexing.

Parameters
item_name_inName of the data item (an item_name of "ABCD" will appear as "<ABCD>" on the data item's first line)
external_regno_inAn identification number for the compound referencing an external database. An external identification number of "PD-3647" will be represented as "(PD-3647)" on the data item's header line.
maccs_ii_number_inAn integer representing the corresponding field in a MACCS-II database. A field number such as "6519" will be represented as "DT6519" in the data item header line.
header_infoA bit-packed unsigned integer containing, in its low to high bits, whether to display the internal identification number (based on the order in the SD file), the external identification number, the item name, the field number, and finally a "FROM ARCHIVES" declaration.
tfThe original text of the SD file, committed to RAM
line_numberLine of the file at which to begin reading the data item
line_advanceLine of the file that the construction of the data item leads to (after taking in lines of the item)
compound_line_endIndex of the last line of the compound within the SD file (the line contains $$$$)
titleThe title of the structure, if known, for error tracing purposes
mpolPolicy about modifying details of the data items that may not conform to the Biovia standard
notifyPolicy on whether to notify the user if modifications to certain details of the data item take place

Member Function Documentation

◆ addDataLine()

void stormm::structure::MdlMolDataItem::addDataLine ( const std::string & text)

Add a line to the data item.

Parameters
textThe text of the line to add. This should not include carriage returns, but if it does then it will all be taken as one "data line" to be printed.

◆ getDataLine()

const std::string & stormm::structure::MdlMolDataItem::getDataLine ( const int line_index) const

Get a particular data lines from the item body.

Parameters
line_indexThe data line of interest

◆ matchItemName()

bool stormm::structure::MdlMolDataItem::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.

Parameters
item_name_compItem name for comparison
ext_regno_compExternal registry number for comparison
maccs_ii_no_compMACCS-II database field number for comparison (omit leading "DT")

◆ parseString()

std::string stormm::structure::MdlMolDataItem::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 separated by one or more white space characters and that the quotation marks "" and '' collect everything between them into a single word.

Overloaded:

  • Extract a free-format string based on words separated by white space, assuming that individual words on each line are separated by one or more white space characters and that the quotation marks "" and '' collect everything between them into a single word.
  • Extract a column-formatted string based on strict character indices
Parameters
element_numberNumber of the word on the line (words are separated by white space)
start_posThe starting position within the line at which to begin reading
start_posLength of the fixed-column reading to perform
line_numberNumber of the data line on which to find the string

◆ setItemName()

void stormm::structure::MdlMolDataItem::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.

Parameters
item_name_inThe item name to assign
mpolIndicate what to do if the proposed name does not meet strict Biovia SD file standards but is otherwise salvageable.
notifyIndicate what to do if modifications are made to the proposed name.

The documentation for this class was generated from the following files: