File MolecularTrajectoryIO.h

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 MolecularTrajectoryIO
#include <MolecularTrajectoryIO.h>

Class for input and output of MolecularTrajectory classes.

Public Types

enum format

Enum class for possible input and output formats.

Values:

xyz
binary

Public Static Functions

static void write(format f, const std::string &fileName, const MolecularTrajectory &m)

Write a molecular trajectory to a file.

Parameters
  • f: The format to be used/expected.

  • fileName: The file path.

  • m: The trajectory.

Exceptions
  • std::runtime_error: If the file could not be created.

static void write(format f, std::ostream &out, const MolecularTrajectory &m)

Write a molecular trajectory to a stream.

Parameters
  • f: The format to be used/expected.

  • out: The output stream.

  • m: The trajectory.

static MolecularTrajectory read(format f, const std::string &fileName)

Read a molecular trajectory from a file.

Return

MolecularTrajectory Returns the trajectory.

Parameters
  • f: The format to be used/expected.

  • fileName: The file path.

Exceptions
  • std::runtime_error: If the file could not be opened.

static MolecularTrajectory read(format f, std::istream &in)

Read a molecular trajectory from a stream.

Return

MolecularTrajectory Returns the trajectory.

Parameters
  • f: The format to be used/expected.

  • in: The input stream.

Exceptions
  • std::runtime_error: If the format isn’t supported.

static void writeXYZLine(std::ostream &out, ElementType e, const Position &p)

Output a single line (one atom) of a XYZ file.

Parameters
  • out: The output stream to be written to.

  • e: The ElementType of the atom tho be printed.

  • p: The Position of the atom tho be printed.

Private Static Functions

static void writeBinary(std::ostream &out, const MolecularTrajectory &m)
static void writeXYZ(std::ostream &out, const MolecularTrajectory &m)
static MolecularTrajectory readBinary(std::istream &in)
static MolecularTrajectory readXYZ(std::istream &in)