\(\renewcommand{\AA}{\text{Å}}\)

compute inertia command

Accelerator Variants: inertia/kk

Syntax

compute ID group-ID inertia
  • ID, group-ID are documented in compute command

  • inertia = style name of this compute command

Examples

compute 1 molecule inertia

Description

Added in version 2Sep2026.

Define a computation that calculates the symmetric moment of inertia tensor of the group of atoms around its center of mass, including all effects due to atoms passing through periodic boundaries.

The inertia tensor is computed as

\[I = \sum_i \left[ m_i \left( (r_i - r_{\text{cm}})^2 \mathbf{1} - (r_i - r_{\text{cm}}) \otimes (r_i - r_{\text{cm}}) \right) + I_i \right]\]

where \(r_{\text{cm}}\) is the center-of-mass position of the group, the sum is over all atoms in the group, and \(I_i\) is the moment of inertia of atom \(i\) about its own center. For point particles \(I_i\) is zero; for finite-size particles (finite-size spheres, ellipsoids, superellipsoids, line segments, triangles, and body particles) \(I_i\) is the moment of inertia of the particle’s shape, which is added using the parallel-axis theorem. For finite spheres, ellipsoids, line segments, and triangles this matches the treatment used by the fix rigid command; for superellipsoids and body particles the per-particle moment of inertia stored with each particle is used (these are not supported by fix rigid).

Note

The coordinates of an atom contribute to the inertia tensor in “unwrapped” form, by using the image flags associated with each atom. See the dump custom command for a discussion of “unwrapped” coordinates. See the Atoms section of the read_data command for a discussion of image flags and how they are set for each atom. You can reset the image flags (e.g., to 0) before invoking this compute by using the set image command.

Output info

This compute calculates a global vector of length 6, which can be accessed by indices 1–6. The six components of the symmetric inertia tensor are ordered \(I_{xx}, I_{yy}, I_{zz}, I_{xy}, I_{yz}, I_{xz}\). These values can be used by any command that uses global vector values from a compute as input. See the Howto output page for an overview of LAMMPS output options.

The vector values calculated by this compute are “intensive”. The vector values will be in mass*distance\(^2\) units.

Styles with a gpu, intel, kk, omp, or opt suffix are functionally the same as the corresponding style without the suffix. They have been optimized to run faster, depending on your available hardware, as discussed on the Accelerator packages page. The accelerated styles take the same arguments and should produce the same results, except for round-off and precision issues.

These accelerated styles are part of the GPU, INTEL, KOKKOS, OPENMP, and OPT packages, respectively. They are only enabled if LAMMPS was built with those packages. See the Build package page for more info.

You can specify the accelerated styles explicitly in your input script by including their suffix, or you can use the -suffix command-line switch when you invoke LAMMPS, or you can use the suffix command in your input script.

See the Accelerator packages page for more instructions on how to use the accelerated styles effectively.

Restrictions

none

Default

none