trajectory_m Module

Routines for reading and writing frames from a trajectory file.


Uses

  • module~~trajectory_m~~UsesGraph module~trajectory_m trajectory_m module~constants_m constants_m module~trajectory_m->module~constants_m iso_fortran_env iso_fortran_env module~constants_m->iso_fortran_env

Used by

  • module~~trajectory_m~~UsedByGraph module~trajectory_m trajectory_m module~bd_solver_m bd_solver_m module~bd_solver_m->module~trajectory_m module~setup_m setup_m module~setup_m->module~trajectory_m module~setup_m->module~bd_solver_m program~main main program~main->module~setup_m

Contents


Variables

TypeVisibility AttributesNameInitial
type(trajectory_t), public :: traj

Derived Types

type, private :: trajectory_t

Components

TypeVisibility AttributesNameInitial
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.

Type-Bound Procedures

procedure, public :: create => traj_create
procedure, public :: open => traj_open
procedure, public :: delete => traj_delete
procedure, public :: close => traj_close
procedure, public :: read => traj_read
procedure, public :: append_frame => traj_append_frame
procedure, public :: write_frame => traj_write_frame
generic, public :: init => create, open

Subroutines

private subroutine traj_create(this, fn, na, frmcmp)

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 AttributesName
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

private subroutine traj_open(this, fn, mode, ierr)

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 AttributesName
class(trajectory_t), intent(out) :: this
character(len=*), intent(in) :: fn
character(len=*), intent(in) :: mode
integer, intent(out) :: ierr

private subroutine traj_delete(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 AttributesName
class(trajectory_t), intent(inout) :: this

private subroutine traj_close(this)

Closes the underlying file of a trajectory_t.

Arguments

Type IntentOptional AttributesName
class(trajectory_t), intent(inout) :: this

private subroutine traj_read(this, iframe, nts, ierr, coordinates, velocities, forces, charge)

Read from an open trajectory.

Arguments

Type IntentOptional AttributesName
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

private subroutine traj_append_frame(this, nts, coordinates)

Write a frame to an open trajectory

Arguments

Type IntentOptional AttributesName
class(trajectory_t), intent(inout) :: this
integer(kind=ip_long), intent(in) :: nts
real(kind=rp), intent(in), dimension(:,:):: coordinates

private subroutine traj_write_frame(this, iframe, nts, coordinates)

Write a frame to an open trajectory

Arguments

Type IntentOptional AttributesName
class(trajectory_t), intent(inout) :: this
integer, intent(in) :: iframe
integer(kind=ip_long), intent(in) :: nts
real(kind=rp), intent(in), dimension(:,:):: coordinates