Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | header_size | = | 0 | ||
integer, | public | :: | frame_size | = | 0 | ||
integer, | public | :: | num_atoms | = | 0 | ||
integer, | public, | dimension(4) | :: | frmcmp | = | 0 | |
character(len=:), | public, | allocatable | :: | fn | |||
integer, | public | :: | file_id | = | 0 | ||
integer, | public | :: | num_frames | = | 0 | ||
logical, | public | :: | isopen | = | .false. |
Creates a trajectory_t
object with a new underlying file named fn
. If
fn
already exists, it will be truncated. The file fn
is opened for both
reading and writing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(out) | :: | this | trajectory_t instance. |
||
character(len=*), | intent(in) | :: | fn | Name of the underlying trajectory file. |
||
integer, | intent(in) | :: | na | Number of atoms |
||
integer, | intent(in), | dimension(4) | :: | frmcmp | Binary flags indicating whether that component is present in a frame. frmcmp(1): coordinates, frmcmp(2): velocities, frmcmp(3): forces, frmcmp(4): charges |
Creates a trajectory_t
object with a prexisting underlying file named
fn
. If fn
does not exist, an error will be generated. If
mode
== 'rw', the file fn
is opened for both reading and writing.
If mode
== 'r', the file fn
is opened only for reading.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(out) | :: | this | |||
character(len=*), | intent(in) | :: | fn | |||
character(len=*), | intent(in) | :: | mode | |||
integer, | intent(out) | :: | ierr |
After a call to this subroutine, all memory within this
is deallocated,
all components of this
are reset to zero, and the underlying file is
closed (if open).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(inout) | :: | this |
Closes the underlying file of a trajectory_t
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(inout) | :: | this |
Read from an open trajectory.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(in) | :: | this | |||
integer, | intent(in) | :: | iframe | Frame number |
||
integer(kind=ip_long), | intent(out) | :: | nts | Time step counter |
||
integer, | intent(out) | :: | ierr | Error flag |
||
real(kind=rp), | intent(out), | optional | dimension(:,:) | :: | coordinates | |
real(kind=rp), | intent(out), | optional | dimension(:,:) | :: | velocities | |
real(kind=rp), | intent(out), | optional | dimension(:,:) | :: | forces | |
real(kind=rp), | intent(out), | optional | dimension(:) | :: | charge |
Write a frame to an open trajectory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(inout) | :: | this | |||
integer(kind=ip_long), | intent(in) | :: | nts | |||
real(kind=rp), | intent(in), | dimension(:,:) | :: | coordinates |
Write a frame to an open trajectory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | iframe | |||
integer(kind=ip_long), | intent(in) | :: | nts | |||
real(kind=rp), | intent(in), | dimension(:,:) | :: | coordinates |
Creates a trajectory_t
object with a new underlying file named fn
. If
fn
already exists, it will be truncated. The file fn
is opened for both
reading and writing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(out) | :: | this | trajectory_t instance. |
||
character(len=*), | intent(in) | :: | fn | Name of the underlying trajectory file. |
||
integer, | intent(in) | :: | na | Number of atoms |
||
integer, | intent(in), | dimension(4) | :: | frmcmp | Binary flags indicating whether that component is present in a frame. frmcmp(1): coordinates, frmcmp(2): velocities, frmcmp(3): forces, frmcmp(4): charges |
Creates a trajectory_t
object with a prexisting underlying file named
fn
. If fn
does not exist, an error will be generated. If
mode
== 'rw', the file fn
is opened for both reading and writing.
If mode
== 'r', the file fn
is opened only for reading.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trajectory_t), | intent(out) | :: | this | |||
character(len=*), | intent(in) | :: | fn | |||
character(len=*), | intent(in) | :: | mode | |||
integer, | intent(out) | :: | ierr |
type trajectory_t
integer :: header_size = 0
integer :: frame_size = 0
integer :: num_atoms = 0
integer, dimension(4) :: frmcmp = 0
character(len=:), allocatable :: fn
integer :: file_id = 0
integer :: num_frames = 0
logical :: isopen = .false.
contains
procedure :: create => traj_create
procedure :: open => traj_open
procedure :: delete => traj_delete
procedure :: close => traj_close
procedure :: read => traj_read
procedure :: append_frame => traj_append_frame
procedure :: write_frame => traj_write_frame
generic :: init => create, open
end type trajectory_t