dynsight.descriptors.velocity_alignment

dynsight.descriptors.velocity_alignment(universe, neigh_list_per_frame)[source]

Compute average velocity alignment phi.

If the Universe includes velocities, those are used. Otherwise, the displacements are used.

Parameters:
  • universe (Universe) – contains the coordinates at each frame.

  • neigh_list_per_frame (list[list[AtomGroup]]) – A frame-by-frame list of the neighbors of each atom, output of listNeighboursAlongTrajectory().

Returns:

If the Universe inclused velocities, the output has shape (n_atoms, n_frames), otherwise it has shape (n_atoms, n_frames - 1).

Return type:

NDArray[np.float64]

Example

import numpy as np
from dynsight.trajectory import Trj
from dynsight.descriptors import velocity_alignment

trj = Trj.init_from_xyz(path / "trajectory.xyz", dt=1.0)
neig_counts, _ = trj.get_coord_number(r_cut=3.0)

phi = velocity_alignment(
    universe=trj.universe,
    neigh_list_per_frame=neig_counts,
)