chfl_frame type

type chfl_frame

A chfl_frame contains data from one simulation step: the current unit cell, the topology, the positions, and the velocities of the particles in the system. If some information is missing (topology or velocity or unit cell), the corresponding data is filled with a default value.

The initialization routine for chfl_frame are chfl_frame%init() and chfl_frame%copy().

Type fields:
subroutine chfl_frame%init([status])

Initialize this unit cell with a new empty frame. It will be resized by the library as needed.

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.
subroutine chfl_frame%copy(frame[, status])

Initialize this frame with a copy of frame.

Parameters:frame [chfl_frame] :: frame to copy
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.
subroutine chfl_frame%atoms_count(natoms[, status])

Get the current number of atoms in the frame in natoms.

Parameters:natoms [integer] :: number of atoms in the frame
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.
subroutine chfl_frame%add_atom(atom, position[, velocity, status])

Add a chfl_atom and the corresponding position and velocity data to this frame. velocity can be absent if no velocity is associated with this frame.

Parameters:
  • atom [chfl_atom] :: atom to add to the frame
  • position (3) [real] :: atom position
Options:
  • velocity (3) [real,optional] :: atom velocity
  • 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.
subroutine chfl_frame%remove(index[, status])

Remove the atom at the given index in the frame.

This modify all the atoms indexes after index, and invalidate any pointer obtained using chfl_frame%positions() or chfl_frame%velocities().

Parameters:index [integer] :: index of the atom to remove
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.
subroutine chfl_frame%resize(natoms[, status])

Resize the positions, velocities and topology in the frame, to have space for natoms atoms.

This function may invalidate any pointer to the positions or the velocities if the new size is bigger than the old one. In all the cases, previous data is conserved. This function conserve the presence or absence of velocities.

Parameters:natoms [integer] :: the new number of atoms in the frame
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.
subroutine chfl_frame%positions(data, size[, status])

Get a pointer to the positions array from the frame.

This function set the data array to be the internal positions array. This array is a natoms x 3 array, and the number of atoms will be in the size parameter.

This function gives access to chemfiles internal data structure, and do not perform any copy, both when reading and writing the positions.

If the frame is resized (by writing to it, or calling chfl_frame%resize()), the pointer is invalidated. If the frame is freed using chfl_frame%free(), the pointer is freed too.

Parameters:
  • data (*, *) [real,pointer] :: pointer to a float array containing the positions
  • size [integer] :: number of atom, i.e. size of the data array
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.

subroutine chfl_frame%velocities(data, size[, status])

Get a pointer to the velocities array from the frame.

This function set the data array to be the internal positions array. This array is a natoms x 3 array, and the number of atoms will be in the size parameter.

This function gives access to chemfiles internal data structure, and do not perform any copy, both when reading and writing the velocities.

If the frame is resized (by writing to it, or calling chfl_frame%resize()), the pointer is invalidated. If the frame is freed using chfl_frame%free(), the pointer is freed too.

Parameters:
  • data (*, *) [real,pointer] :: pointer to a float array containing the velocities
  • size [integer] :: number of atom, i.e. size of the data array
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.

subroutine chfl_frame%add_velocities([status])

Add velocity data to this frame.

The velocities ar initialized to zero. If the frame already has velocities, this does nothing.

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.
subroutine chfl_frame%has_velocities(result[, status])

Check if this frame contains velocity data.

Parameters:result [logical,kind=1] :: .true. if the frame has velocities, .false. otherwise.
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.
subroutine chfl_frame%set_cell(cell[, status])

Set the chfl_cell of this frame to cell.

Parameters:cell [chfl_cell] :: new unit cell of the frame
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.
subroutine chfl_frame%set_topology(topology[, status])

Set the chfl_topology of this frame to topology.

Calling this function with a topology that does not contain the right number of atom will return an error.

Parameters:topology [chfl_topology] :: new topology of the frame
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.
subroutine chfl_frame%step(step[, status])

Get the frame step, i.e. the frame number in the trajectory in step.

Parameters:step [integer] :: frame step number
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.
subroutine chfl_frame%set_step(step[, status])

Set the frame step, i.e. the frame number in the trajectory to step.

Parameters:step [integer] :: The new frame step
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.
subroutine chfl_frame%guess_topology([status])

Guess the bonds, angles and dihedrals in the frame.

The bonds are guessed using a distance-based algorithm, and then angles and dihedrals are guessed from the bonds.

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.
subroutine chfl_frame%free([status])

Destroy a frame, and free the associated memory

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.