CHFL_TRAJECTORY
ΒΆThe Trajectory type is the main entry point when using chemfiles. A trajectory
behave a bit like a FILE*
pointer, and the chfl_close
free the memory
associated with the file.
chfl_trajectory_open
(const char * filename, char mode)Open a trajectory file.
filename
- The path to the trajectory file
mode
- The opening mode: ‘r’ for read, ‘w’ for write and ‘a’ for append.
chfl_trajectory_with_format
(const char * filename, char mode, const char * format)Open a trajectory file using a specific file format.
This can be needed when the file format does not match the extension, or when there is not standard extension for this format.
filename
- The path to the trajectory file
mode
- The opening mode: ‘r’ for read, ‘w’ for write and ‘a’ for append.
format
- The file format to use. An empty string means that the format should be guessed from the extension.
chfl_trajectory_read
(CHFL_TRAJECTORY * file, CHFL_FRAME * frame)Read the next step of the trajectory into a frame.
file
- A pointer to the trajectory
frame
- A frame to fill with the data
chfl_trajectory_read_step
(CHFL_TRAJECTORY * file, size_t step, CHFL_FRAME * frame)Read a specific step of the trajectory in a frame.
file
- A pointer to the trajectory
step
- The step to read
frame
- A frame to fill with the data
chfl_trajectory_write
(CHFL_TRAJECTORY * file, const CHFL_FRAME * frame)Write a frame to the trajectory.
file
- The trajectory to write
frame
- the frame which will be writen to the file
chfl_trajectory_set_topology
(CHFL_TRAJECTORY * file, const CHFL_TOPOLOGY * topology)Set the topology associated with a trajectory. This topology will be used when reading and writing the files, replacing any topology in the frames or files.
file
- A pointer to the trajectory
topology
- The new topology to use
chfl_trajectory_set_topology_file
(CHFL_TRAJECTORY * file, const char * filename)Set the topology associated with a trajectory by reading the first frame of filename
; and extracting the topology of this frame.
file
- A pointer to the trajectory
filename
- The file to read in order to get the new topology
chfl_trajectory_set_topology_with_format
(CHFL_TRAJECTORY * file, const char * filename, const char * format)Set the topology associated with a trajectory by reading the first frame of filename
using the file format in format
; and extracting the topology of this frame.
This can be needed when the topology file format does not match the extension, or when there is not standard extension for this format.
file
- A pointer to the trajectory
filename
- The file to read in order to get the new topology
format
- The name of the file format to use for reading the topology. An empty string means that the format should be guessed from the extension.
chfl_trajectory_nsteps
(CHFL_TRAJECTORY * file, size_t * nsteps)Get the number of steps (the number of frames) in a trajectory.
file
- A pointer to the trajectory
nsteps
- This will contain the number of steps
chfl_trajectory_close
(CHFL_TRAJECTORY * file)Close a trajectory file, and free the associated memory.
file
- A pointer to the file