chfl_trajectory
type¶chfl_trajectory
¶The chfl_trajectory
type is the main entry point when using
chemfiles. A chfl_trajectory
behave a like a file, allowing to
read and/or write chfl_frame
.
The initialization routine for chfl_trajectory
are:
The memory liberation routine is chfl_trajectory%close()
.
Type fields: |
|
---|
chfl_trajectory%
open
(path, mode[, status])¶Open the file at the given path
using the given mode
.
Valid modes are 'r'
for read, 'w'
for write and 'a'
for append.
Parameters: |
|
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to |
chfl_trajectory%
with_format
(path, mode, format[, status])¶Open the trajectory at the given path
using a specific file format
and the given mode
.
This is be needed when the file format does not match the extension, or when
there is not standard extension for this format. Valid modes are 'r'
for
read, 'w'
for write and 'a'
for append.
If format
is an empty string, the format will be guessed from the
extension.
Parameters: |
|
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to |
chfl_trajectory%
read
(frame[, status])¶Read the next step of the trajectory into a frame
.
If the number of atoms in frame does not correspond to the number of atom in the next step, the frame is resized.
Parameters: | frame [chfl_frame] :: frame to fill with the data |
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to CHFL_SUCCESS , you can learn more
about the error by using chfl_last_error . |
chfl_trajectory%
read_step
(step, frame[, status])¶Read a specific step
of the trajectory into a frame
. The first
trajectory step is the step 0.
If the number of atoms in frame does not correspond to the number of atom in the step, the frame is resized.
Parameters: |
|
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to |
chfl_trajectory%
write
(frame[, status])¶Write a single frame
to the trajectory.
Parameters: | frame [chfl_frame] :: frame to be writen to the file |
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to CHFL_SUCCESS , you can learn more
about the error by using chfl_last_error . |
chfl_trajectory%
set_topology
(topology[, status])¶Set the topology
associated with the trajectory. This topology will be
used when reading and writing the files, replacing any topology in the
frames or files.
Parameters: | topology [chfl_topology] :: new topology to use |
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to CHFL_SUCCESS , you can learn more
about the error by using chfl_last_error . |
chfl_trajectory%
topology_file
(path[, format, status])¶Set the topology associated with the trajectory by reading the first frame of
the file at the given path
using the file format in format
; and
extracting the topology of this frame.
If format
is an empty string or not given, the format will be guessed
from the extension.
Parameters: | character (len=*) :: file to read in order to get the new topology |
---|---|
Options: |
|
chfl_trajectory%
set_cell
(cell[, status])¶Set the unit cell
associated with the trajectory. This cell will be used
when reading and writing the files, replacing any pre-existing unit cell.
Parameters: | cell [chfl_cell] :: new cell to use |
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to CHFL_SUCCESS , you can learn more
about the error by using chfl_last_error . |
chfl_trajectory%
nsteps
(nsteps[, status])¶Store the number of steps (the number of frames) from the trajectory in
nsteps
.
Parameters: | nsteps [integer] :: number of steps |
---|---|
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to CHFL_SUCCESS , you can learn more
about the error by using chfl_last_error . |
chfl_trajectory%
close
([status])¶Close a trajectory file, and free the associated memory.
Closing a file will synchronize all changes made to the file with the storage (hard drive, network, …) used for this file.
Options: | status [integer,optional, kind=chfl_status] :: status code of the
operation. If it is not equal to CHFL_SUCCESS , you can learn more
about the error by using chfl_last_error . |
---|