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
.
Type fields: |
|
---|
chfl_trajectory%
open
(path, mode[, format, 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.
If format
is not given or an empty string, the format will be guessed
from the extension.
This subroutine allocate memory which must be released with
chfl_trajectory%close()
.
Parameters: |
|
---|---|
Options: |
|
chfl_trajectory%
path
([status])¶Get the path used to open the trajectory. If the path is longer than
CHFL_STRING_LENGTH
, it will be truncated.
Return: | character (len=CHFL_STRING_LENGTH) |
---|---|
Options: | status [integer(chfl_status)] :: status code of the operation. If it
is not CHFL_SUCCESS , use chfl_last_error() to learn
more about the error. |
chfl_trajectory%
nsteps
([status])¶Get the number of steps (the number of frames) in the trajectory.
Return: | integer |
---|---|
Options: | status [integer(chfl_status)] :: status code of the operation. If it
is not CHFL_SUCCESS , use chfl_last_error() to learn
more about the error. |
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 [type(chfl_frame)] :: frame to fill with the data |
---|---|
Options: | status [integer(chfl_status)] :: status code of the operation. If it
is not CHFL_SUCCESS , use chfl_last_error() to learn
more about the 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(chfl_status)] :: status code of the operation. If it
is not |
chfl_trajectory%
write
(frame[, status])¶Write a single frame
to the trajectory.
Parameters: | frame [type(chfl_frame)] :: frame to be writen to the file |
---|---|
Options: | status [integer(chfl_status)] :: status code of the operation. If it
is not CHFL_SUCCESS , use chfl_last_error() to learn
more about the 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 [type(chfl_topology)] :: new topology to use |
---|---|
Options: | status [integer(chfl_status)] :: status code of the operation. If it
is not CHFL_SUCCESS , use chfl_last_error() to learn
more about the 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: | path [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 [type(chfl_cell)] :: new cell to use |
---|---|
Options: | status [integer(chfl_status)] :: status code of the operation. If it
is not CHFL_SUCCESS , use chfl_last_error() to learn
more about the 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.