2.2.3.1 compute centroid

compute centroid is used to calculate the centroid of a group of particles.

Syntax:

compute      id group-id centroid

Examples:

compute      5 all centroid

Description:

This compute will calculate the centroid of a group of particles along x, y and z coordinates:

xc =  1
N- i=1Nx i
where N is the total number of particles in the group.

Output:

The output is in the form of array. Results can be accessed by c_id[dim] in the thermo_modify custom command, where id is the compute id and dim ranges from 0 to 2, eg. c_5[0].