COM
This is part of the vatom module

Calculate the center of mass for a group of atoms.

The computed center of mass is stored as a virtual atom that can be accessed in an atom list through the label for the COM action that creates it.

For arbitrary weights (e.g. geometric center) see CENTER.

When running with periodic boundary conditions, the atoms should be in the proper periodic image. This is done automatically since PLUMED 2.2, by considering the ordered list of atoms and rebuilding the molecule using a procedure that is equivalent to that done in WHOLEMOLECULES . Notice that rebuilding is local to this action. This is different from WHOLEMOLECULES which actually modifies the coordinates stored in PLUMED.

In case you want to recover the old behavior you should use the NOPBC flag. In that case you need to take care that atoms are in the correct periodic image.

Examples

The following input instructs plumed to print the distance between the center of mass for atoms 1,2,3,4,5,6,7 and that for atoms 15,20:

Click on the labels of the actions for more information on what each action computes
tested on v2.9
c1: COM 
ATOMS
the list of atoms which are involved the virtual atom's definition.
=1-7 c2: COM
ATOMS
the list of atoms which are involved the virtual atom's definition.
=15,20 d1: DISTANCE
ATOMS
the pair of atom that we are calculating the distance between.
=c1,c2 PRINT
ARG
the input for this action is the scalar output from one or more other actions.
=d1
Glossary of keywords and components
The atoms involved can be specified using
ATOMS the list of atoms which are involved the virtual atom's definition. For more information on how to specify lists of atoms see Groups and Virtual Atoms
Options
NOPBC ( default=off ) ignore the periodic boundary conditions when calculating distances
MASS ( default=off ) If set center is mass weighted
PHASES

( default=off ) Compute center using trigonometric phases

WEIGHTS Center is computed as a weighted average.
SET_CHARGE Set the charge of the virtual atom to a given value.
SET_MASS Set the mass of the virtual atom to a given value.