mstk.trajectory.Frame

class mstk.trajectory.Frame(n_atom)

A frame records the positions and unit cell (and optionally velocities, charges, current step and current time) of the system at one specific time step.

Velocity is stored for analyzing dynamic properties with auto correlation function. Charge is stored for fluctuating charge method.

Parameters:

n_atom (int) – The number of atoms in the frame.

step

The current step. -1 means unknown.

Type:

int

time

The current simulation time. -1 means unknown.

Type:

float

cell

The unit cell.

Type:

UnitCell

positions

The positions of all atoms in the frame. It’s a np.ndarry of shape (n_atom, 3)

Type:

array_like

has_velocity

Whether or not there’s velocity information for all atoms

Type:

bool

velocities

The velocities of all atoms in the frame. It’s a np.ndarry of shape (n_atom, 3)

Type:

array_like

has_charge

Whether or not there’s charge information for all atoms

Type:

bool

charges

The charge of all atoms in the frame. It’s a np.ndarry of shape (n_atom,)

Type:

array_like

Methods

__init__(n_atom)

reset()

Remove step, time and cell information, and reset has_velocity, has_charge to False.

resize(n_atom)

Resize the number of atoms recorded in the frame.

Attributes

charges

The charges of all atoms in this frame

positions

The positions of all atoms in this frame

velocities

The velocities of all atoms in this frame

reset()

Remove step, time and cell information, and reset has_velocity, has_charge to False.

resize(n_atom)

Resize the number of atoms recorded in the frame.

Usually it is not necessary to call this method explicitly. If n_atom is smaller than previous value, the information of the end atoms will be trimmed. If n_atom is larger than previous value, the information for the new atoms will be random.

Parameters:

n_atom (int) – The new number of atoms

property positions

The positions of all atoms in this frame

Setter:

Set the positions of all atoms

Returns:

positions – The positions is a numpy array of shape (n_atom, 3)

Return type:

array_like

property velocities

The velocities of all atoms in this frame

Setter:

Set the velocities of all atoms

Returns:

velocities – The velocities is a numpy array of shape (n_atom, 3)

Return type:

array_like

property charges

The charges of all atoms in this frame

Setter:

Set the charges of all atoms

Returns:

charges – The charges is a numpy array of shape (n_atom,)

Return type:

array_like