Frame type

type Frame

A Frame holds data for one step of a simulation. As not all formats provide all the types of information, some fields may be initialized to a default value. A Frame may contain the following data:

  • Positions for all the atoms in the system;
  • Velocities for all the atoms in the system;
  • The Topology of the system;
  • The UnitCell of the system.
function Frame()
Create a new empty Frame.
function deepcopy(frame::Frame)
Make a deep copy of a Frame.
function size(frame::Frame)
Get the number of atoms in the frame.
function resize!(frame::Frame, natoms::Integer)
Resize the positions and the velocities in the frame, to make 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.
function positions(frame::Frame)
Get the positions in a Frame as an array. The positions are readable and writable from this array. If the frame is resized (by writing to it, or calling resize!), the array is invalidated.
function velocities(frame::Frame)

Get the velocities in a Frame as an array. The velocities are readable and writable from this array. If the frame is resized (by writing to it, or calling resize!), the array is invalidated.

If the frame do not have velocity, this function will error. You can use add_velocities! to add velocities to a frame before calling this function.

function add_velocities!(frame::Frame)
Add velocities to this frame. The storage is initialized with the result of size(frame) as number of atoms. If the frame already have velocities, this does nothing.
function has_velocities(frame::Frame)
Check if a frame contains velocity data or not.
function add_atom!(frame::Frame, atom::Atom, position::Vector{Float64}, velocity::Vector{Float64} = Float64[0.0, 0.0, 0.0])
Add an atom and the corresponding position and velocity data to a frame.
function remove_atom!(frame::Frame, index::Integer)

Remove the atom at index from the frame.

This modify all the atoms indexes after index, and invalidate any array obtained using positions or velocities.

function set_cell!(frame::Frame, cell::UnitCell)
Set the cell associated with a frame.
function set_topology!(frame::Frame, topology::Topology)
Set the topology associated with a frame.
function step(frame::Frame)
Get the frame step, i.e. the frame number in the trajectory.
function set_step!(frame::Frame, step::Integer)
Set the frame step to step.
function guess_bonds!(frame::Frame)
Guess the bonds, angles and dihedrals in the frame using a distance criteria.
function add_bond!(frame::Frame, i::Integer, j::Integer, order = nothing)
Add an additional bond to the Frame’s Topology.
function remove_bond!(frame::Frame, i::Integer, j::Integer)
Remove a bond from the Frame’s Topology.
function add_residue!(frame::Frame, residue::Residue)
Add a residue to the Frame’s Topology.
function distance(frame::Frame, i::Integer, j::Integer)
Calculate the distance between two atoms.
function angle(frame::Frame, i::Integer, j::Integer, k::Integer)
Calculate the angle made by three atoms.
function dihedral(frame::Frame, i::Integer, j::Integer, k::Integer, m::Integer)
Calculate the dihedral (torsional) angle made by four unbranched atoms.
function out_of_plane(frame::Frame, i::Integer, j::Integer, k::Integer, m::Integer)
Calculate the out-of-plane (improper) angle made by four atoms.
function property(frame::Frame, name::String)
Get a named property for the given atom.
function set_property!(frame::Frame, name::String, value)
Set a named property for the given Frame.
function properties_count(frame::Frame)
Get the number of properties associated with a frame.
function list_properties(frame::Frame)
Get the names of all properties associated with a frame.