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:

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%add_bond(i, j[, status])

Add a bond between the atoms at indexes i and j in the frame’s topology.

Parameters:
  • i [integer] :: atomic index of the first atom of the bond
  • j [integer] :: atomic index of the second atom of the bond
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%remove_bond(i, j[, status])

Remove any existing bond between the atoms at indexes i and j in the frame’s topology.

This function does nothing if there is no bond between i and j.

Parameters:
  • i [integer] :: The atomic index of the first atom
  • j [integer] :: The atomic index of the second atom
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_residue(residue[, status])

Add a copy of residue to this frame’s topology.

The residue id must not already be in the topology, and the residue must contain only atoms that are not already in another residue.

Parameters:residue [chfl_residue] :: residue to add in the topology
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%distance(i, j, distance[, status])

Get the distance between the atoms at indexes i and j in this frame, accounting for periodic boundary conditions. The result is placed in distance, and expressed in angstroms.

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%angle(i, j, k, angle[, status])

Get the angle formed by the atoms at indexes i, j and k in this frame, accounting for periodic boundary conditions. The result is placed in angle, and expressed in radians.

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%dihedral(i, j, k, m, dihedral[, status])

Get the dihedral angle formed by the atoms at indexes i, j, k and m in this frame, accounting for periodic boundary conditions. The result is placed in dihedral, and expressed in radians.

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%out_of_plane(i, j, k, m, distance[, status])

Get the out of plane distance formed by the atoms at indexes i, j, k and m in this frame, accounting for periodic boundary conditions. The result is placed in distance and expressed in angstroms.

This is the distance between the atom j and the ikm plane. The j atom is the center of the improper dihedral angle formed by i, j, k and m.

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%set_property(name, property[, status])

Add a new property with the given name to this frame.

If a property with the same name already exists, this function override the existing property with the new one.

Parameters:
  • character (len=*) :: property name
  • type (chfl_property) :: the new property
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.