compute property/chunk command

Syntax

compute ID group-ID property/chunk chunkID input1 input2 ...
  • ID, group-ID are documented in compute command

  • property/chunk = style name of this compute command

  • input = one or more attributes

    attributes = count, id, coord1, coord2, coord3
      count = # of atoms in chunk
      id = original chunk IDs before compression by compute chunk/atom
      coord123 = coordinates for spatial bins calculated by compute chunk/atom
    

Examples

compute 1 all property/chunk count
compute 1 all property/chunk ID coord1

Description

Define a computation that stores the specified attributes of chunks of atoms.

In LAMMPS, chunks are collections of atoms defined by a compute chunk/atom command, which assigns each atom to a single chunk (or no chunk). The ID for this command is specified as chunkID. For example, a single chunk could be the atoms in a molecule or atoms in a spatial bin. See the compute chunk/atom doc page and Section 6.23 for details of how chunks can be defined and examples of how they can be used to measure properties of a system.

This compute calculates and stores the specified attributes of chunks as global data so they can be accessed by other output commands and used in conjunction with other commands that generate per-chunk data, such as compute com/chunk or compute msd/chunk.

Note that only atoms in the specified group contribute to the calculation of the count attribute. The compute chunk/atom command defines its own group; atoms will have a chunk ID = 0 if they are not in that group, signifying they are not assigned to a chunk, and will thus also not contribute to this calculation. You can specify the “all” group for this command if you simply want to include atoms with non-zero chunk IDs.

The count attribute is the number of atoms in the chunk.

The id attribute stores the original chunk ID for each chunk. It can only be used if the compress keyword was set to yes for the compute chunk/atom command referenced by chunkID. This means that the original chunk IDs (e.g. molecule IDs) will have been compressed to remove chunk IDs with no atoms assigned to them. Thus a compressed chunk ID of 3 may correspond to an original chunk ID (molecule ID in this case) of 415. The id attribute will then be 415 for the 3rd chunk.

The coordN attributes can only be used if a binning style was used in the compute chunk/atom command referenced by chunkID. For bin/1d, bin/2d, and bin/3d styles the attribute is the center point of the bin in the corresponding dimension. Style bin/1d only defines a coord1 attribute. Style bin/2d adds a coord2 attribute. Style bin/3d adds a coord3 attribute.

Note that if the value of the units keyword used in the compute chunk/atom command is box or lattice, the coordN attributes will be in distance units. If the value of the units keyword is reduced, the coordN attributes will be in unitless reduced units (0-1).

The simplest way to output the results of the compute property/chunk calculation to a file is to use the fix ave/time command, for example:

compute cc1 all chunk/atom molecule
compute myChunk1 all property/chunk cc1 count
compute myChunk2 all com/chunk cc1
fix 1 all ave/time 100 1 100 c_myChunk1 c_myChunk2[*] file tmp.out mode vector

Output info:

This compute calculates a global vector or global array depending on the number of input values. The length of the vector or number of rows in the array is the number of chunks.

This compute calculates a global vector or global array where the number of rows = the number of chunks Nchunk as calculated by the specified compute chunk/atom command. If a single input is specified, a global vector is produced. If two or more inputs are specified, a global array is produced where the number of columns = the number of inputs. The vector or array can be accessed by any command that uses global values from a compute as input. See this section for an overview of LAMMPS output options.

The vector or array values are “intensive”. The values will be unitless or in the units discussed above.

Restrictions

none