File XyzStreamHandler.h

XYZ-formatted streaming IO.

Copyright

This code is licensed under the 3-clause BSD license.

Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.

See LICENSE.txt for details.

namespace Scine

This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.

This header contains alias definitions defining which classes to use for the different degrees of derivatives.

namespace Utils
class XyzStreamHandler : public Scine::Utils::FormattedStreamHandler
#include <XyzStreamHandler.h>

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.

Static members

static AtomCollection read(std::istream &is)
static void write(std::ostream &os, const AtomCollection &atoms)

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 to

  • format: The format to write

  • atoms: 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 write

  • atoms: The element type and positional information to write to a file

  • bondOrders: The bond order collection to write to file

Exceptions
  • FormatUnsupportedException: If the desired filetype is unsupported

  • NoBondInformationException: 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 for

  • operation: 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.