TrajectoryFrame

class mdcraft.core.TrajectoryFrame(frame: int, time: float, *, timestep: int = None, dimensions: ndarray[float64] = None, n_atoms: int = None, ids: ndarray[uint32] = None, positions: ndarray[float64] = None, forces: ndarray[float64] = None, velocities: ndarray[float64] = None, **kwargs)[source]

Bases: object

Trajectory frame.

This class holds the data of a single frame in a trajectory.

Parameters:
frameint

Frame number.

timefloat

Simulation time.

Reference unit: \(\mathrm{ps}\).

timestepint, keyword-only, optional

Timestep number.

dimensionsnumpy.ndarray, keyword-only, optional

Simulation box dimensions (or lattice parameters).

Reference units: \(\mathrm{nm}\) for lengths and degrees (\(^\circ\)) for angles.

n_atomsint, keyword-only, optional

Number of atoms.

idsnumpy.ndarray, keyword-only, optional

Atom indices or identifiers.

positionsnumpy.ndarray, keyword-only, optional

Atom positions.

Reference unit: \(\mathrm{nm}\).

forcesnumpy.ndarray, keyword-only, optional

Forces exerted on the atoms.

Reference unit: \(\mathrm{kJ/(mol\cdot nm)}\).

velocitiesnumpy.ndarray, keyword-only, optional

Atom velocities.

Reference unit: \(\mathrm{nm/ps}\).

**kwargsdict

Additional or non-standard per-atom attributes to be stored in the extra attribute.

Examples:

  • Topology information, like masses and charges.

  • LAMMPS-specific attributes, like image flags.

  • Custom attributes, like LAMMPS computes, fixes, and variables.

Note

All additional attributes are in the original simulation units specified and will likely not be consistent with the internal set of units used by MDCraft.

Attributes:
extradict

Additional or non-standard per-atom attributes.

Examples:

Attribute

Source(s)

Per-atom data type

"molecule_ids"

  • LAMMPS dump: mol attribute

int

"types"

  • LAMMPS dump: type attribute

int

"labels"

  • LAMMPS dump: typelabel attribute

str

"elements"

  • LAMMPS dump: element attribute

str

"masses"

  • LAMMPS dump: mass attribute

float

"charges"

  • LAMMPS dump: charge attribute

float

"image_flags"

  • LAMMPS dump: ix, iy, and iz attributes

numpy.ndarray[int]

"dipole_moments"

  • LAMMPS dump: mux, muy, and muz attributes

numpy.ndarray[float]

"dipole_moments_magnitudes"

  • LAMMPS dump: mu attribute

float

"angular_velocities"

  • LAMMPS dump: omegax, omegay, and omegaz attributes

numpy.ndarray[float]

"angular_momenta"

  • LAMMPS dump: angmomx, angmomy, and angmomz attributes

numpy.ndarray[float]

"torques"

  • LAMMPS dump: tqx, tqy, and tqz attributes

numpy.ndarray[float]

custom

  • LAMMPS dump: attributes beginning with c_, d_, d2_, f_, i_, i2_, and v_

any

Methods

property dimensions: ndarray[float64]

Simulation box dimensions (or lattice parameters).

Sources:

  • LAMMPS dump: ITEM: BOX BOUNDS [...] header.

Reference units: \(\mathrm{nm}\) for lengths and degrees (\(^\circ\)) for angles.

property forces: ndarray[float64]

Forces exerted on the atoms.

Sources:

  • LAMMPS dump: fx, fy, and fz attributes.

Reference unit: \(\mathrm{kJ/(mol\cdot nm)}\).

property frame: int

Frame number.

Sources:

  • LAMMPS dump: Enumeration.

property ids: ndarray[uint32]

Atom indices or identifiers.

Sources:

  • LAMMPS dump: id attribute or enumeration.

property n_atoms: int

Number of atoms.

Sources:

  • LAMMPS dump: ITEM: NUMBER OF ATOMS header.

property positions: ndarray[float64]

Atom positions.

Sources:

  • LAMMPS dump: x[su], y[su], and z[su] attributes.

Reference unit: \(\mathrm{nm}\).

property time: float

Simulation time.

Sources:

  • LAMMPS dump: ITEM: TIME header.

Reference unit: \(\mathrm{ps}\).

property timestep: int

Timestep number.

Sources:

  • LAMMPS dump: ITEM: TIMESTEP header.

property velocities: ndarray[float64]

Atom velocities.

Sources:

  • LAMMPS dump: vx, vy, and vz attributes.

Reference unit: \(\mathrm{nm/ps}\).