Format classes

Abstract class

This classe only define the interface, which as to be implemented by all formats.

class chemfiles::Format

Abstract base class for formats reader and writer

Public Type

typedef BasicFile file_t

File class to use with this Format. This is for registration in the Factory.

Public Functions

Format(File & f)

Constructor associating a file to this Format instance. The file should have the file_t class.

virtual void read_step(const size_t step, Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • step -

    The step to read

  • frame -

    The frame to fill

virtual void read(Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to fill

virtual void write(const Frame & frame)

Write a step (frame) to the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to be writen

virtual size_t nsteps() const = 0

Get the number of frames in the associated file.

Return
The number of frames

virtual std::string description() const = 0

A short string describing the format.

Implemented formats

These classes implement the interface defined previously.

class chemfiles::XYZFormat

XYZ file format reader.

The format is described at http://openbabel.org/wiki/XYZ

Public Functions

virtual void read_step(const size_t step, Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • step -

    The step to read

  • frame -

    The frame to fill

virtual void read(Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to fill

virtual void write(const Frame & frame)

Write a step (frame) to the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to be writen

virtual std::string description() const

A short string describing the format.

virtual size_t nsteps() const

Get the number of frames in the associated file.

Return
The number of frames

class chemfiles::NCFormat

Amber NetCDF file format reader.

http://ambermd.org/netcdf/nctraj.xhtml

Public Functions

virtual void read_step(const size_t step, Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • step -

    The step to read

  • frame -

    The frame to fill

virtual void read(Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to fill

virtual void write(const Frame & frame)

Write a step (frame) to the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to be writen

virtual size_t nsteps() const

Get the number of frames in the associated file.

Return
The number of frames

virtual std::string description() const

A short string describing the format.

template <MolfileFormat F>
class chemfiles::Molfile

Use of VMD Molfile plugins as format reader/writer. This class is templated by a value in the MolfileFormat enum.

Public Functions

virtual void read(Frame & frame)

Read a specific step from the associated file.

This function can throw an exception in case of error.

Parameters
  • frame -

    The frame to fill

virtual std::string description() const

A short string describing the format.

virtual size_t nsteps() const

Get the number of frames in the associated file.

Return
The number of frames

MolfileFormat enum

List all the VMD molfile plugins enabled. For more documentation about VMD molfile plugins, please see: http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/

Values:

  • PDB -

    PDB file format.

  • DCD -

    DCD binary file format.

  • GRO -

    Gromacs .gro file format.

  • TRR -

    Gromacs .trr file format.

  • XTC -

    Gromacs .xtc file format.

  • TRJ -

    Gromacs .trj file format.