chemfiles::Frame
A frame contains data from one simulation step.
The Frame class holds data from one step of a simulation: the current 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. Specifically:
velocities
is the nullopt
version of optional<Array3D>
. Here, optional<T>
refers to the optional template as defined in std::experimental::optionalcell
is an infinite unit cell;topology
is empty, and contains no data. Public Functions
Frame
()Default constructor.
Frame
(size_t natoms)Constructor reserving some space for natoms
.
Frame
(const Topology & topology, const UnitCell & cell = UnitCell())Constructor reserving space for topology.natoms()
, and using cell
as unit cell. cell
default to an INFINITE
unit cell.
positions
()Get a modifiable reference to the positions.
positions
() constGet a const (non modifiable) reference to the positions.
set_positions
(const Array3D & pos)Set the positions.
velocities
()Get an optional modifiable reference to the velocities.
velocities
() constGet an optional const (non modifiable) reference to the velocities.
set_velocities
(const Array3D & vel)Set the velocities to vel
natoms
() constGet the number of particles in the system.
topology
()Get a modifiable reference to the internal topology.
topology
() constGet a const (non-modifiable) reference to the internal topology.
set_topology
(const Topology & top)Set the system topology.
cell
() constGet a const (non-modifiable) reference to the unit cell of the system.
set_cell
(const UnitCell & c)Set the unit cell fo the system.
resize
(size_t natoms)Resize the frame to store data for natoms
atoms. If the new size is bigger than the old one, missing data is initializd to 0. Pre-existing values are conserved. This function only resize the velocities if the data is present.
step
() constGet the current simulation step.
set_step
(size_t s)Set the current simulation step.
guess_topology
(bool bonds = true)Try to guess the bonds, angles and dihedrals in the system. If bonds
is true, guess everything; else only guess the angles and dihedrals from the bond list.