# compute nparticles/tracer/region command

## Syntax

    compute ID group-ID nparticles/tracer/region general_keyword general_values

- ID, group-ID are documented in compute command
- nparticles/tracer/region = style name of this compute command
- general_keywords general_values are documented in compute
- region_count = obligatory keyword
- region-ID = ID of region atoms must be in to be counted
- tracer = obligatory keyword
- tracer-ID = ID of a fix of type fix property/atom/tracer
- zero or more keyword/value pairs may be appended to args
- keyword = periodic or reset_marker

    periodic value = dim image
      dim = x or y or z
      image = image that a particle has to be in to be counted (any integer number or all)
    reset_marker value = yes or no
      yes = un-mark particles after counting them
      no = do not un-mark particles after counting them

## Examples

    compute nparticles all nparticles/tracer/region region_count count tracer tr periodic z -1

## Description

Define a computation that calculates the number and mass of marked and un-marked particles that are in the region speficied via the region_count keyword. Particles have to be in the group “group-ID” to be counted.

Note that only particles marked by a fix property/atom/tracer or fix property/atom/tracer/stream command are counted - therefore, a valid ID of such a fix has to be provided via the tracer keyword.

The reset_marker keyword controls if particles are un-marked (default) after they have been counted once by this command.

Warning

If multiple compute nparticles/tracer/region commands are operating on the same fix property/atom/tracer commands, and the first compute resets the marker value, the second compute will not count them.

With the periodic keyword, you can restrict counting/unmarking to particles which are in a specified image in a periodic simulation. For example, using

    periodic z +2

means that particles are only counted if they are in z-image #2. By default, all particles are counted/unmarked regardless in which periodic image they are.

Warning

Currently, this command only supports one periodic boundary restriction via the periodic keyword. If keyword periodic is used multiple times, the last setting will be applied.

## Output info

This this compute calculates a global vector containing the following information (the number in brackets corresponds to the vector id):

- (1) total number of (marked + un-marked) particles in region
- (2) number of marked particles in region
- (3) total mass of (marked + un-marked) particles in region
- (4) mass of marked particles in region

See this section for an overview of LIGGGHTS(R)-PUBLIC output options.

## Restrictions

Currently, only one periodic restriction via the periodic keyword can be used.

## Related commands

fix property/atom/tracer

## Default

reset_marker = yes, periodic is off per default