Action: GROUP

Module core
Description Usage
Define a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. used in 13 tutorialsused in 130 eggs
This action outputs data to a file. You can read more about how PLUMED manages output files here

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 numerical indexes for the set of atoms in the group
REMOVE atoms remove these atoms from the list

Further details and examples

Define a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms.

The GROUP command can be used to define a list of atoms so that the group can be referenced in the definitions of other CVs or virtual atoms as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
o: GROUPDefine a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. More details ATOMSthe numerical indexes for the set of atoms in the group=1,4,7,11,14
h: GROUPDefine a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. More details ATOMSthe numerical indexes for the set of atoms in the group=2,3,5,6,8,9,12,13
# compute the coordination among the two groups
c: COORDINATIONCalculate coordination numbers. This action has hidden defaults. More details GROUPAFirst list of atoms=o GROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted)=h R_0The r_0 parameter of the switching function=0.3
# same could have been obtained without GROUP, just writing:
# c: COORDINATION GROUPA=1,4,7,11,14 GROUPB=2,3,5,6,8,9,12,13

# print the coordination on file 'colvar' PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=c FILEthe name of the file on which to output these quantities=colvar

The first group command here creates a group of atoms called o containing atoms 1, 4, 7, 11 and 14. The second group command here creates a group of toms called h containing atoms 2, 3, 5, 6, 8, 9, 12, and 13.

As discussed on this page atoms in groups can be listed as comma separated numbers (i.e. 1,2,3,10,45,7,9), simple positive ranges (i.e. 20-40), ranges with a stride either positive or negative (i.e. 20-40:2 or 80-50:-2) or as comma separated combinations of all the former methods (1,2,4,5,10-20,21-40:2,80-50:-2).

Oftentime people will store the definitions in a separate file as has been done in the following example input.

Click on the labels of the actions for more information on what each action computes
tested on2.11
INCLUDEIncludes an external input file, similar to #include in C preprocessor. More details. Show included file FILEfile to be included=extras/groups.dat
# compute the coordination among the two groups
c: COORDINATIONCalculate coordination numbers. This action has hidden defaults. More details GROUPAFirst list of atoms=groupa GROUPBSecond list of atoms (if empty, N*(N-1)/2 pairs in GROUPA are counted)=groupb R_0The r_0 parameter of the switching function=0.3
# print the coordination on file 'colvar'
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=c FILEthe name of the file on which to output these quantities=colvar

Storing the groups in the extra file is particularly useful if the groups include list of thousand atoms. Putting these definitions in a separate file ensures that the main plumed.dat file is not cluttered. You can even use a GROMACS index file to hold the groups as illustrated in the input below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
# import group named 'Protein' from file index.ndx
pro: GROUPDefine a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. More details NDX_FILEthe name of index file (gromacs syntax)=extras/index.ndx NDX_GROUPthe name of the group to be imported (gromacs syntax) - first group found is used by default=Protein
# dump all the atoms of the protein on a trajectory file
DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out=pro FILEfile on which to output coordinates; extension is automatically detected=traj.gro

Notice that you use the keyword NDX_FILE to set the name of the index file and NDX_GROUP to set the name of the group to be imported (default is first one). Further notice that starting from version 2.10 it is possible to directly use an @ndx: selector in the input to an action as shwn below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out={@ndx:load a group from a GROMACS index file.  Click here for more information. {extras/index.ndx Protein}} FILEfile on which to output coordinates; extension is automatically detected=traj.gro

Lastly notice that it is also possible to remove atoms from the list of atoms specified in a GROUP by using the keywords REMOVE, SORT, and UNIQUE as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
# take one atom every three, that is oxygens
ox: GROUPDefine a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. More details ATOMSthe numerical indexes for the set of atoms in the group=1-90:3
# take the remaining atoms, that is hydrogens
hy: GROUPDefine a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. More details ATOMSthe numerical indexes for the set of atoms in the group=1-90 REMOVEremove these atoms from the list=ox
DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out=ox FILEfile on which to output coordinates; extension is automatically detected=ox.gro
DUMPATOMSDump selected atoms on a file. More details ATOMSthe atom indices whose positions you would like to print out=hy FILEfile on which to output coordinates; extension is automatically detected=hy.gro

When you used the GROUP command the flow as follows:

  • If ATOMS is present, then take the ordered list of atoms from the ATOMS keyword as a starting list.
  • Alternatively, if NDX_FILE is present, use the list obtained from the gromacs group.
  • If REMOVE is present, then remove the first occurrence of each of these atoms from the list. If one tries to remove an atom that was not listed plumed adds a notice in the output. An atom that is present twice in the original list might be removed twice.
  • If SORT is present, then the resulting list is sorted by increasing serial number.
  • If UNIQUE is present, then the resulting list is sorted by increasing serial number and duplicate elements are removed.

Notice that this command just creates a shortcut, and does not imply any real calculation. So, having a huge group defined does not slow down your calculation in any way. It is just convenient to better organize input files.

Syntax

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

Keyword Type Default Description
ATOMS input none the numerical indexes for the set of atoms in the group
REMOVE input none remove these atoms from the list
SORT optional false sort the resulting list
UNIQUE optional false sort atoms and remove duplicated ones
NDX_FILE optional not used the name of index file (gromacs syntax)
NDX_GROUP optional not used the name of the group to be imported (gromacs syntax) - first group found is used by default