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 maybe the velocities of the particles in the system.

Public Functions

Frame()

Default constructor, reserving space for 100 atoms.

Frame(size_t natoms)

Constructor reserving some space for natoms.

Frame(Topology top, bool has_velocities = false)

Constructor called to build a frame that can hold the data from a specific topology.

Array3D & positions()

Get a modifiable reference to the positions.

const Array3D & positions() const

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

void positions(const Array3D & pos)

Set the positions.

bool has_velocities() const

Does this frame have velocity data ?

Array3D & velocities()

Get a modifiable reference to the velocities.

const Array3D & velocities() const

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

void velocities(const Array3D & vel)

Set the velocities.

void raw_positions(float pos[][3], size_t size) const

Get a copy of the positions, as a C-style array. The array is assumed to have a shape (size x 3); i.e. pos[size][3]. The size should be equal to the number of particles in the system.

void raw_velocities(float vel[][3], size_t size) const

Get a copy of the velocities, as a C-style array. The array is assumed to have a shape (size x 3); i.e. vel[size][3]. The size should be equal to the number of particles in the system.

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 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 cell(const UnitCell & c)

Set the unit cell fo the system.

void resize(size_t size, bool resize_velocities = false)

Resize the internal arrays, and initialize them with 0. The resize_velocities parameter should be true to resize also the velocities array.

size_t step() const

Get the current simulation step.

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