Format classes

Interface for formats

class chemfiles::Format

The Format class defines the interface to implement in order to add a new format to chemfiles. It is possible to implement only one of Format::read; Format::read_step or Format::write. In that case, only the corresponding operations will be available from the corresponding chemfiles::Trajectory.

Subclassed by chemfiles::AmberNetCDFFormat, chemfiles::LAMMPSDataFormat, chemfiles::MMTFFormat, chemfiles::Molfile< F >, chemfiles::PDBFormat, chemfiles::SDFFormat, chemfiles::TinkerFormat, chemfiles::TNGFormat, chemfiles::XYZFormat

Public Functions

virtual void chemfiles::Formatread_step(size_t step, Frame &frame)

Read a specific step from the trajectory file.

Exceptions
  • FormatError: if the file does not follow the format
  • FileError: if their is an OS error while reading the file
Parameters
  • step: The step to read
  • frame: The frame to fill

virtual void chemfiles::Formatread(Frame &frame)

Read a specific step from the trajectory file.

Exceptions
  • FormatError: if the file does not follow the format
  • FileError: if their is an OS error while reading the file
Parameters
  • frame: The frame to fill

virtual void chemfiles::Formatwrite(const Frame &frame)

Write a frame to the trajectory file.

Exceptions
  • FormatError: if the file does not follow the format
  • FileError: if their is an OS error while reading the file
Parameters
  • frame: The frame to be writen

virtual size_t chemfiles::Formatnsteps() = 0

Get the number of frames in the associated file.

Return
The number of frames

Implemented formats

These classes implement the format interface defined previously.

class chemfiles::XYZFormat

XYZ file format reader and writer.

Inherits from chemfiles::Format

class chemfiles::PDBFormat

PDB file format reader and writer.

For multi-frame trajectories, we follow the convention of VMD to use multiple END records, separating the steps.

Inherits from chemfiles::Format

class chemfiles::AmberNetCDFFormat

Amber NetCDF file format reader.

Inherits from chemfiles::Format

class chemfiles::TNGFormat

TNG file format reader.

Inherits from chemfiles::Format

class chemfiles::LAMMPSDataFormat

LAMMPS Data file format reader and writer.

LAMMPS data files are not fully stand-alone, as one needs to know the atom style to read the data. This reader will try to guess the atom style by checking the first line of the header for atom_style <style>, and by reading any comment after the Atoms section name. If no atom style is specified, the code default to full and send a warning.

The code alse tries to read atomic names at the end of data lines. For example, the atom at index 44 will have C2 as atomic name.

44 44 2 0.000000 1.094000 2.061000 69.552002 # C2 RES

Inherits from chemfiles::Format

class chemfiles::TinkerFormat

Tinker XYZ file format.

The format is described here: http://chembytes.wikidot.com/tnk-tut00#toc2. Additionally to the original Tinker XYZ format, chemfiles also supports the files with unit cell data, as introduced in Tinker 6.3.

This format is associated with the .arc extension, but not the .xyz extension, which is used for the standard XYZ format.

Inherits from chemfiles::Format

template <MolfileFormat F>
class chemfiles::Molfile

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

Inherits from chemfiles::Format

enum chemfiles::MolfileFormat

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:

chemfilesDCD

DCD binary file format.

chemfilesGRO

Gromacs .gro file format.

chemfilesTRR

Gromacs .trr file format.

chemfilesXTC

Gromacs .xtc file format.

chemfilesTRJ

Gromacs .trj file format.

chemfilesLAMMPS

Lammps trajectory files.

chemfilesMOL2

MOL2 file format.

chemfilesMOLDEN

Molden file format.