Class Scine::Utils::XYZStreamHandler¶
-
class
XYZStreamHandler
: public Scine::Utils::FormattedStreamHandler¶ Handler for XYZ stream IO.
This class implements the FormattedStreamHandler interface for use with Core’s module management. The core stream IO functions are available as static functions, too.
- Note
Since the XYZ file format does not include bond information in any part, the read/write pair involving BondOrderCollections just throws in all cases.
FormattedStreamHandler interface
-
std::pair<AtomCollection, BondOrderCollection>
read
(std::istream &is, const std::string &format) const¶ Reads from an input stream, extracting element types, positions and bond orders (if present)
- Return
An Atomcollection and BondOrderCollection
- Parameters
is
: The input stream to read
- Exceptions
FormatUnsupportedException
: If the desired format is unsupported
-
void
write
(std::ostream &os, const std::string &format, const AtomCollection &atoms) const¶ Writes element types and positional information to an arbitrary filetype.
- Parameters
os
: The output stream to write toformat
: The format to writeatoms
: The element type and positional information to write to a file
- Exceptions
FormatUnsupportedException
: If the desired format is unsupported
-
void
write
(std::ostream &os, const std::string &format, const AtomCollection &atoms, const BondOrderCollection &bondOrders) const¶ Writes element types and positional information to an arbitrary filetype.
- Parameters
os
: The output stream to write to.format
: The format to writeatoms
: The element type and positional information to write to a filebondOrders
: The bond order collection to write to file
- Exceptions
FormatUnsupportedException
: If the desired filetype is unsupportedNoBondInformationException
: If the specified filetype does not contain bond order information
-
std::vector<FormatSupportPair>
formats
() const¶ Returns a list of supported file formats.
- Note
These may, but do not have to be identical to each format’s conventional file suffix
-
bool
formatSupported
(const std::string &format, SupportType operation) const¶ Check whether a particular operation for a format is supported.
- Return
true if the operation is supported for that format
- Parameters
format
: The format filetype suffix to check foroperation
: The operation for which support is queried
-
std::string
name
() const¶ Getter for the name of the FormattedStreamHandler.
- Return
Returns the name of the FormattedStreamHandler.
Public Static Attributes
-
constexpr const char *
model
= "XYZStreamHandler"¶ Model string identifier for use in the Module system.