api

API functions for the momentum analysis.

Summary

Functions:

check_momentum

Calculate the total linear momentum norm per frame and write it.

Reference

check_momentum(
trajectory_files: str | list[str],
output: str | None = None,
selection: SelectionCompatible = None,
use_full_atom_info: bool = False,
scale: PositiveReal | None = None,
md_format: MDEngineFormat | str = MDEngineFormat.PQ,
mode: str | FileWritingMode = 'w',
) Np1DNumberArray[source]

Calculate the total linear momentum norm per frame and write it.

Reads the given velocity trajectory file(s) frame by frame, calculates the norm of the total linear momentum P = sum_i m_i * v_i of the selected atoms for every frame and writes one row per frame containing the one-based frame index and the scaled momentum norm. This is a port of the legacy equipartition.jl tool.

Parameters:
  • trajectory_files (str | List[str]) – The velocity trajectory file(s) to read.

  • output (str | None, optional) – The output file. If None, the output is printed to stdout, by default None.

  • selection (SelectionCompatible, optional) – The selection of atoms to include in the total momentum, by default None (all atoms).

  • use_full_atom_info (bool, optional) – Whether to use the full atom information of the trajectory for the selection or not, by default False.

  • scale (PositiveReal | None, optional) – The scaling factor applied to the momentum norm before output, by default None (1e-15, which converts amu*Angstrom/s to amu*Angstrom/fs).

  • md_format (MDEngineFormat | str, optional) – The format of the trajectory, by default MDEngineFormat.PQ. Use qmcfc for legacy trajectories with a leading dummy ‘X’ atom.

  • mode (str | FileWritingMode, optional) – The writing mode of the output file, by default “w”.

Returns:

The scaled norms of the total linear momentum, one value per frame.

Return type:

Np1DNumberArray