"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

compute rigid/local command :h3

[Syntax:]

compute ID group-ID rigid/local rigidID input1 input2 ... :pre

ID, group-ID are documented in "compute"_compute.html command :ulb,l
rigid/local = style name of this compute command :l
rigidID = ID of fix rigid/small command or one of its variants :l
input = one or more rigid body attributes :l
  possible attributes = id, mol, mass,
                        x, y, z, xu, yu, zu, ix, iy, iz
                        vx, vy, vz, fx, fy, fz,
                        omegax, omegay, omegaz,
                        angmomx, angmomy, angmomz,
                        quatw, quati, quatj, quatk,
                        tqx, tqy, tqz,
                        inertiax, inertiay, inertiaz
      id = atom ID of atom within body which owns body properties
      mol = molecule ID used to define body in "fix rigid/small"_fix_rigid.html command
      mass = total mass of body
      x,y,z = center of mass coords of body
      xu,yu,zu = unwrapped center of mass coords of body
      ix,iy,iz = box image that the center of mass is in
      vx,vy,vz = center of mass velocities
      fx,fy,fz = force of center of mass
      omegax,omegay,omegaz = angular velocity of body
      angmomx,angmomy,angmomz = angular momentum of body
      quatw,quati,quatj,quatk = quaternion components for body
      tqx,tqy,tqz = torque on body
      inertiax,inertiay,inertiaz = diagonalized moments of inertia of body :pre
:ule

[Examples:]

compute 1 all rigid/local myRigid mol x y z :pre

[Description:]

Define a computation that simply stores rigid body attributes for
rigid bodies defined by the "fix rigid/small"_fix_rigid.html command
or one of its NVE, NVT, NPT, NPH variants.  The data is stored as
local data so it can be accessed by other "output
commands"_Section_howto.html#howto_15 that process local data, such as
the "compute reduce"_compute_reduce.html or "dump local"_dump.html
commands.

Note that this command only works with the "fix
rigid/small"_fix_rigid.html command or its variants, not the fix rigid
command and its variants.  The ID of the "fix
rigid/small"_fix_rigid.html command used to define rigid bodies must
be specified as {rigidID}.  The "fix rigid"_fix_rigid.html command is
typically used to define a handful of (potentially very large) rigid
bodies.  It outputs similar per-body information as this command
directly from the fix as global data; see the "fix
rigid"_fix_rigid.html doc page for details

The local data stored by this command is generated by looping over all
the atoms owned on a processor.  If the atom is not in the specified
{group-ID} or is not part of a rigid body it is skipped.  If it is not
the atom within a body that is assigned to store the body information
it is skipped (only one atom per body is so assigned).  If it is the
assigned atom, then the info for that body is output.  This means that
information for N bodies is generated.  N may be less than the # of
bodies defined by the fix rigid command, if the atoms in some bodies
are not in the {group-ID}.

NOTE: Which atom in a body owns the body info is determined internal
to LAMMPS; it's the one nearest the geometric center of the body.
Typically you should avoid this complication, by defining the group
associated with this fix to include/exclude entire bodies.

Note that as atoms and bodies migrate from processor to processor,
there will be no consistent ordering of the entries within the local
vector or array from one timestep to the next.

Here is an example of how to use this compute to dump rigid body info
to a file:

compute 1 all rigid/local myRigid mol x y z fx fy fz
dump 1 all local 1000 tmp.dump index c_1\[1\] c_1\[2\] c_1\[3\] c_1\[4\] c_1\[5\] c_1\[6\] c_1\[7\] :pre

:line

This section explains the rigid body attributes that can be specified.

The {id} attribute is the atomID of the atom which owns the rigid body, which is
assigned by the "fix rigid/small"_fix_rigid.html command.

The {mol} attribute is the molecule ID of the rigid body.  It should
be the molecule ID which all of the atoms in the body belong to, since
that is how the "fix rigid/small"_fix_rigid.html command defines its
rigid bodies.

The {mass} attribute is the total mass of the rigid body.

There are two options for outputting the coordinates of the center of
mass (COM) of the body.  The {x}, {y}, {z} attributes write the COM
"unscaled", in the appropriate distance "units"_units.html (Angstroms,
sigma, etc).  Use {xu}, {yu}, {zu} if you want the COM "unwrapped" by
the image flags for each atobody.  Unwrapped means that if the body
COM has passed thru a periodic boundary one or more times, the value
is generated what the COM coordinate would be if it had not been
wrapped back into the periodic box.

The image flags for the body can be generated directly using the {ix},
{iy}, {iz} attributes.  For periodic dimensions, they specify which
image of the simulation box the COM is considered to be in.  An image
of 0 means it is inside the box as defined.  A value of 2 means add 2
box lengths to get the true value.  A value of -1 means subtract 1 box
length to get the true value.  LAMMPS updates these flags as the rigid
body COMs cross periodic boundaries during the simulation.

The {vx}, {vy}, {vz}, {fx}, {fy}, {fz} attributes are components of
the COM velocity and force on the COM of the body.

The {omegax}, {omegay}, and {omegaz} attributes are the angular
velocity components of the body around its COM.

The {angmomx}, {angmomy}, and {angmomz} attributes are the angular
momentum components of the body around its COM.

The {quatw}, {quati}, {quatj}, and {quatk} attributes are the
components of the 4-vector quaternion representing the orientation of
the rigid body.  See the "set"_set.html command for an explanation of
the quaternion vector.

The {angmomx}, {angmomy}, and {angmomz} attributes are the angular
momentum components of the body around its COM.

The {tqx}, {tqy}, {tqz} attributes are components of the torque acting
on the body around its COM.

The {inertiax}, {inertiay}, {inertiaz} attributes are components of
diagonalized inertia tensor for the body, i.e the 3 moments of inertia
for the body around its principal axes, as computed internally by
LAMMPS.

:line

[Output info:]

This compute calculates a local vector or local array depending on the
number of keywords.  The length of the vector or number of rows in the
array is the number of rigid bodies.  If a single keyword is
specified, a local vector is produced.  If two or more keywords are
specified, a local array is produced where the number of columns = the
number of keywords.  The vector or array can be accessed by any
command that uses local values from a compute as input.  See "this
section"_Section_howto.html#howto_15 for an overview of LAMMPS output
options.

The vector or array values will be in whatever "units"_units.html the
corresponding attribute is in:

id,mol = unitless
mass = mass units
x,y,z and xy,yu,zu = distance units
vx,vy,vz = velocity units
fx,fy,fz = force units
omegax,omegay,omegaz = radians/time units
angmomx,angmomy,angmomz = mass*distance^2/time units
quatw,quati,quatj,quatk = unitless
tqx,tqy,tqz = torque units
inertiax,inertiay,inertiaz = mass*distance^2 units :ul

[Restrictions:]

This compute is part of the RIGID package.  It is only enabled if
LAMMPS was built with that package.  See the "Making
LAMMPS"_Section_start.html#start_3 section for more info.

[Related commands:]

"dump local"_dump.html, "compute reduce"_compute_reduce.html

[Default:] none
