Skip to content

Action: COM

Module vatom
Description Usage
Calculate the center of mass for a group of atoms. used in 6 tutorialsused in 66 eggs
This action outputs data to a file. You can read more about how PLUMED manages output files here

Details and examples

Calculate the center of mass for a group of atoms.

The following example input shows how you can use this shortcut to calculate the center of mass for atoms 1,2,3,4,5,6,7 and for atoms 15,20. You can then compute the distance between the two center of masses.

Click on the labels of the actions for more information on what each action computes
tested on2.11
c1: COMCalculate the center of mass for a group of atoms. More details ATOMSthe list of atoms which are involved the virtual atom's definition=1-7
c2: COMCalculate the center of mass for a group of atoms. More details ATOMSthe list of atoms which are involved the virtual atom's definition=15,20
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=c1,c2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d1

The center of mass is stored as a virtual atom. As you can see from the above to refer to the position of the center of mass when specifying the atoms that should be used when calculating some other action you use the lable of the COM action that computes the center of mass of interest.

The COM command is a shortcut because it is a wrapper to CENTER. CENTER is more powerful than comm as it allows you to use arbitrary weights in place of the masses.

Periodic boundary conditions

If you run with periodic boundary conditions these are taken into account automatically when computing the center of mass. By default the way this is handled is akin to the way molecules are rebuilt in the WHOLEMOLECULES command. However, at variance to WHOLEMOLECULES, the copies of the atomic positions in this action are modified. The global positions (i.e. those that are used in all other actions) are not changed when the alignment is performed.

If you believe that PBC should not be applied when calculating the position fo the center of mass you can use the NOPBC flag as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
c1: COMCalculate the center of mass for a group of atoms. More details ATOMSthe list of atoms which are involved the virtual atom's definition=1-7 NOPBC ignore the periodic boundary conditions when calculating distances

Alternatively, if you would like to calculate the position of the center of mass using the PHASES method that is dicussed in the documentation for CENTER you can add the keyword PHASES as shwo below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
c1: COMCalculate the center of mass for a group of atoms. More details ATOMSthe list of atoms which are involved the virtual atom's definition=1-7 PHASES Compute center using trigonometric phases

The mass and charge of the vatom

By default the mass and charge of the COM are calculated by adding the masses and charges of the input atoms together. In other words, if your COM is calculated from the positions of atoms, the mass of the vatom is calculated as:

where is the mass of the th input atom. The charge is then calculated as:

where is the charge of the th atom. If for any reason you don't want the mass and charge of the VATOM to be set equal to these values you can set them manually by using the SET_CHARGE and SET_MASS keywords as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
c1: COMCalculate the center of mass for a group of atoms. More details ATOMSthe list of atoms which are involved the virtual atom's definition=1-7 SET_MASSSet the mass of the virtual atom to a given value=1 SET_CHARGESet the charge of the virtual atom to a given value=-1

Input

The atoms that serve as the input for this action are specified using one or more of the keywords in the following table.

Keyword Type Description
ATOMS atoms the list of atoms which are involved the virtual atom's definition

Full list of keywords

The following table describes the keywords and options that can be used with this action

Keyword Type Default Description
ATOMS input none the list of atoms which are involved the virtual atom's definition
SET_CHARGE optional not used Set the charge of the virtual atom to a given value
SET_MASS optional not used Set the mass of the virtual atom to a given value
NOPBC optional false ignore the periodic boundary conditions when calculating distances
PHASES optional false Compute center using trigonometric phases