amep.base.BaseFrame#

class amep.base.BaseFrame(reader, index)#

Bases: object

Per particle simulation data at one time step (a single frame).

__init__(reader, index)#

Basic data frame containing simulation data of particle-based simulations for one time step.

Parameters:
  • reader – AMEP reader object.

  • index (int) – Frame index.

Return type:

None.

Methods

__init__(reader, index)

Basic data frame containing simulation data of particle-based simulations for one time step.

add_data(key, data)

Adds new data to the frame.

angmom(**kwargs)

Returns the angular momentum of all particles or of all particles of a specific type.

coords(**kwargs)

All coordinates of all particles or of all particles of a specific particle type.

data(*args[, ptype, zerofill, return_keys])

Returns the entire data frame for all particles or for all particles of a specific particle type.

density([ptype])

Returns the number density.

forces(**kwargs)

Returns the forces acting on each particle or on particles of a specific particle type.

ids(**kwargs)

Returns the particle indices of all particles or of all particles of a specific particle type.

mass(**kwargs)

Returns the mass of all particles or of all particles of a specific type.

n([ptype])

Total number of particles.

nojump_coords(**kwargs)

Returns the nojump coordinates of all particles or of all particles of a specific particle type.

omegas(**kwargs)

Returns the angular velocities of all particles or of all particles of a specific particle type.

orientations(**kwargs)

Returns the orientation vectors of all particles or of all particles of a specific particle type.

radius(**kwargs)

Returns the radius of all particles or of all particles of a specific type.

torque(**kwargs)

Returns the torque acting on each particle or on each particle of a specific particle type.

types(**kwargs)

Returns the particle type of each or of each particle of a specific type.

unwrapped_coords(**kwargs)

Returns the unwrapped coordinates of all particles or of all particles of a specific particle type.

velocities(**kwargs)

Returns the velocities of all particles or of all particles of a specific particle type.

Attributes

box

Box boundary.

center

Center of the simulation box.

dim

Spatial dimension of the simnulation.

keys

Returns a list of all available data keys.

ptypes

Array of all particle types.

step

Time step of the frame.

time

The physical time of the frame.

volume

Returns the volume (for self.__dim=3) / area (for self.__dim=2) of the simulation box.

add_data(key: str, data: ndarray) None#

Adds new data to the frame.

Parameters:
  • key (str) – Name of the data.

  • data (np.ndarray) – Data array of shape (N,x) with N being the total number of particles.

Return type:

None.

angmom(**kwargs) ndarray#

Returns the angular momentum of all particles or of all particles of a specific type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Array of particle angular momenta.

Return type:

np.ndarray

property box#

Box boundary.

property center#

Center of the simulation box.

Returns:

x – Center of the simulation box.

Return type:

np.ndarray

coords(**kwargs)#

All coordinates of all particles or of all particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle coordinates.

Return type:

np.ndarray

data(*args, ptype: int | None = None, zerofill: bool = False, return_keys: bool = False) tuple[list, ndarray]#

Returns the entire data frame for all particles or for all particles of a specific particle type.

Notes

One can use _one_ wildcard character asterisk (“*”) to load all data sets matching that name. For example, “name*” returns all datasets that start with “name”, “value[*]” returns all datasets with any number of characters in between the square brackets i.e. “value[1]”, “value[2]”, …, “value[any text with any length]”.

Parameters:
  • *args (str) – Parameter keys. One wildcard character asterisk can be used, see note above.

  • ptype (int | list, optional) – Particle type. Is internally converted to a list and all matching ptypes are returned. The default is None.

  • zerofill (bool, optional) – If True, empty strings are replaced by a column of zeros in the returned data array. The default is False.

  • returnkeys (bool, optional) – If True, a list of the data keys is returned together with the data. The default is False.

Returns:

  • datakeys (list) – List of str containing the column keys/names. This is only returned if returnkeys=True.

  • data (np.ndarray) – Data array of shape (N, len(keys)).

density(ptype=None)#

Returns the number density.

property dim#

Spatial dimension of the simnulation.

Returns:

x – Spatial dimension.

Return type:

int

forces(**kwargs) ndarray#

Returns the forces acting on each particle or on particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle forces.

Return type:

np.ndarray

ids(**kwargs) ndarray#

Returns the particle indices of all particles or of all particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Particle indices.

Return type:

np.ndarray

property keys: list#

Returns a list of all available data keys.

Returns:

datakeys – List of str containing all available data keys.

Return type:

list

mass(**kwargs) ndarray#

Returns the mass of all particles or of all particles of a specific type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Array of particle masses.

Return type:

np.ndarray

n(ptype=None)#

Total number of particles.

Parameters:

ptype (int, optional) – Particle type. The default is None (all particles).

Returns:

Total particle number of the given particle type.

Return type:

int

nojump_coords(**kwargs)#

Returns the nojump coordinates of all particles or of all particles of a specific particle type. These coordinates are only available, when the nojump method of the trajectory which contains the frames was called.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle coordinates.

Return type:

np.ndarray

omegas(**kwargs) ndarray#

Returns the angular velocities of all particles or of all particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle angular velocity vectors.

Return type:

np.ndarray

orientations(**kwargs) ndarray#

Returns the orientation vectors of all particles or of all particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle orientation vectors.

Return type:

np.ndarray

property ptypes#

Array of all particle types.

radius(**kwargs) ndarray#

Returns the radius of all particles or of all particles of a specific type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Array of particle radii.

Return type:

np.ndarray

property step#

Time step of the frame.

Returns:

Time step of the frames.

Return type:

int

property time: float#

The physical time of the frame.

torque(**kwargs) ndarray#

Returns the torque acting on each particle or on each particle of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle torque vectors.

Return type:

np.ndarray

types(**kwargs) ndarray#

Returns the particle type of each or of each particle of a specific type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Array of particle types.

Return type:

np.ndarray

unwrapped_coords(**kwargs) ndarray#

Returns the unwrapped coordinates of all particles or of all particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of unwrapped particle coordinates.

Return type:

np.ndarray

velocities(**kwargs) ndarray#

Returns the velocities of all particles or of all particles of a specific particle type.

Parameters:

ptype (int, optional) – Particle type. The default is None.

Returns:

Coordinate frame of particle velocities.

Return type:

np.ndarray

property volume#

Returns the volume (for self.__dim=3) / area (for self.__dim=2) of the simulation box.