compute cluster/atom command — LAMMPS documentation

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

# compute cluster/atom command

# compute fragment/atom command

# compute aggregate/atom command

## Syntax

    compute ID group-ID cluster/atom cutoff
    compute ID group-ID fragment/atom keyword value ...
    compute ID group-ID aggregate/atom cutoff

- ID, group-ID are documented in compute command

- cluster/atom or fragment/atom or aggregate/atom = style name of this compute command

- cutoff = distance within which to label atoms as part of same cluster (distance units)

- zero or more keyword/value pairs may be appended to fragment/atom

- keyword = single

  >     single value = yes or no to treat single atoms (no bonds) as fragments

## Examples

    compute 1 all cluster/atom 3.5
    compute 1 all fragment/atom
    compute 1 all fragment/atom single no
    compute 1 all aggregate/atom 3.5

## Description

Define a computation that assigns each atom a cluster, fragment, or aggregate ID. Only atoms in the compute group are clustered and assigned cluster IDs. Atoms not in the compute group are assigned an ID = 0.

A cluster is defined as a set of atoms, each of which is within the cutoff distance from one or more other atoms in the cluster. If an atom has no neighbors within the cutoff distance, then it is a 1-atom cluster.

A fragment is similarly defined as a set of atoms, each of which has a bond to another atom in the fragment. Bonds can be defined initially via the data file or create_bonds commands, or dynamically by fixes which create or break bonds like fix bond/react, fix bond/create, fix bond/swap, or fix bond/break. The cluster ID or fragment ID of every atom in the cluster will be set to the smallest atom ID of any atom in the cluster or fragment, respectively.

For the fragment/atom style, the single keyword determines whether single atoms (not bonded to another atom) are treated as one-atom fragments or not, based on the yes or no setting. If the setting is no (the default), their fragment IDs are set to 0.

An aggregate is defined by combining the rules for clusters and fragments (i.e., a set of atoms, where each of them is within the cutoff distance from one or more atoms within a fragment that is part of the same cluster). This measure can be used to track molecular assemblies like micelles.

For computes cluster/atom and aggregate/atom a neighbor list needed to compute cluster IDs is constructed each time the compute is invoked. Thus it can be inefficient to compute/dump this quantity too frequently or to have multiple cluster/atom or aggregate/atom style computes.

Note

If you have a bonded system, then the settings of special_bonds command can remove pairwise interactions between atoms in the same bond, angle, or dihedral. This is the default setting for the special_bonds command, and means those pairwise interactions do not appear in the neighbor list. Because this fix uses the neighbor list, it also means those pairs will not be included when computing the clusters. This does not apply when using long-range coulomb (coul/long, coul/msm, coul/wolf or similar. One way to get around this would be to set special_bond scaling factors to very tiny numbers that are not exactly zero (e.g., \(1.0 \times 10^{-50}\)). Another workaround is to write a dump file and use the rerun command to compute the clusters for snapshots in the dump file. The rerun script can use a special_bonds command that includes all pairs in the neighbor list.

Note

For the compute fragment/atom style, each fragment is identified using the current bond topology. This will not account for bonds broken by the bond_style quartic command because it does not perform a full update of the bond topology data structures within LAMMPS.

## Output info

This compute calculates a per-atom vector, which can be accessed by any command that uses per-atom values from a compute as input. See the Howto output page for an overview of LAMMPS output options.

The per-atom vector values will be an ID \(> 0\), as explained above.

## Restrictions

none

## Related commands

compute coord/atom

## Default

The default for fragment/atom is single=no.