# Frame

Chemfiles.FrameType

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:

source
Base.angleMethod
angle(frame::Frame, i::Integer, j::Integer, k::Integer) -> Float64


Calculate the angle made by three atoms.

source
Base.lengthMethod
length(frame::Frame) -> Int64


Get the number of atoms in the frame.

source
Base.resize!Method
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.

source
Base.sizeMethod
size(frame::Frame) -> Int64


Get the number of atoms in the frame.

source
Base.stepMethod
step(frame::Frame) -> UInt64


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

source
Chemfiles.add_atom!Function
add_atom!(frame::Frame, atom::Atom, position::Array{Float64,1})
add_atom!(frame::Frame, atom::Atom, position::Array{Float64,1}, velocity::Array{Float64,1})


Add an atom and the corresponding position and velocity data to a frame.

source
Chemfiles.add_bond!Function
add_bond!(frame::Frame, i::Integer, j::Integer)
add_bond!(frame::Frame, i::Integer, j::Integer, order::Any)


Add an additional bond to the Frame's Topology.

source
Chemfiles.add_velocities!Method
add_velocities!(frame::Frame)


Add velocities to this frame. The storage is initialized with the result of size(frame) as the number of atoms. If the frame already has velocities, this does nothing.

source
Chemfiles.clear_bonds!Method
clear_bonds!(frame::Frame)


Remove all bonds, angles and dihedral angles from the Frame's Topology.

source
Chemfiles.dihedralMethod
dihedral(frame::Frame, i::Integer, j::Integer, k::Integer, m::Integer) -> Float64


Calculate the dihedral (torsional) angle made by four unbranched atoms.

source
Chemfiles.out_of_planeMethod
out_of_plane(frame::Frame, i::Integer, j::Integer, k::Integer, m::Integer) -> Float64


Calculate the out-of-plane (improper) angle made by four atoms.

source
Chemfiles.positionsMethod
positions(frame::Frame) -> Chemfiles.ChemfilesArray


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.

source
Chemfiles.remove_atom!Method
remove_atom!(frame::Frame, index::Integer)


Remove the atom at index from the frame.

This function modifies all the atoms indexes after index, and invalidates any array obtained using positions or velocities.

source
Chemfiles.velocitiesMethod
velocities(frame::Frame) -> Chemfiles.ChemfilesArray


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.

source