Format
classes¶
Interface for formats¶
-
class
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 ofFormat::read
;Format::read_step
orFormat::write
. In that case, only the corresponding operations will be available from the correspondingchemfiles::Trajectory
.Subclassed by chemfiles::AmberNetCDFFormat, chemfiles::CSSRFormat, chemfiles::GROFormat, chemfiles::LAMMPSDataFormat, chemfiles::mmCIFFormat, chemfiles::MMTFFormat, chemfiles::MOL2Format, chemfiles::Molfile< F >, chemfiles::PDBFormat, chemfiles::SDFFormat, chemfiles::TinkerFormat, chemfiles::TNGFormat, chemfiles::XYZFormat
Public Functions
-
virtual void
read_step
(size_t step, Frame &frame)¶ Read a specific step from the trajectory file.
- Exceptions
FormatError
: if the file does not follow the formatFileError
: if their is an OS error while reading the file
- Parameters
step
: The step to readframe
: The frame to fill
-
virtual void
read
(Frame &frame)¶ Read a specific step from the trajectory file.
- Exceptions
FormatError
: if the file does not follow the formatFileError
: if their is an OS error while reading the file
- Parameters
frame
: The frame to fill
-
virtual void
write
(const Frame &frame)¶ Write a frame to the trajectory file.
- Exceptions
FormatError
: if the file does not follow the formatFileError
: if their is an OS error while reading the file
- Parameters
frame
: The frame to be writen
-
virtual size_t
nsteps
() = 0¶ Get the number of frames in the associated file.
- Return
- The number of frames
-
virtual void
Implemented formats¶
These classes implement the format interface defined previously.
-
class
PDBFormat
: public chemfiles::Format¶ PDB file format reader and writer.
For multi-frame trajectories, we follow the convention of VMD to use multiple
END
records, separating the steps.
-
class
AmberNetCDFFormat
: public chemfiles::Format¶ Amber NetCDF file format reader.
-
class
LAMMPSDataFormat
: public chemfiles::Format¶ 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 theAtoms
section name. If no atom style is specified, the code default tofull
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
-
class
TinkerFormat
: public chemfiles::Format¶ 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.
-
template<MolfileFormat
F
>
classMolfile
: public chemfiles::Format¶ Use of VMD Molfile plugins as format reader. This class is templated by a value in the
MolfileFormat
enum.
-
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:
-
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.
-
LAMMPS
¶ Lammps trajectory files.
-
MOL2
¶ MOL2 file format.
-
MOLDEN
¶ Molden file format.
-