trajectory_t Derived Type

type, public :: trajectory_t


Components

Type Visibility Attributes Name Initial
integer, public :: frame_size = 0
integer, public :: header_size = 0
integer, public :: num_frames = 0
character(len=:), public, allocatable :: fn
integer, public :: file_id = 0
logical, public :: isopen = .false.

Type-Bound Procedures

procedure, public :: create => traj_create

  • public subroutine traj_create(this, fn, na)

    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.

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(out) :: this
    character(len=*), intent(in) :: fn
    integer, intent(in) :: na

procedure, public :: open => traj_open

  • public subroutine traj_open(this, fn, mode)

    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.

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(out) :: this
    character(len=*), intent(in) :: fn
    character(len=*), intent(in) :: mode

procedure, public :: clear => traj_clear

  • public subroutine traj_clear(this)

    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).

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(inout) :: this

procedure, public :: close => traj_close

  • public subroutine traj_close(this)

    Closes the underlying file of a trajectory_t.

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(inout) :: this

procedure, public :: read => traj_read

  • public subroutine traj_read(this, ver, iframe, istage, nblks, nts, coordinates, ierr)

    Read from an open trajectory.

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(in) :: this
    integer, intent(in) :: ver

    Trajectory file version. 0: brushpak-0.5, 1: mcpak-0.1, 2: mcpak-0.2

    integer, intent(in) :: iframe
    integer, intent(out) :: istage
    integer, intent(out) :: nblks
    integer, intent(out) :: nts
    real(kind=rp), intent(out), dimension(:,:) :: coordinates
    integer, intent(out) :: ierr

procedure, public :: append_frame => traj_append_frame

  • public subroutine traj_append_frame(this, nblks, coordinates)

    Write a frame to an open trajectory

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(inout) :: this
    integer, intent(in) :: nblks
    real(kind=rp), intent(in), dimension(:,:) :: coordinates

procedure, public :: write_frame => traj_write_frame

  • public subroutine traj_write_frame(this, iframe, nblks, coordinates)

    Write a frame to an open trajectory

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(inout) :: this
    integer, intent(in) :: iframe
    integer, intent(in) :: nblks
    real(kind=rp), intent(in), dimension(:,:) :: coordinates

generic, public :: init => create, open

  • public subroutine traj_create(this, fn, na)

    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.

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(out) :: this
    character(len=*), intent(in) :: fn
    integer, intent(in) :: na
  • public subroutine traj_open(this, fn, mode)

    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.

    Arguments

    Type IntentOptional Attributes Name
    class(trajectory_t), intent(out) :: this
    character(len=*), intent(in) :: fn
    character(len=*), intent(in) :: mode

Source Code

type trajectory_t
    integer :: frame_size = 0
    integer :: header_size = 0
    integer :: num_frames = 0
    character(len=:), allocatable :: fn
    integer :: file_id = 0
    logical :: isopen = .false.

    contains
        procedure :: create       => traj_create
        procedure :: open         => traj_open
        procedure :: clear        => traj_clear
        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