FramesΒΆ

class 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::optional
  • cell 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.

Array3D & positions()

Get a modifiable reference to the positions.

const Array3D & positions() const

Get a const (non modifiable) reference to the positions.

void set_positions(const Array3D & pos)

Set the positions.

optional< Array3D > & velocities()

Get an optional modifiable reference to the velocities.

const optional< Array3D > & velocities() const

Get an optional const (non modifiable) reference to the velocities.

void set_velocities(const Array3D & vel)

Set the velocities to vel

size_t natoms() const

Get the number of particles in the system.

Topology & topology()

Get a modifiable reference to the internal topology.

const Topology & topology() const

Get a const (non-modifiable) reference to the internal topology.

void set_topology(const Topology & top)

Set the system topology.

const UnitCell & cell() const

Get a const (non-modifiable) reference to the unit cell of the system.

void set_cell(const UnitCell & c)

Set the unit cell fo the system.

void 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.

size_t step() const

Get the current simulation step.

void set_step(size_t s)

Set the current simulation step.

void 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.